• 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: Could someone try the following script run as an app
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Could someone try the following script run as an app


  • Subject: Re: Could someone try the following script run as an app
  • From: Yvan KOENIG <email@hidden>
  • Date: Mon, 07 Dec 2015 18:31:26 +0100


Le 2015/12/07 à 18:09, Yvan KOENIG <email@hidden> a écrit :


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



 _______________________________________________
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

  • Follow-Ups:
    • Re: Could someone try the following script run as an app
      • From: Deivy Petrescu <email@hidden>
References: 
 >Could someone try the following script run as an app (From: Deivy Petrescu <email@hidden>)
 >Re: Could someone try the following script run as an app (From: Yvan KOENIG <email@hidden>)

  • Prev by Date: Re: Could someone try the following script run as an app
  • Next by Date: Re: Could someone try the following script run as an app
  • Previous by thread: Re: Could someone try the following script run as an app
  • Next by thread: Re: Could someone try the following script run as an app
  • Index(es):
    • Date
    • Thread