Re: Weird problem with a script?
Re: Weird problem with a script?
- Subject: Re: Weird problem with a script?
- From: Nigel Garvey <email@hidden>
- Date: Mon, 14 Mar 2016 19:44:44 +0000
Dave wrote on Mon, 14 Mar 2016 13:39:07 +0000:
>Hi All,
>
>I fixed it by changes the test to:
>
>if myCustomValue is equal to "HIGH" then
>
>to if myCustomValue is starts with "HIGH" then
>
>and that fixed it!
It would be more convincing as a fix if you understood why that fixed it.
The symptoms described in your previous post suggest that the code in
the getWordCustomDocumentPropertyWithDocumentID handler, which you
didn't post, may contain a 'repeat with someVariable in someList' repeat
and that the handler's returning the value of the loop variable. If so,
the value won't actually be "LOW" or "HIGH", but a reference something
like 'item 1 of {"LOW", "HIGH"}'. In most tests — such as logging,
seeing what it starts with, etc. — this will behave as it was one of the
strings. But a test to see if it _is_ one of the strings will always
return 'false' because it's actually a reference to a position in a
list. If this is the case, returning the 'contents' of the reference
will return the string you want.
The other possibility, given your fix, is that the handler does return a
string but that this ends with white space of some description.
NG
_______________________________________________
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