PDA

View Full Version : Whats wrong in this script?




thriftinkid
Apr 9, 2008, 09:46 AM
Hey Guys, Im new to writing any kind of code. I have the following script that Im trying to write that isnt working. I have a folder called "Finished" full of quicktime movies that I have uploaded to a server, and I'm trying make a list within text editor. I want text editor to place a url in front of each quicktime name in the folder, thus creating links to each one. If you guys can see whats wrong, and how to fix it, I would greatly appreciate it.

on run {input, parameters}


tell application "Finder"
set Afolder to "Macintosh HD:Users:John:desktop:Finished" as alias
set a_list to every file in Afolder as alias list
repeat with i from 1 to number of items in a_list
set a_file to (item i of a_list)
tell application "finder" to run application "textedit"
tell application "System Events" to perform keystroke "http://www.mysite.com/+a_list"
end repeat
end tell

return input
end run



lancestraz
Apr 9, 2008, 10:22 AM
Try this.
tell application "Finder"
set theFolder to "Macintosh HD:Users:John:Desktop:Finished" as alias
set theList to name of (every file in theFolder)
end tell

repeat with i from 1 to (number of items in theList)
set theName to (item i of theList)
set item i of theList to ("http://www.mysite.com/" & theName)
end repeat
set theText to ""
repeat with i from 1 to (number of items in theList)
set theText to (theText & (item i of theList) & "
")
end repeat

tell application "TextEdit"
activate
make new document
set the text of the front document to theText
end tell

thriftinkid
Apr 9, 2008, 03:47 PM
Try this.
tell application "Finder"
set theFolder to "Macintosh HD:Users:John:Desktop:Finished" as alias
set theList to name of (every file in theFolder)
end tell

repeat with i from 1 to (number of items in theList)
set theName to (item i of theList)
set item i of theList to ("http://www.mysite.com/" & theName)
end repeat
set theText to ""
repeat with i from 1 to (number of items in theList)
set theText to (theText & (item i of theList) & "
")
end repeat

tell application "TextEdit"
activate
make new document
set the text of the front document to theText
end tell

That worked perfect. Thanks So much for you help!