• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Can't tell an application to open
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Can't tell an application to open


  • Subject: Re: Can't tell an application to open
  • From: Andreas Kiel <email@hidden>
  • Date: Wed, 09 Mar 2011 12:27:16 +0100

Hi,

Sorry I hadn't been clear enough as I wrote the reply in a rush - as always.
The code I included hasn't been commented as it should have been.


I my case the "PhotoShop" script is one script of many others which are included within one app. During launch time the app does "scan" the system for app IDs available and will enable/disable features.
So if (in my case) the '8BIM' code is not found, the script path is not loaded and a feature of the app is disabled because the path to the app is empty.
In case it is found the the script will be loaded.


The second thing is : why use the the shell script?
Again in my case: even the AS examples which do come with the original PS installation didn't work when I tried to open a file with the PS Apple scripting. So I do force to open the file with PS (if available) upfront and then running the script.
The good thing about the shell script is that you can offer alternatives. Here I don't have TextWrangler but I do have BBEdit which is some kind of extended version of TextWrangler. Using that route you can change the code snippet to:
-- code
tell application "Finder"
set appPath to POSIX path of (application file id "XXXX" as Unicode text) as string
if appPath = ""
set appPath to POSIX path of (application file id "YYYY" as Unicode text) as string
end
-- and so on
end
-- code
The XXXX, YYYY is the app's code


You also can run a repeat loop with several app codes which returns the the appPath(s).
Then do create a handler somehow like: set theScript to load someScript(?) -- dependent on the appPath


In the script use the shell script
--
do shell script "open -a " & quoted form of appPath & space & quoted form of filePath -- file path is a posix path


tell theScript
-- do something
set theResult to the result
end
--

Hope this helps to make things a bit clearer.

Andreas

On 09.03.2011, at 00:01, Shane Stanley wrote:

Try this instead:

tell application id "com.adobe.Photoshop"
-- do stuff

--
Shane Stanley <email@hidden>
'AppleScriptObjC Explored' <www.macosxautomation.com/applescript/ apps/>



_______________________________________________
Do not post admin requests to the list. They will be ignored.
applescriptobjc-dev mailing list (applescriptobjc- email@hidden)
Help/Unsubscribe/Update your Subscription:
40spherico.com


This email sent to email@hidden

_______________________________________________ Do not post admin requests to the list. They will be ignored. applescriptobjc-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
References: 
 >Re: Can't tell an application to open (From: Shane Stanley <email@hidden>)

  • Prev by Date: Re: Can't tell an application to open
  • Next by Date: xCode 4.0
  • Previous by thread: Re: Can't tell an application to open
  • Next by thread: xCode 4.0
  • Index(es):
    • Date
    • Thread