Re: AppleScript-Users Digest, Vol 9, Issue 153
Re: AppleScript-Users Digest, Vol 9, Issue 153
- Subject: Re: AppleScript-Users Digest, Vol 9, Issue 153
- From: lin Jim <email@hidden>
- Date: Thu, 12 Apr 2012 23:09:04 -0400
LinJim
On 2012年4月12日, at 20:35, 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: frontmost application annoyance (Yuma Antoine Decaux)
> 2. Re: frontmost application annoyance (Robert Poland)
> 3. Re: frontmost application annoyance (Luther Fuller)
> 4. Announcing MailWing 4.2 (Luther Fuller)
> 5. offlist: Re: Announcing MailWing 4.2 (Alex Zavatone)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Fri, 13 Apr 2012 07:43:31 +1200
> From: Yuma Antoine Decaux <email@hidden>
> To: Luther Fuller <email@hidden>
> Cc: Applescript Users <email@hidden>
> Subject: Re: frontmost application annoyance
> Message-ID: <email@hidden>
> Content-Type: text/plain; charset="utf-8"
>
> Hi again,
>
> Actually activate is not required as the command is part of the dictionary and therefore doesn't require gui intervention.
>
> I've tried several other solutions but none works "yet".
>
> The most promising one seems to be about the visible true false on processes.
>
> Since the script annoyingly sticks to the front, i set a
>
> Set _app to name of (info for path to frontmost application)
> Tell application "System Events"
> Set visible of process _app to false
> Set _app to bundle id of path to frontmost application
> Tell process _app
> Set visible to true
> End tell
>
> --rest of script
>
> But for the life of me, visible true false doesn't work work. I get a
>
> Still looking around, i'll get to it at some point.
>
> I mean, there must have been other people trying to make a script which first identifies which application they're on, then do something with it.
>
> On 13/04/2012, at 12:22 AM, Luther Fuller <email@hidden> wrote:
>
>> On Apr 11, 2012, at 5:55 PM, Yuma Antoine Decaux wrote:
>>
>>> I've followed your recommendations but now the application opens and blocks the underlying application i wish to operate on.
>>>
>>> I've added an lsuielement boolean key to the info.plist as you suggested but the result is the one aforementioned.
>>
>> I knew there was a reason for using the word "perhaps".
>>
>> Here is another way to get the frontmost application ...
>>
>> tell application "System Events" to set frontAppl to (name of (some process whose frontmost is true)) as text
>>
>> And, perhaps there should be an 'activate' after tell application "TextEdit"
>>
>> _______________________________________________
>> 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
>
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <https://lists.apple.com/mailman/private/applescript-users/attachments/20120413/2c1ac2af/attachment.html>
>
> ------------------------------
>
> Message: 2
> Date: Thu, 12 Apr 2012 14:26:23 -0600
> From: Robert Poland <email@hidden>
> To: Yuma Antoine Decaux <email@hidden>
> Cc: Applescript Users <email@hidden>
> Subject: Re: frontmost application annoyance
> Message-ID: <email@hidden>
> Content-Type: text/plain; charset="utf-8"
>
> i found that Activate is necessary and works really well.
>
>
> On Apr 12, 2012, at 1:43 PM, Yuma Antoine Decaux wrote:
>
>> Hi again,
>>
>> Actually activate is not required as the command is part of the dictionary and therefore doesn't require gui intervention.
>>
>> I've tried several other solutions but none works "yet".
>>
>> The most promising one seems to be about the visible true false on processes.
>>
>> Since the script annoyingly sticks to the front, i set a
>>
>> Set _app to name of (info for path to frontmost application)
>> Tell application "System Events"
>> Set visible of process _app to false
>> Set _app to bundle id of path to frontmost application
>> Tell process _app
>> Set visible to true
>> End tell
>>
>> --rest of script
>>
>> But for the life of me, visible true false doesn't work work. I get a
>>
>> Still looking around, i'll get to it at some point.
>>
>> I mean, there must have been other people trying to make a script which first identifies which application they're on, then do something with it.
>>
>> On 13/04/2012, at 12:22 AM, Luther Fuller <email@hidden> wrote:
>>
>>> On Apr 11, 2012, at 5:55 PM, Yuma Antoine Decaux wrote:
>>>
>>>> I've followed your recommendations but now the application opens and blocks the underlying application i wish to operate on.
>>>>
>>>> I've added an lsuielement boolean key to the info.plist as you suggested but the result is the one aforementioned.
>>>
>>> I knew there was a reason for using the word "perhaps".
>>>
>>> Here is another way to get the frontmost application ...
>>>
>>> tell application "System Events" to set frontAppl to (name of (some process whose frontmost is true)) as text
>>>
>>> And, perhaps there should be an 'activate' after tell application "TextEdit"
>>>
>>> _______________________________________________
>>> 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
>>
>> _______________________________________________
>> 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
>
> Robert Poland - Fort Collins, CO
>
>
>
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <https://lists.apple.com/mailman/private/applescript-users/attachments/20120412/3450acf2/attachment.html>
>
> ------------------------------
>
> Message: 3
> Date: Thu, 12 Apr 2012 15:27:24 -0500
> From: Luther Fuller <email@hidden>
> To: Applescript Users <email@hidden>
> Subject: Re: frontmost application annoyance
> Message-ID: <email@hidden>
> Content-Type: text/plain; charset="utf-8"
>
> On Apr 12, 2012, at 2:43 PM, Yuma Antoine Decaux wrote:
>
>> Set _app to name of (info for path to frontmost application)
>> Tell application "System Events"
>> Set visible of process _app to false
>> Set _app to bundle id of path to frontmost application
>> Tell process _app
>> Set visible to true
>> End tell
>
> I tried your script and noticed a problem with the first line.
> Rather than explain details, I wrote this instructive script ...
>
> set _app to name of (info for (path to frontmost application)) --> "appName.app"
> log _app & return
>
> tell application "System Events" to set frontAppl to (name of (some process whose frontmost is true)) as text
> log frontAppl & return
>
> tell application "System Events"
> name of every process whose visible is true
> log the result
> end tell
>
> Notice that the first line (from your script) returns a string ending with ".app".
> But notice that the third line is a list of processes none of which end with ".app".
> Therefore, your script can't find the correct application name.
>
> Notice that the second line corrects this problem. frontAppl will be in the list returned by line three.
>
> The reason you have to do this is to identify your application in the list, then find the FORMER front application.
>
> The very best way to do this is to simply make your application invisible right from the start.
> In other words, set LSUIElement = true in your application bundle's 'Info.plist' file.
> Once you have done this manually a few times, you will give up and use Script Bundle Tool.
> (Which is what prompted me to write SBT some years ago!)
>
> In Script Bundle Tool, Edit the project and select "Show in Dock is false".
> In other words, "Change" this dialog. (The default is true) ...
>
>
>
> Now it will work.
>
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <https://lists.apple.com/mailman/private/applescript-users/attachments/20120412/3e4a56e4/attachment.html>
> -------------- next part --------------
> A non-text attachment was scrubbed...
> Name: Screen shot 2012-04-12 at 3.21.06 PM.png
> Type: image/png
> Size: 12897 bytes
> Desc: not available
> URL: <https://lists.apple.com/mailman/private/applescript-users/attachments/20120412/3e4a56e4/attachment.png>
>
> ------------------------------
>
> Message: 4
> Date: Thu, 12 Apr 2012 15:46:22 -0500
> From: Luther Fuller <email@hidden>
> To: Applescript Users <email@hidden>
> Subject: Announcing MailWing 4.2
> Message-ID: <email@hidden>
> Content-Type: text/plain; charset="utf-8"
>
> Earlier this week, I released MailWing 4.2.
> Have ever wondered what 2800 lines of plain vanilla AppleScript code can do?
> If you are curious, you can read about it (and download) here ...
>
> http://lutherfuller.com/MailWing.html
>
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <https://lists.apple.com/mailman/private/applescript-users/attachments/20120412/26b2c985/attachment.html>
>
> ------------------------------
>
> Message: 5
> Date: Thu, 12 Apr 2012 20:35:40 -0400
> From: Alex Zavatone <email@hidden>
> To: Luther Fuller <email@hidden>
> Cc: Applescript Users <email@hidden>
> Subject: offlist: Re: Announcing MailWing 4.2
> Message-ID: <email@hidden>
> Content-Type: text/plain; charset="utf-8"
>
> Congrats man
>
> On Apr 12, 2012, at 4:46 PM, Luther Fuller wrote:
>
>> Earlier this week, I released MailWing 4.2.
>> Have ever wondered what 2800 lines of plain vanilla AppleScript code can do?
>> If you are curious, you can read about it (and download) here ...
>>
>> http://lutherfuller.com/MailWing.html
>>
>> _______________________________________________
>> 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
>
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <https://lists.apple.com/mailman/private/applescript-users/attachments/20120412/234b17d8/attachment.html>
>
> ------------------------------
>
> _______________________________________________
> AppleScript-Users mailing list
> email@hidden
> https://lists.apple.com/mailman/listinfo/applescript-users
>
> End of AppleScript-Users Digest, Vol 9, Issue 153
> *************************************************
_______________________________________________
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