Le 2015/12/07 à 17:58, Deivy Petrescu < email@hidden> a écrit :
and tell me what do you get?
Select some files and drop it over the applet. I am getting something very weird. I just want to know if there is something wrong with my computer or with AS. Thanks
on run open selection end run
on open selection set l to selection -- files selected display dialog (count of l) end open
Deivy Petrescu
What are you getting ?
When I drop several files icons on the droplet, I get the wanted result : the count of dropped files.
When I double click the droplet application I get an error -1712 in French it says : Délai dépassé pour un Apple Event.
From my point of view the message is not related to the real situation but it’s logical to get an error because as far as I know the script is unable to understand what is the selection in such case.
It was easy to build a code doing the job in both cases.
on run tell application "Finder" my main(selection) end tell end run
on open selection my main(selection) end open
on main(something) set l to something -- files selected display dialog (count of l) end main
Oops, I was too optimistic.
(1) when I run my script from the editor, it does the job. (2) When I save it as an application and double click it, I get the answer 1 because the selected item is the application itself. (3) I didn’t tested but I guess that if I call the script from the Scripts menu I would get the correct result (4) When I use the script as a droplet it becomes fool. If I drop 16 files on it it displays : 16. If I drop 30 files, it displays once : 28 then it issue a second dialog displaying : 2 If I drop 5 files + 1 folder, it displays : 2 then it issues a second dialog displaying : 4 If I drop 1 folder + 1 package + 4 files, it display : 2 then it issues a dialog displaying 4.
It seems that something is playing the fool somewhere.
Yvan KOENIG running El Capitan 10.11.1 in French (VALLAURIS, France) lundi 7 décembre 2015 18:31:21
|