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
I posted the following script I am trying to work with. As of night now, it takes every file in a folder and adds a prescript to create url links for all files in the folder and creates a text document in text editor with the result urls like so:

currently:

http://www.mynetwork.tv/vue/qt1.mov
http://www.mynetwork.tv/vue/qt2.mov
http://www.mynetwork.tv/vue/qt3.mov


I need it to put a space (like hitting the return key) between each of them starting with a double space first like so:

Needs to be:

(space)
(space)
http://www.mynetwork.tv/vue/qt1.mov
(space)
http://www.mynetwork.tv/vue/qt2.mov
(space)
http://www.mynetwork.tv/vue/qt3.mov


I know this is probably as simple as adding one line of code, but then again, I know nothing about writing code. I am slooooowly starting to catch on, but it will take time. Any help would be much appreciated. Thanks guys.


Current script:

tell application "Finder"
set theFolder to "Macinosh HD:Users:Users: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.mynetwork.tv/vue/" & 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
 

lee1210

macrumors 68040
Jan 10, 2005
3,182
3
Dallas, TX
Code:
tell application "Finder"
	set theFolder to "Macintosh HD:Users:lee: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.mynetwork.tv/vue/" & 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 should do it. Please try to put code in code tags, it makes it much easier to read. The # sign in the editor will wrap the currently selected text in the tags.

-Lee

P.S. There will be a trailing newline at the end of the next. If that's not acceptable, there would need to be a conditional in the repeat block to print the extra newline in every case except when i is equal to the number of items in theList.
 

thriftinkid

macrumors regular
Original poster
Mar 24, 2008
119
0
Code:
tell application "Finder"
	set theFolder to "Macintosh HD:Users:lee: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.mynetwork.tv/vue/" & 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 should do it. Please try to put code in code tags, it makes it much easier to read. The # sign in the editor will wrap the currently selected text in the tags.

-Lee

P.S. There will be a trailing newline at the end of the next. If that's not acceptable, there would need to be a conditional in the repeat block to print the extra newline in every case except when i is equal to the number of items in theList.

That worked perfect. I will remember to put it in code tags next time for sure. It is unreal how rediculously awesome you are. Thanks for all your help.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.