Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Apr 9, 2008, 09:46 AM   #1
thriftinkid
macrumors regular
 
Join Date: Mar 2008
Whats wrong in this script?

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

Last edited by thriftinkid; Apr 9, 2008 at 10:00 AM.
thriftinkid is offline   0 Reply With Quote
Old Apr 9, 2008, 10:22 AM   #2
lancestraz
macrumors 6502a
 
lancestraz's Avatar
 
Join Date: Nov 2005
Location: 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
lancestraz is offline   0 Reply With Quote
Old Apr 9, 2008, 03:47 PM   #3
thriftinkid
Thread Starter
macrumors regular
 
Join Date: Mar 2008
Quote:
Originally Posted by lancestraz View Post
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!
thriftinkid is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
thread Thread Starter Forum Replies Last Post
Whats wrong with my Apple II Plus? tevion5 Apple Collectors 5 Feb 7, 2014 10:28 AM
OS-neutral: whats the script with cheap game key sites? are they legit? madeirabhoy Mac and PC Games 3 Nov 22, 2013 10:01 AM
Whats wrong with my iPhone? xfortify iPhone 4 Jul 8, 2013 09:11 PM
Whats wrong with my computer? Mitchell112694 MacBook Pro 4 Mar 3, 2013 05:54 PM
How do I tell whats wrong after water damage? Z400Racer37 MacBook 1 Aug 30, 2012 04:32 PM

Forum Jump

All times are GMT -5. The time now is 05:18 PM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC