• 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: Weird problem with a script?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Weird problem with a script?


  • Subject: Re: Weird problem with a script?
  • From: Yvan KOENIG <email@hidden>
  • Date: Tue, 15 Mar 2016 16:22:09 +0100


Le 15 mars 2016 à 16:12, Yvan KOENIG <email@hidden> a écrit :

A detail is puzzling me.


on getWordCustomDocumentPropertyWithDocumentID:(theDocumentID as string) andPropertyName:(thePropertyName as string)
--say "getWordCustomDocumentPropertyWithDocumentID:"

set myDocument to my getWordDocumentWithDocumentID:theDocumentID

tell application id "com.microsoft.Word"
set myValue to the value of (custom document properties of myDocument whose name is thePropertyName)
end tell

if myValue is not equal to missing value then
return myValue # here we don't know which class is myValue
end if

get my makeNewWordCustomDocumentPropertyWithDocumentID:(theDocumentID) andPropertyName:(thePropertyName) andPropertyValue:("*DEFAULT*")

tell application id "com.microsoft.Word"
set myValue to the value of (custom document properties of myDocument whose name is thePropertyName)
end tell

return myValue as string # here you "carefully" coerce myValue to a string
end getWordCustomDocumentPropertyWithDocumentID:andPropertyName:



Is the different treatment deliberate or is it an omission ?

You wrote that using 
if myValue starts with "HIGH"
solves the problem. It's certainly right but it explain nothing. Look at these three cases.

set myValue to "HIGH" & return
myValue starts with "HIGH" --> true

set myValue to "HIGH" & space
myValue starts with "HIGH" --> true

set myValue to {"HIGH", "LOW"}
myValue starts with "HIGH" --> true

If you don't really identify what is wrong, you will face the problem again.


Yvan KOENIG running El Capitan 10.11.3 in French (VALLAURIS, France) mardi 15 mars 2016 16:12:30




 _______________________________________________
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: Weird problem with a script? (From: Nigel Garvey <email@hidden>)
 >Re: Weird problem with a script? (From: Dave <email@hidden>)

  • Prev by Date: Re: Weird problem with a script?
  • Next by Date: Script Editor Crashing.....
  • Previous by thread: Re: Weird problem with a script?
  • Next by thread: Re: Weird problem with a script?
  • Index(es):
    • Date
    • Thread