applescript doesn't understand the send to single message
Posted: Thu Oct 17, 2013 11:41 pm
Hi,
I created a flow using Applescript to do a simple search and replace in an html file with TextWrangler. The search and replace works fine, but the script ends in error with the message:
'"path-to-file.html" doesn't understand the send to single message'. Same error appears with alias and POSIX paths. Below is the script I've used (replace string left out):
on jobarrived( s, j )
tell application "Switch_Service"
set search_document to path of j
set jobPath to POSIX path of search_document
tell me
replaceText(search_string, replacement_text, search_document)
end tell
send to single jobPath -- neither does "send to single search_document" work
end tell
end jobarrived
on replaceText(search_string, replacement_text, this_document)
tell application "TextWrangler"
activate
open this_document opening in new_window
tell window 1
replace search_string using replacement_text options {search mode:literal, starting at top:true}
close saving yes
end tell
end tell
end replaceText
What is wrong with my script? I found only one example of a script in Applescript and there the send to functions were all "send to data"'s.
Any help appreciated,
Patrik
I created a flow using Applescript to do a simple search and replace in an html file with TextWrangler. The search and replace works fine, but the script ends in error with the message:
'"path-to-file.html" doesn't understand the send to single message'. Same error appears with alias and POSIX paths. Below is the script I've used (replace string left out):
on jobarrived( s, j )
tell application "Switch_Service"
set search_document to path of j
set jobPath to POSIX path of search_document
tell me
replaceText(search_string, replacement_text, search_document)
end tell
send to single jobPath -- neither does "send to single search_document" work
end tell
end jobarrived
on replaceText(search_string, replacement_text, this_document)
tell application "TextWrangler"
activate
open this_document opening in new_window
tell window 1
replace search_string using replacement_text options {search mode:literal, starting at top:true}
close saving yes
end tell
end tell
end replaceText
What is wrong with my script? I found only one example of a script in Applescript and there the send to functions were all "send to data"'s.
Any help appreciated,
Patrik