Whats wrong in this script?

Discussion in 'Mac Programming' started by thriftinkid, Apr 9, 2008.

  1. macrumors regular

    Mar 24, 2008
    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
  2. macrumors 6502a


    Nov 27, 2005
    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"
    	make new document
    	set the text of the front document to theText
    end tell
  3. thread starter macrumors regular

    Mar 24, 2008
    That worked perfect. Thanks So much for you help!

Share This Page