is possible detect if an applescript saved as application was launched by double click on it or from the script panel of indesign?
thanks for any suggestion
is possible detect if an applescript saved as application was launched by double click on it or from the script panel of indesign?
thanks for any suggestion
Hi there,
Welcome to MacScripter!
Going by a couple of scripts I’ve done in the past, it is possible to save a prefs file in the script bundle of the script application. It’s also possible to check whether a script was triggered by dropping files on it or, double-clicking it.
You’re possibly launching it from InDesign which is slightly different. I’ve not tested it but I think it should be possible.
HTH
I’m not as optimistic as TecNik. I thought something like this might work:
tell application id "com.adobe.InDesign" -- Adobe InDesign CS6.app
try
set theScript to active script
display dialog theScript as string
on error
display dialog "Running as applet"
end try
end tell
but it shows “Running as applet” either way.
Hi Shane,
Yeah, I got the same
I was using:
tell application "System Events"
-- Get App Name
set frontApp to (path to frontmost application as Unicode text)
end tell
Either way the frontmost application is the script even when the full test script was executed from the Script Menu or externally.
I did think of one solution which would be to put the main script app in the relevant InDesign folder.
This could be executed from the script menu.
Then create another script something along the lines of:
set myScript to alias "YOUR HD:Applications:Adobe InDesign CC 2014:Scripts:Scripts Panel:Samples:AppleScript::TESTER.app"
run script myScript
This would then sit on the desktop. This would give you the two ways of executing the script app.
Not sure if this is the best way round it.
Instead of putting the app in the ID Scripts folder, you could try putting an alias of the Main.scpt file that’s inside the app bundle there instead. That might make active script work.
Hhmm.
Think I tried something similar to that where I put the whole app on the desktop and an alias in the ID Scripts folder. When executed through InDesign the front most app was still the script application.
It’s almost like you want to set x to the app that triggered me in the applescript.
That’s not going to work. But I just tried making an alias to the app bundle’s /Contents/Resource/Scripts/main.scpt file, and that works fine with the sample script I posted above.
I think the best is
set x to the app that triggered me
like TecNik said
but I’ll use the alias of main.scpt in indesign script folder
thanks TecNic and Shane Stanley for your interest and help
bye
Just to say the app that triggered me isn’t AS
I know it was only a joke