• 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: varibles in handler
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: varibles in handler


  • Subject: Re: varibles in handler
  • From: Robert Poland <email@hidden>
  • Date: Tue, 18 Jan 2011 06:41:14 -0700

Thanks Nigel,

As I said in the followup to the original email The problem is as you said.

I needed to reread my script more carefully.


> On Jan 18, 2011, at 2:45 AM, Nigel Garvey wrote:
>
> Robert Poland wrote on Mon, 17 Jan 2011 15:17:04 -0700:
>
>> Hi,
>>
>> Since this use of a variable in a handler call apparently is not allowed,
>> why not;
>
>> global applicationName, originalDelimiters
>>
>> set AppleScript's text item delimiters to ""
>> set applicationName to "GraphicConverter.app"
>> my setDelimiters(".")
>
> Your setDelimiters() handler is this:
>
> on setDelimiters(newDelimiter)
> 	set originalDelimiters to AppleScript's text item delimiters
> 	set AppleScript's text item delimiters to newDelimiter -- parse off ".app"
> 	-- set AppleScript's text item delimiters to originalDelimiters
> end setDelimiters
>
> In the first call to it above, originalDelimiters is set to the original
> value of AppleScript's TIDs and the TIDs themselves are set to "."
>
>> set applicationName to my fixLinkToGraphicConverter(applicationName) --
>> seperate GraphicConverter6 & GraphicConverter7
>
> fixLinkToGraphicConverter() contains another call to setDelimiters()
> with a parameter value of ".". At that point, originalDelimiters gets
> set to AppleScript's current TID value (now ".") and the TIDs are again
> set to ".". Thereafter, whenever you call setDelimiters() with
> originalDelimiters as the parameter, the result's always going to be
> both the TIDs and originalDelimiters getting set to ".".
>
> NG
>
>> my setDelimiters(originalDelimiters)
>>
>> tell application "System Events"
>> 	activate
>> 	display dialog applicationName & return & "-" & AppleScript's text item
>> delimiters & "-" default button 1
>> end tell
>>
>> on setDelimiters(newDelimiter)
>> 	set originalDelimiters to AppleScript's text item delimiters
>> 	set AppleScript's text item delimiters to newDelimiter -- parse off ".app"
>> 	-- set AppleScript's text item delimiters to originalDelimiters
>> end setDelimiters
>>
>> on fixLinkToGraphicConverter(applicationName) -- seperate GraphicConverter6
>> & GraphicConverter7
>> 	my setDelimiters(".")
>> 	set applicationName to (first text item of applicationName)
>> 	my setDelimiters(originalDelimiters)
>> 	return applicationName
>> end fixLinkToGraphicConverter

Robert Poland - Fort Collins, CO



 _______________________________________________
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

References: 
 >Re: varibles in handler (From: "Nigel Garvey" <email@hidden>)

  • Prev by Date: Re: varibles in handler
  • Next by Date: Copying unicode from Excel and pasting to text file
  • Previous by thread: Re: varibles in handler
  • Next by thread: Re: varibles in handler
  • Index(es):
    • Date
    • Thread