Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

thriftinkid

macrumors regular
Original poster
Mar 24, 2008
119
0
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

macrumors 6502a
Nov 27, 2005
898
0
RI
Try this.
Code:
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

macrumors regular
Original poster
Mar 24, 2008
119
0
Try this.
Code:
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!
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.