Re: Why is this script 'openin' stationery files.
Re: Why is this script 'openin' stationery files.
- Subject: Re: Why is this script 'openin' stationery files.
- From: Axel Luttgens <email@hidden>
- Date: Sat, 10 Sep 2011 14:08:00 +0200
Le 10 sept. 2011 à 09:36, KOENIG Yvan a écrit :
> [...]
>
> When I drag and drop on it the icon of a file which is already a stationery, the script 'opens' this one and create a new document.
Hello Yvan,
Do you mean that in the case of a stationery file, dropping it on your applet launches/opens the corresponding application and that a copy of the file is opened within that application?
> And I don't understand which instruction is doing that. It doesn't do that when I trigger the script by a double click using Choose file to select the file.
>
> I guess that it's linked to the structure 'droplet' because I get the same behavior with the bare :
>
> on open sel
> --
> end open
So, I tried here (Lion) with above skeletal code (saved as "yvan.app").
Dropping a stationery file say, a Pages document named "test.pages", on the droplet has following effects:
- a copy of the stationary, named "test copie.pages", is created at the same location
- the droplet launches
- argument "sel" receives a list of a single alias referencing the copy
- the droplet quits
So, this is similar to double-clicking the stationery's icon in the Finder:
- a copy of the stationary, named "test copie.pages", is created at the same location
- Pages is launched and opens a window displaying the contents of "test copie.pages"
(I forgot how much stationaries became different with Mac OS X...)
This seems to happen at the Finder's level, so that the droplet won't get any chance to receive a reference to the original file (the stationary) nor to avoid the creation of the duplicate file.(*)
Note that both of those commands will act upon the original file (the stationery), without duplication:
/usr/bin/open -a Pages /path/to/test.pages
/usr/bin/open -a yvan /path/to/test.pages
HTH,
Axel
(*) The same way the Finder resolves a dropped alias file before passing the reference to the droplet's open handler.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden