Re: AppleScript-Users Digest, Vol 16, Issue 93
Re: AppleScript-Users Digest, Vol 16, Issue 93
- Subject: Re: AppleScript-Users Digest, Vol 16, Issue 93
- From: Kellen Ruyle via AppleScript-Users <email@hidden>
- Date: Thu, 12 Sep 2019 17:30:12 -0500
Hi Yvan,
I am running Mojave (10.14.6). I have added Script Editor to allow Full Disk
Access, Accessibility and Automation in Security Preference. Anything I am
missing as far as security? I run the script but same handler issue. I noticed
that when I run the script the editor highlights what is causing the error. Not
sure if that has something to do with it - it seems to be with “sort (get every
document file of the front Finder window) by physical size”. I copied and
pasted the code and underlined what Script Editor highlighted. Thanks for your
help Yvan and L. Lee. I appreciate the help.
Kind regards,
Kel
tell application "Finder"
#generate a list of reference sorted by size
set these_items to sort (get every document file ¬
of the front Finder window) by physical size
#generate a list of names
set these_names to {}
repeat with i from 1 to the count of these_items
set the end of these_names to ¬
the name of (item i of these_items)
end repeat
end tell
#convert the list of names to a paragraph-delimited text block
set AppleScript's text item delimiters to return
set the item_list to these_names as string
set AppleScript's text item delimiters to {""}
#make a new document with the text
tell application "TextEdit"
activate
make new document
set text of document 1 to the item_list
end tell
Sent from my iPhone
> On Sep 12, 2019, at 2:00 PM, email@hidden wrote:
>
> Send AppleScript-Users mailing list submissions to
> email@hidden
>
> To subscribe or unsubscribe via the World Wide Web, visit
> https://lists.apple.com/mailman/listinfo/applescript-users
> or, via email, send a message with subject or body 'help' to
> email@hidden
>
> You can reach the person managing the list at
> email@hidden
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of AppleScript-Users digest..."
>
>
> Today's Topics:
>
> 1. Re: General question about InDesign applescript (Shane Stanley)
> 2. Re: General question about InDesign applescript (Shane Stanley)
> 3. Help with Find and Do with Multiple Applications (Kellen Ruyle)
> 4. Re: Help with Find and Do with Multiple Applications (Yvan KOENIG)
> 5. Re: Help with Find and Do with Multiple Applications (AT&T)
> 6. Re: Help with Find and Do with Multiple Applications
> (Kellen Ruyle)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Thu, 12 Sep 2019 10:55:22 +1000
> From: Shane Stanley <email@hidden>
> To: AS users <email@hidden>
> Subject: Re: General question about InDesign applescript
> Message-ID: <email@hidden>
> Content-Type: text/plain; charset=utf-8
>
>> On 11 Sep 2019, at 11:22 pm, Bert Groeneveld via AppleScript-Users
>> <email@hidden> wrote:
>>
>> In the last two situations I get a beachball after 10 seconds.
>>
>> Normally I save my scripts as .scptd, but that doesn?t seem to work as
>> mentioned.
>>
>> Does anyone have any idea?
>
> Not a lot. I can say, though, that I have scripts that run happily from
> InDesign's Script panel, both .scpt and .scptd. They're not large, so size
> might be an issue. This is with InDesign CC 2019 (v14.0.3). I presume you've
> quit and restarted InDesign.
>
> --
> Shane Stanley <email@hidden>
> <www.macosxautomation.com/applescript/apps/>, <latenightsw.com>
>
>
>
>
> ------------------------------
>
> Message: 2
> Date: Thu, 12 Sep 2019 10:56:53 +1000
> From: Shane Stanley <email@hidden>
> To: AS users <email@hidden>
> Subject: Re: General question about InDesign applescript
> Message-ID: <email@hidden>
> Content-Type: text/plain; charset=us-ascii
>
>> On 12 Sep 2019, at 12:33 am, A.C. Wighman via AppleScript-Users
>> <email@hidden> wrote:
>>
>> Chief among these is the requirement that any application attempting to
>> communicate with another application must get the user's permission.
>
> Unless Bert's script is also talking to other applications apart from
> InDesign, that's not an issue for him.
>
> --
> Shane Stanley <email@hidden>
> <www.macosxautomation.com/applescript/apps/>, <latenightsw.com>
>
>
>
>
> ------------------------------
>
> Message: 3
> Date: Wed, 11 Sep 2019 22:56:19 -0500
> From: Kellen Ruyle <email@hidden>
> To: email@hidden
> Subject: Help with Find and Do with Multiple Applications
> Message-ID: <email@hidden>
> Content-Type: text/plain; charset=utf-8
>
> Hi! I am new to AppleScript and have been going through AppleScript 1-2-3 by
> Sal Soghoian and Bill Cheeseman. It?s great and I am learning a lot.
>
> I am working through a script but it seems to give me an error ?Finder got an
> error; AppleEvent handler failed.?number-10000
>
> I am trying to generate a list of the names of the image files displayed in
> the frontmost Finder window, sorted by their file size, and then creating a
> new document in TextEdit containing the list of names. I can attach
> screenshot if need be. I have copied and pasted the code below. Any help
> would be great thanks!
>
> tell application "Finder"
> -- generate a list of file references sorted by size
> set these_items to sort (get every document file ?
> of the front Finder window) by physical size
> -- generate a list of names
> set these_names to {}
> repeat with i from 1 to the count of these_items
> set the end of these_names to ?
> the name of (item i of these_items)
> end repeat
> end tell
> -- convert the list of names to a paragraph-delimited text block
> set AppleScript's text item delimiters to return
> set the item_list to these_names as string
> set AppleScript's text item delimiters to {""}
> -- make a new document with the text
> tell application "TextEdit"
> activate
> make new document
> set text of document 1 to the item_list
> end tell
>
> I greatly appreciate it!
>
> Regards,
> Kel
>
> Sent from my iPhone
>
>
>
>
>
> ------------------------------
>
> Message: 4
> Date: Thu, 12 Sep 2019 10:40:26 +0200
> From: Yvan KOENIG <email@hidden>
> To: liste AppleScript US <email@hidden>
> Subject: Re: Help with Find and Do with Multiple Applications
> Message-ID: <email@hidden>
> Content-Type: text/plain; charset="utf-8"
>
> Hello
>
> Which system are you running?
>
> Here, under 10.13.6 your script behaves flawlessly.
>
> I just got an error when I tried to apply it to the Desktop itself but it's
> normal because it's not a "Finder Window".
> After asking the Finder to create a new window with the Desktop, it worked.
>
> Just for the pleasure, I made some cosmetic changes :
>
>
> tell application "Finder"
> -- generate a list of file references sorted by size
> set these_items to sort (get every document file ?
> of the front Finder window) by physical size
> -- generate a list of names
> set these_names to {}
> repeat with anItem in these_items
> set end of these_names to name of anItem
> end repeat
> end tell
> -- convert the list of names to a paragraph-delimited text block
> set oldTID to AppleScript's text item delimiters # save the original
> delimiters
> set AppleScript's text item delimiters to {return} # define the new one
> set item_list to these_names as string
> set AppleScript's text item delimiters to oldTID # reset the original
> delimiters
>
> -- make a new document with the text
> tell application "TextEdit"
> activate
> make new document
> set text of document 1 to item_list
> end tell
>
> Yvan KOENIG running High Sierra 10.13.6 in French (VALLAURIS, France) jeudi
> 12 septembre 2019 10:39:56
>
>
>
>
>
>> Le 12 sept. 2019 ? 05:56, Kellen Ruyle via AppleScript-Users
>> <email@hidden> a ?crit :
>>
>> Hi! I am new to AppleScript and have been going through AppleScript 1-2-3 by
>> Sal Soghoian and Bill Cheeseman. It?s great and I am learning a lot.
>>
>> I am working through a script but it seems to give me an error ?Finder got
>> an error; AppleEvent handler failed.?number-10000
>>
>> I am trying to generate a list of the names of the image files displayed in
>> the frontmost Finder window, sorted by their file size, and then creating a
>> new document in TextEdit containing the list of names. I can attach
>> screenshot if need be. I have copied and pasted the code below. Any help
>> would be great thanks!
>>
>> tell application "Finder"
>> -- generate a list of file references sorted by size
>> set these_items to sort (get every document file ?
>> of the front Finder window) by physical size
>> -- generate a list of names
>> set these_names to {}
>> repeat with i from 1 to the count of these_items
>> set the end of these_names to ?
>> the name of (item i of these_items)
>> end repeat
>> end tell
>> -- convert the list of names to a paragraph-delimited text block
>> set AppleScript's text item delimiters to return
>> set the item_list to these_names as string
>> set AppleScript's text item delimiters to {""}
>> -- make a new document with the text
>> tell application "TextEdit"
>> activate
>> make new document
>> set text of document 1 to the item_list
>> end tell
>>
>> I greatly appreciate it!
>>
>> Regards,
>> Kel
>
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL:
> <https://lists.apple.com/mailman/private/applescript-users/attachments/20190912/99e2d51a/attachment.html>
>
> ------------------------------
>
> Message: 5
> Date: Thu, 12 Sep 2019 09:01:08 -0500
> From: AT&T <email@hidden>
> To: Applescript-users list <email@hidden>
> Cc: Kellen Ruyle <email@hidden>
> Subject: Re: Help with Find and Do with Multiple Applications
> Message-ID: <email@hidden>
> Content-Type: text/plain; charset=utf-8
>
> When I see ?handler? in errors these days, I first wonder about those
> inconvenient sandbox rules in Mojave. Are you using Mojave (10.14) or a beta
> for Catalina? If running in Script editor you might need to add the Script
> Editor app to the Accessibility and Full Disk Access areas of the Security &
> Privacy prefpane. If you create AppleScript applications, you have to add
> each.
>
> L. Lee
>
>> On Sep 11, 2019, at 10:56 PM, Kellen Ruyle via AppleScript-Users
>> <email@hidden> wrote:
>>
>> Hi! I am new to AppleScript and have been going through AppleScript 1-2-3 by
>> Sal Soghoian and Bill Cheeseman. It?s great and I am learning a lot.
>>
>> I am working through a script but it seems to give me an error ?Finder got
>> an error; AppleEvent handler failed.?number-10000
>>
>> I am trying to generate a list of the names of the image files displayed in
>> the frontmost Finder window, sorted by their file size, and then creating a
>> new document in TextEdit containing the list of names. I can attach
>> screenshot if need be. I have copied and pasted the code below. Any help
>> would be great thanks!
>>
>> tell application "Finder"
>> -- generate a list of file references sorted by size
>> set these_items to sort (get every document file ?
>> of the front Finder window) by physical size
>> -- generate a list of names
>> set these_names to {}
>> repeat with i from 1 to the count of these_items
>> set the end of these_names to ?
>> the name of (item i of these_items)
>> end repeat
>> end tell
>> -- convert the list of names to a paragraph-delimited text block
>> set AppleScript's text item delimiters to return
>> set the item_list to these_names as string
>> set AppleScript's text item delimiters to {""}
>> -- make a new document with the text
>> tell application "TextEdit"
>> activate
>> make new document
>> set text of document 1 to the item_list
>> end tell
>>
>> I greatly appreciate it!
>>
>> Regards,
>> Kel
>>
>> Sent from my iPhone
>>
>>
>>
>> _______________________________________________
>> 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
>
>
>
> ------------------------------
>
> Message: 6
> Date: Thu, 12 Sep 2019 09:22:40 -0500
> From: Kellen Ruyle <email@hidden>
> To: AT&T <email@hidden>
> Cc: Applescript-users list <email@hidden>
> Subject: Re: Help with Find and Do with Multiple Applications
> Message-ID: <email@hidden>
> Content-Type: text/plain; charset=utf-8
>
> Hi L. Lee,
> Yes, I am using Mojave(10.14). Great, I will try to add the Script Editor to
> the Accessibility and Full Disk Access areas of the Security & Privacy
> prefpane and see if that does the trick. Thanks so much for your help.
>
> Kel
>
> Sent from my iPhone
>
>> On Sep 12, 2019, at 9:01 AM, AT&T <email@hidden> wrote:
>>
>> When I see ?handler? in errors these days, I first wonder about those
>> inconvenient sandbox rules in Mojave. Are you using Mojave (10.14) or a beta
>> for Catalina? If running in Script editor you might need to add the Script
>> Editor app to the Accessibility and Full Disk Access areas of the Security &
>> Privacy prefpane. If you create AppleScript applications, you have to add
>> each.
>>
>> L. Lee
>>
>>> On Sep 11, 2019, at 10:56 PM, Kellen Ruyle via AppleScript-Users
>>> <email@hidden> wrote:
>>>
>>> Hi! I am new to AppleScript and have been going through AppleScript 1-2-3
>>> by Sal Soghoian and Bill Cheeseman. It?s great and I am learning a lot.
>>>
>>> I am working through a script but it seems to give me an error ?Finder got
>>> an error; AppleEvent handler failed.?number-10000
>>>
>>> I am trying to generate a list of the names of the image files displayed in
>>> the frontmost Finder window, sorted by their file size, and then creating a
>>> new document in TextEdit containing the list of names. I can attach
>>> screenshot if need be. I have copied and pasted the code below. Any help
>>> would be great thanks!
>>>
>>> tell application "Finder"
>>> -- generate a list of file references sorted by size
>>> set these_items to sort (get every document file ?
>>> of the front Finder window) by physical size
>>> -- generate a list of names
>>> set these_names to {}
>>> repeat with i from 1 to the count of these_items
>>> set the end of these_names to ?
>>> the name of (item i of these_items)
>>> end repeat
>>> end tell
>>> -- convert the list of names to a paragraph-delimited text block
>>> set AppleScript's text item delimiters to return
>>> set the item_list to these_names as string
>>> set AppleScript's text item delimiters to {""}
>>> -- make a new document with the text
>>> tell application "TextEdit"
>>> activate
>>> make new document
>>> set text of document 1 to the item_list
>>> end tell
>>>
>>> I greatly appreciate it!
>>>
>>> Regards,
>>> Kel
>>>
>>> Sent from my iPhone
>>>
>>>
>>>
>>> _______________________________________________
>>> 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
>
>
>
> ------------------------------
>
> Subject: Digest Footer
>
> _______________________________________________
> AppleScript-Users mailing list
> email@hidden
> https://lists.apple.com/mailman/listinfo/applescript-users
>
>
> ------------------------------
>
> End of AppleScript-Users Digest, Vol 16, Issue 93
> *************************************************
_______________________________________________
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