• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

How to run an applescript through terminal

Guest
Oct 29, 2012 Oct 29, 2012

Copy link to clipboard

Copied

Hi Friends,

I have a indesign script done in AppleScripting.

I want to run this in a terminal window. Any ideas what is the correct syntax of running an apple-script through a terminal window.

I tried using the below sample script in terminal by using osascript. (Not sure if this is the correct representation)

osascript script_name.scpt.

But, it returns an error (shown as below)

2012-10-30 11:34:43.667 osascript[2388:903] Error loading /Library/ScriptingAdditions/Adobe Unit Types.osax/Contents/MacOS/Adobe Unit Types:  dlopen(/Library/ScriptingAdditions/Adobe Unit Types.osax/Contents/MacOS/Adobe Unit Types, 262): no suitable image found.  Did find:

          /Library/ScriptingAdditions/Adobe Unit Types.osax/Contents/MacOS/Adobe Unit Types: no matching architecture in universal wrapper

osascript: OpenScripting.framework - scripting addition "/Library/ScriptingAdditions/Adobe Unit Types.osax" declares no loadable handlers.

2012-10-30 11:34:43.669 osascript[2388:903] Error loading /Library/ScriptingAdditions/QXPScriptingAdditions.osax/Contents/MacOS/QXPScript ingAdditions:  dlopen(/Library/ScriptingAdditions/QXPScriptingAdditions.osax/Contents/MacOS/QX PScriptingAdditions, 262): no suitable image found.  Did find:

          /Library/ScriptingAdditions/QXPScriptingAdditions.osax/Contents/MacOS/QXPS criptingAdditions: mach-o, but wrong architecture

osascript: OpenScripting.framework - scripting addition "/Library/ScriptingAdditions/QXPScriptingAdditions.osax" declares no loadable handlers.

script_name.scpt: execution error: No user interaction allowed. (-1713)

Thanks for your help!

Regards,

Abhishek

TOPICS
Scripting

Views

2.4K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Oct 30, 2012 Oct 30, 2012

Copy link to clipboard

Copied

Hi,

try to run your script from a starterScript:

--comment: guess my source is been macscripter here; don't know anymore ...

--don't change anything in this script !!

on run {sourcefile}

    tell application "AppleScript Runner"

        do script sourcefile

    end tell

end run

save as app

execute your script with this terminalCommand:

osascript pathToRunnerscript pathToYourscript

Hope it'll work

Hans-Gerd Claßen

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Oct 30, 2012 Oct 30, 2012

Copy link to clipboard

Copied

Hi,

Thanks for your response..I will check it.

On a slighter note, please can you let me know what is a starterScript and what does the below script actually does..

I am new to apple scripting and it will help me to understand the concepts.

--comment: guess my source is been macscripter here; don't know anymore ...

--don't change anything in this script !!

on run {sourcefile}

tell application "AppleScript Runner"

do script sourcefile

end tell end run

Thanks for your help!

Thanks,

Abhishek

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Oct 30, 2012 Oct 30, 2012

Copy link to clipboard

Copied

Hi,

I don't know why you want to run AS via Terminal, perhaps it is not necessary ... keep this in mind.

the 'starterScript' simply runs your Script via APP 'AppleSript Runner'.

'command osascript + the starterScript +  your script as input for the starterscript'

I guess you've got a display dialog outside of tellblock, which causes the Error. osascript can't target a process for this.

Another approach could be to save your script as app and run it in Terminal via 'open pathToYourScript'

Hans-Gerd Claßen

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Oct 30, 2012 Oct 30, 2012

Copy link to clipboard

Copied

LATEST

Thanks for your note.

It is helpful.

Abhishek

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines