• 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: AppleScript-Users Digest, Vol 9, Issue 166
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: AppleScript-Users Digest, Vol 9, Issue 166


  • Subject: Re: AppleScript-Users Digest, Vol 9, Issue 166
  • From: lin Jim <email@hidden>
  • Date: Wed, 18 Apr 2012 11:00:08 -0400


LinJim

On Apr 17, 2012, at 4:11 AM, 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: AppleScript-Users Digest, Vol 9, Issue 161 (Jon Pugh)
>   2. Run Handler-Name from Text? (Christopher Stone)
>   3. Re: Run Handler-Name from Text? (Tom Robinson)
>   4. Re: Run Handler-Name from Text? (Shane Stanley)
>   5. Re: Run Handler-Name from Text? (Christopher Stone)
>   6. Re: Run Handler-Name from Text? (Christopher Stone)
>   7. Re: Run Handler-Name from Text? (Shane Stanley)
>   8. Re: Run Handler-Name from Text? (栗田 哲郎)
>   9. Re: Run Handler-Name from Text? (Thomas Fischer)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Mon, 16 Apr 2012 18:45:09 -0700
> From: Jon Pugh <email@hidden>
> To: Martin Orpen <email@hidden>
> Cc: AppleScript <email@hidden>
> Subject: Re: AppleScript-Users Digest, Vol 9, Issue 161
> Message-ID: <email@hidden>
> Content-Type: text/plain; charset=utf-8
>
> On Apr 16, 2012, at 11:34 AM, Martin Orpen wrote:
>> On 16 Apr 2012, at 15:58, Jon Pugh wrote:
>>
>>> There must be something inadvertently malicious on his machine which is sending his messages immediately.  I have no idea what that could be though.
>>
>>
>> Doubt that the machine has anything malicious on it:
>>
>>    X-Mailer: iPhone Mail (9B179)
>>
>> He's probably out jogging or trying to use Siri…
>>
>> :-)
>
> Ooo, I got some text added onto the subject line today:
>
>> Re: AppleScript-Users Digest, Vol 9, Issue 161。My network is limited, in addition to theme, were all official filter.  Help
>
> So now it’s cryptic in addition to mysterious.  ;)
>
> Ah, it seems I also got a couple of encrypted files with “bugXXX.pem” names attached to new emails.
>
> I’m inclined to agree with Martin, it appears to be iPhone flailing.
>
> Jon
>
>
>
>
> ------------------------------
>
> Message: 2
> Date: Mon, 16 Apr 2012 21:24:14 -0500
> From: Christopher Stone <email@hidden>
> To: Applescript Users List <email@hidden>
> Subject: Run Handler-Name from Text?
> Message-ID: <email@hidden>
> Content-Type: text/plain; charset="utf-8"
>
> Hey Folks,
>
> I'm trying to build a lookup table with criteria and associated handler-names.
>
> From this table I want to lookup a specific criterion/handler, return the handler-name, and execute the handler.
>
> set lookUpTable to "
> myCriterion          myHandlerName()
> "
>
> The handler-name returns as text, and I can't seem to find a way to get that to execute.
>
> Is there a way to do this?
>
> Thank you.
>
> --
> Best Regards,
> Chris
>
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <https://lists.apple.com/mailman/private/applescript-users/attachments/20120416/58753d88/attachment.html>
>
> ------------------------------
>
> Message: 3
> Date: Tue, 17 Apr 2012 14:38:04 +1200
> From: Tom Robinson <email@hidden>
> To: Applescript Users List <email@hidden>
> Subject: Re: Run Handler-Name from Text?
> Message-ID: <email@hidden>
> Content-Type: text/plain; charset="utf-8"
>
> You should be able to do it with 'run script':
>
> set a to "display dialog \"Hello\""
> run script a
>
>
> On 2012-04-17, at 14:24, Christopher Stone wrote:
>
>> Hey Folks,
>>
>> I'm trying to build a lookup table with criteria and associated handler-names.
>>
>> From this table I want to lookup a specific criterion/handler, return the handler-name, and execute the handler.
>>
>> set lookUpTable to "
>> myCriterion          myHandlerName()
>> "
>>
>> The handler-name returns as text, and I can't seem to find a way to get that to execute.
>>
>> Is there a way to do this?
>>
>> Thank you.
>>
>> --
>> Best Regards,
>> Chris
>
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <https://lists.apple.com/mailman/private/applescript-users/attachments/20120417/792e80dc/attachment.html>
>
> ------------------------------
>
> Message: 4
> Date: Tue, 17 Apr 2012 12:46:22 +1000
> From: Shane Stanley <email@hidden>
> To: Christopher Stone <email@hidden>
> Cc: Applescript Users List <email@hidden>
> Subject: Re: Run Handler-Name from Text?
> Message-ID: <email@hidden>
> Content-Type: text/plain; charset=us-ascii
>
> On 17/04/2012, at 12:24 PM, Christopher Stone wrote:
>
>> I'm trying to build a lookup table with criteria and associated handler-names.
>>
>> From this table I want to lookup a specific criterion/handler, return the handler-name, and execute the handler.
>>
>> set lookUpTable to "
>> myCriterion          myHandlerName()
>> "
>>
>> The handler-name returns as text, and I can't seem to find a way to get that to execute.
>>
>> Is there a way to do this?
>
> I'd be very, very surprised if there were.
>
> Seems an odd way of doing things, though. Why not nested calls?
>
> on doSomething(x)
> if x ="myCriterion" then
> myHandlerName()
> ...
>
> --
> Shane Stanley <email@hidden>
> 'AppleScriptObjC Explored' <www.macosxautomation.com/applescript/apps/>
>
>
>
>
> ------------------------------
>
> Message: 5
> Date: Mon, 16 Apr 2012 21:53:48 -0500
> From: Christopher Stone <email@hidden>
> To: Applescript Users List <email@hidden>
> Subject: Re: Run Handler-Name from Text?
> Message-ID: <email@hidden>
> Content-Type: text/plain; charset="utf-8"
>
> On Apr 16, 2012, at 21:38, Tom Robinson wrote:
>> You should be able to do it with 'run script':
> ______________________________________________________________________
>
> Hey Tom,
>
> I've tried a number of variations of 'run script'.
>
> Given this:
>
> ------------------------------------------------------------------------------------------------
> on myHandlerNameB()
>    return "Eureka!  It works."
> end myHandlerNameB
>
> set lookUpTable to "
> myCriterionA          myHandlerNameA()
> myCriterionB          myHandlerNameB()
> myCriterionC          myHandlerNameC()
> "
>
> set handlerToRun to do shell script "sed -nE 's/^myCriterionB +(.+)/\\1/p' <<< " & quoted form of lookUpTable
> ------------------------------------------------------------------------------------------------
>
> Please demonstrate how to successfully make 'run script' use handlerToRun as a parameter.
>
> Thank you.
>
> --
> Best Regards,
> Chris
>
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <https://lists.apple.com/mailman/private/applescript-users/attachments/20120416/0c4c02d8/attachment.html>
>
> ------------------------------
>
> Message: 6
> Date: Mon, 16 Apr 2012 21:58:32 -0500
> From: Christopher Stone <email@hidden>
> To: Applescript Users List <email@hidden>
> Subject: Re: Run Handler-Name from Text?
> Message-ID: <email@hidden>
> Content-Type: text/plain; charset=us-ascii
>
> On Apr 16, 2012, at 21:46, Shane Stanley wrote:
>> On 17/04/2012, at 12:24 PM, Christopher Stone wrote:
>>> Is there a way to do this?
>>
>> I'd be very, very surprised if there were.
>>
>> Seems an odd way of doing things, though. Why not nested calls?
>
> ______________________________________________________________________
>
> Hey Shane,
>
> I currently have a very large nested if-structure, and I'm wanting something easier to read, sort, and maintain.
>
> --
> Chris
>
>
>
>
> ------------------------------
>
> Message: 7
> Date: Tue, 17 Apr 2012 13:14:27 +1000
> From: Shane Stanley <email@hidden>
> To: Christopher Stone <email@hidden>
> Cc: Applescript Users List <email@hidden>
> Subject: Re: Run Handler-Name from Text?
> Message-ID: <email@hidden>
> Content-Type: text/plain; charset=us-ascii
>
> On 17/04/2012, at 12:58 PM, Christopher Stone wrote:
>
>> I currently have a very large nested if-structure, and I'm wanting something easier to read, sort, and maintain.
>
> It must be long to bother dragging the overhead of sed et al into play!
>
> I doubt that you'll get anything text based, but for a handler named myHandlerName(), AS treats the variable myHandlerName as the handler. So you could do something index-based like:
>
> set x to {myHandlerName, myHandlerName2, ...}
> run script (item n of x)
>
> --
> Shane Stanley <email@hidden>
> 'AppleScriptObjC Explored' <www.macosxautomation.com/applescript/apps/>
>
>
>
>
> ------------------------------
>
> Message: 8
> Date: Tue, 17 Apr 2012 16:20:47 +0900
> From: 栗田 哲郎 <email@hidden>
> To: Christopher Stone <email@hidden>
> Cc: Applescript Users List <email@hidden>
> Subject: Re: Run Handler-Name from Text?
> Message-ID: <email@hidden>
> Content-Type: text/plain; charset=us-ascii
>
> I have some useful modules for your purpose.
>
>> I'm trying to build a lookup table with criteria and associated handler-names.
>>
>
> For loopup table, XDict is useful.
>
> http://www.script-factory.net/XModules/XDict/en/index.html
>
>> The handler-name returns as text, and I can't seem to find a way to get that to execute.
>>
>
> For executing a handler specified with a text, XHandler can help you.
>
> http://www.script-factory.net/XModules/XHandler/en/index.html
>
> =======================================================
> Tetsuro KURITA
>  E-mail: email@hidden
>  http://www.script-factory.net
> =======================================================
>
>
>
> ------------------------------
>
> Message: 9
> Date: Tue, 17 Apr 2012 10:10:56 +0200
> From: Thomas Fischer <email@hidden>
> To: Applescript Users List <email@hidden>
> Subject: Re: Run Handler-Name from Text?
> Message-ID: <email@hidden>
> Content-Type: text/plain; charset="utf-8"
>
> Hi Christopher,
>
> I don't know if this helps at all but you can do something like this:
>
> set handlerRecord to {myCriterionA:myHandlerNameA, myCriterionB:myHandlerNameB, myCriterionC:myHandlerNameC}
>
> set myHandler to myCriterionB of handlerRecord
> run script myHandler
>
> script myHandlerNameA
>    return "Eureka! A works."
> end script
>
> script myHandlerNameB
>    return "Eureka! B works."
> end script
>
> script myHandlerNameC
>    return "Eureka!  C works."
> end script
>
> Unfortunately, in this situation you can't use a variable with value "myCriterionB", and you can't use quotes in the record's values.
> Probably someone can come up with something better.
>
> Best
> Thomas
>
>
> Am 17.04.2012 um 04:53 schrieb Christopher Stone:
>
>> On Apr 16, 2012, at 21:38, Tom Robinson wrote:
>>> You should be able to do it with 'run script':
>> ______________________________________________________________________
>>
>> Hey Tom,
>>
>> I've tried a number of variations of 'run script'.
>>
>> Given this:
>>
>> ------------------------------------------------------------------------------------------------
>> on myHandlerNameB()
>>    return "Eureka!  It works."
>> end myHandlerNameB
>>
>> set lookUpTable to "
>> myCriterionA          myHandlerNameA()
>> myCriterionB          myHandlerNameB()
>> myCriterionC          myHandlerNameC()
>> "
>>
>> set handlerToRun to do shell script "sed -nE 's/^myCriterionB +(.+)/\\1/p' <<< " & quoted form of lookUpTable
>> ------------------------------------------------------------------------------------------------
>>
>> Please demonstrate how to successfully make 'run script' use handlerToRun as a parameter.
>>
>> Thank you.
>>
>> --
>> Best Regards,
>> Chris
>>
>
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <https://lists.apple.com/mailman/private/applescript-users/attachments/20120417/11763030/attachment.html>
>
> ------------------------------
>
> _______________________________________________
> AppleScript-Users mailing list
> email@hidden
> https://lists.apple.com/mailman/listinfo/applescript-users
>
> End of AppleScript-Users Digest, Vol 9, Issue 166
> *************************************************

 _______________________________________________
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


  • Prev by Date: Re: deciphering TextCommand match info record
  • Next by Date: Re: Run Handler-Name from Text?
  • Previous by thread: Re: [ANN]Scripting Helper App
  • Next by thread: maths
  • Index(es):
    • Date
    • Thread