Copy link to clipboard
Copied
Hi all,
I got error in this script. Could anyone help on this?
tell application "Finder"
activate
set myApps to {"CS3", "CS4", "CS5"}
set selectedApp to choose from list myApps with prompt "Choose Application:" with title "Launch Application"
if the result is not false then
set myApp to "Adobe InDesign " & selectedApp
display dialog myApp
set myFile to "Applications:" & myApp & ":Scripts:Scripts Panel:Sample.jsx"
tell my application myApp
activate
run script file myFile // error "Adobe InDesign CS4 got an error: A unknown token can’t go after this “)”." number -2740
end tell
end if
end tell
Regards
Suresh
Hi,
you're right. The script does not compile. I don't know the reason, perhaps Shane reads the thread and knows the answer. Macscripter.net may be a good point for posting this.
A workaround: Create the whole ID-Tellblock as string and do a vanilla run script command.
...tell application "Finder"
activate
set myApps to {"CS3", "CS4", "CS5.5"}
set selectedApp to choose from list myApps with prompt "Choose Application:" with title "Launch Application"
if the result is not false then
Copy link to clipboard
Copied
hey suresh..
can't realy remember the last time i used applescript, but still here are my two cents:
the javascript you are trying to run has a error somwhere in it. open it in estk and try a "Check Syntax" (form the edit menu)
Copy link to clipboard
Copied
Hi Vamitul,
Thanks for your quick response. I checked the javascript in ESTK which shows no error.
Even if I write a simple javascript (an alert message), applescript throw an error in the same line.
Regards
Suresh
Copy link to clipboard
Copied
ok...
tell application "Finder"
activate
set myApps to {"CS3", "CS4", "CS5"}
set selectedApp to choose from list myApps with prompt "Choose Application:" with title "Launch Application"
if the result is not false then
set myApp to "Adobe InDesign " & selectedApp
display dialog myApp
set myFile to "Applications:" & myApp & ":Scripts:Scripts Panel:Sample.jsx"
set myScript to POSIX path of myFile
tell my application myApp
activate
run script file myScript
end tell
end if
end tell
Copy link to clipboard
Copied
Hi Vamitul,
Thanks for showing a different way to specify the path. It throw an error in same line like this.
run script file myScript // error "Adobe InDesign CS4 got an error: Can’t make some data into the expected type." number -1700 to item
Copy link to clipboard
Copied
aa.. it's do script, not run script. (just checking form the scripting guide) try:
do script alias myScript language javascript
Copy link to clipboard
Copied
Hi Vamitul,
It works fine when I edit the script like this:
tell application "Finder"
activate
set myApps to {"CS3", "CS4", "CS5"}
set selectedApp to choose from list myApps with prompt "Choose Application:" with title "Launch Application"
if the result is not false then
set myApp to "Adobe InDesign " & selectedApp
display dialog myApp
set myFile to "Applications:" & myApp & ":Scripts:Scripts Panel:Sample.jsx"
--set myScript to POSIX path of myFile
tell application "Adobe InDesign CS4"
activate
do script alias myFile language javascript
end tell
end if
end tell
But how could I run to selected Application.
Regards
Suresh
Copy link to clipboard
Copied
tell application myApp
activate
do script alias myFile language javascript
end tell
Copy link to clipboard
Copied
Hi Mark
Thanks for your reply. But it shows an error at this line
do script alias myFile language javascript
Copy link to clipboard
Copied
Hi,
you're right. The script does not compile. I don't know the reason, perhaps Shane reads the thread and knows the answer. Macscripter.net may be a good point for posting this.
A workaround: Create the whole ID-Tellblock as string and do a vanilla run script command.
tell application "Finder"
activate
set myApps to {"CS3", "CS4", "CS5.5"}
set selectedApp to choose from list myApps with prompt "Choose Application:" with title "Launch Application"
if the result is not false then
set myApp to "Adobe InDesign " & selectedApp
set myFile to "Applications:" & myApp & ":Scripts:Scripts Panel:Sample.jsx"
end if
end tell
set myString to "tell application " & "\"" & myApp & "\"" & return ¬
& "do script alias " & "\"" & myFile & "\"" & " language javascript" & return ¬
& "end tell"
run script myString
It runs here.
Copy link to clipboard
Copied
Hi hans
Thankyou. This works fine for me.
Thanks for everyone those who given me your suggestion.
Regards
Suresh