• 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
Weird Problem
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Weird Problem


  • Subject: Weird Problem
  • From: Dave <email@hidden>
  • Date: Wed, 04 Nov 2015 09:12:12 +0000

Hi,

Please see the Script below, for some very strange reason the:

		if myValue = "Fish" then

isn’t working, so it always runs the else statement.

Any ideas?

All the Best
Dave

--------------------------------------------------------------------------------------------------------------------------------------------------------------------

on getWordStandardDocumentProperty(theDocument, thePropertyName)
	tell application id "com.microsoft.Word"
		set myValue to the value of (document properties of theDocument whose name is thePropertyName)

		return myValue
	end tell
end getWordStandardDocumentProperty



on setWordStandardDocumentProperty(theDocument, thePropertyName, thePropertyValue)
	tell application id "com.microsoft.Word"
		set the value of (document properties of theDocument whose name is thePropertyName) to thePropertyValue
	end tell
end setWordStandardDocumentProperty


on run
	tell application id "com.microsoft.Word"
		activate

		set myDocument to the document of the front window

		--
		--	Test Standard Document Properties
		--
		set myValue to my getWordStandardDocumentProperty(myDocument, "Keywords")
		if myValue = "Fish" then
			beep 1
			set myValue to "Chips"
		else
			set myValue to "Fish"
		end if

		my setWordStandardDocumentProperty(myDocument, "Keywords", myValue)
	end tell

	return myValue
end run
 _______________________________________________
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


  • Follow-Ups:
    • Re: Weird Problem
      • From: Dave <email@hidden>
  • Prev by Date: Re: Word - How to Access Custom Document Properties
  • Next by Date: Re: Standard Doc Properties in Word and PowerPoint 2011
  • Previous by thread: Re: Standard Doc Properties in Word and PowerPoint 2011
  • Next by thread: Re: Weird Problem
  • Index(es):
    • Date
    • Thread