Re: varibles in handler
Re: varibles in handler
- Subject: Re: varibles in handler
- From: "Nigel Garvey" <email@hidden>
- Date: Tue, 18 Jan 2011 09:45:08 +0000
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
_______________________________________________
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