Got a tip for us? Let us know
|
|
#1 |
|
Script Editor to Automator Issue
I have had a few scripts now that work fine when I run the in script editor, but they don't run properly in automator. Automator has the ability to run applescript as part of a work flow by copying as pasting your applescript directly into Automator. I haven't had errors everytime I do it. But there are certain scripts that have had errors that have forced me to do some adjustments. Any ideas why? This recent script gave me the following error after copying and pasting it into an automator workflow.
Syntax Error No result was returned from some part of this expression. Here is the script: (including automators on run, return input, and end tell commands added by automator within workflow.) Code:
on run {input, parameters}
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 of theList)
set theName to (item i of theList)
set item i of theList to ("http://www.mywebsite.com/mainfolder/" & theName)
end repeat
set theText to "
"
repeat with i from 1 to (number of items of theList)
set theText to (theText & (item i of theList) & "
")
end repeat
tell application "TextEdit"
activate
make new text document
set the text of the front document to theText
end tell
return input
end run
|
|
|
|
0
|
|
|
#2 | |
|
Quote:
Code:
repeat with i from 1 to (number of items of theList) set theText to (theText & (item i of theList) & " |
||
|
|
0
|
|
|
#3 |
|
I have no idea, but getting the number of items in theList was no longer working. This seems to:
Code:
on run {input, parameters}
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
set theText to "
"
repeat with theName in theList
set theText to (theText & ("http://www.mynetwork.tv/vue/" & theName) & "
")
end repeat
set input to theText
return input
end run
-Lee |
|
|
|
0
|
|
|
#4 |
|
For some crazy reason, Automator doesn't like the phrase "number of items in" so use "count" instead. Also, the word "text" should be omitted from the line "make new text document" in the TextEdit block. Tweaked the TextEdit "make new document" code a bit so that if TextEdit is not active when this script is run it will not create two documents.
Code:
on run {input, parameters}
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 (count theList)
set theName to (item i of theList)
set item i of theList to ("http://www.mywebsite.com/mainfolder/" & theName)
end repeat
set theText to "
"
repeat with i from 1 to (count theList)
set theText to (theText & (item i of theList) & "
")
end repeat
tell application "TextEdit"
activate
if (front document exists) = true then
if (text of the front document) ≠ "" then
make new document
end if
else
make new document
end if
set the text of the front document to theText
end tell
return input
end run
|
|
|
|
0
|
|
|
#5 | |
|
Quote:
Thanks for giving us the solution! |
||
|
|
0
|
![]() |
|
«
Previous Thread
|
Next Thread
»
Similar Threads
|
||||
| thread | Thread Starter | Forum | Replies | Last Post |
| How to ask for variable and pass to shell script in automator? | zBernie | Mac Programming | 1 | May 2, 2014 11:58 PM |
| Automator script not running at every login? | Risco | OS X Mavericks (10.9) | 0 | Apr 21, 2014 03:03 PM |
| Apple automator script | nepentanova | MacBook Pro | 2 | Mar 6, 2014 03:06 AM |
| Need help with Apple Script/Automator | ashameer | Mac Programming | 1 | Feb 10, 2013 06:50 PM |
| Creating an Automator Script to Send Email | Jetheat | OS X | 3 | Oct 29, 2012 02:47 PM |
|
All times are GMT -5. The time now is 01:02 AM.







Linear Mode
