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: KOENIG Yvan <email@hidden>
- Date: Sat, 10 Sep 2011 15:20:45 +0200
It doesn't open the application.
It create a replicate of the document which is the exact behavior of a stationery file, exactly as a double click.
iWork applications don't behave this way.
To make them behave as stationery, we must rename them with the dedicated name extension.
It's what is achieved by the main script.
It rename the iWork documents so that the renamed ones will behave as stationery/templates and it set the stationery property for non iWork documents.
It's just annoying to have it creating a replicate when the script is just supposed to set the property when it's not already set.
When the dragged file has its stationery property set, if we drag & drop it to the script, this one receive inn fact a reference to the replicate created by the Finder.
But I repeat that this script isn't dedicated to open a file.
The goal is just to change the status of the original file.
This way, when we double click such stationary later, the it won't open but it will deliver a replicate upon which we will be able to work without any impact of AutoSave and Versions on the original.
Yvan KOENIG (VALLAURIS, France) samedi 10 septembre 2011 15:19:52
Le 10 sept. 2011 à 14:08, Axel Luttgens a écrit :
> 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