Forcing 'open' to return a value in Cocoa apps
Forcing 'open' to return a value in Cocoa apps
- Subject: Forcing 'open' to return a value in Cocoa apps
- From: Brennan <email@hidden>
- Date: Sat, 11 Mar 2006 15:54:54 +0100
Hi there,
I have long been annoyed and frustrated that the 'open' command used with
QuickTime Player no longer returns a value (since it became a cocoa app).
i.e.: this fails:
set myMov to choose file
tell application "QuickTime Player"
set m to (open myMov)
return m
end tell
My own workaround was to assume that 'movie 1' was the same as 'm' (in
this case), which is really not a reliable heuristic (if 'open' fails
silently, for example, your script might end up doing something bad).
However, I have just heard from one of the QuickTime engineers who
provided this much better workaround:
set myMov to choose file
tell application "QuickTime Player"
QuickTime Version -- e.g. app-specific terminology
set m to (open myMov)
return m
end tell
In other words, if you use a piece of terminology exclusive to that app,
all the terminology gets forced to load in good time, and 'open' then does
the right thing.
Given that what I thought was a QuickTime bug is actually a Cocoa
scripting bug, I had a go with TextEdit, which has the same bug, but
unfortunately the workaround is not available apparently because AFAICT
TextEdit has no terminology beyond the absolute basics that any scriptable
Cocoa app automagically has by default.
I am posting here in case anyone else has been frustrated by this issue
with QuickTime Player or any other Cocoa apps. (-And also to ask if anyone
can find a piece of TextEdit terminology which will take the place of
'QuickTime Version' and make us all happy until the hopefully-inevitable
fix).
--
Brennan Young
If you're not part of the solution, you're part of the precipitate.
-Steven Wright
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden