Re: Weird Problem
Re: Weird Problem
- Subject: Re: Weird Problem
- From: John Stewart <email@hidden>
- Date: Thu, 05 Nov 2015 10:07:34 -0500
On 11/5/15 at 7:12 AM, email@hidden (Dave) wrote:
Ahhhhhh, would this work too:
if myValue starts with "Fish" then
(or is it begins with “Fish”).
All the Best
Dave
On 4 Nov 2015, at 09:12, Dave <email@hidden> wrote:
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
_______________________________________________
This will also work but as you can see it may give false hits
i.e. Fishing ≠ Fish but does contain it.
---------------------------------------------
set myvalue to "I'm going fishing tomorrow (I wish)."
if myvalue contains "Fish" then say myValue
---------------------------------------------
--
Naturally, the common people don't want war, but after all, it
is the leaders of a country who determine the policy, and it is
always a simple matter to drag people along whether it is a
democracy, or a fascist dictatorship, or a parliament, or a
communist dictatorship. Voice or no voice, the people can always
be brought to the bidding of the leaders. This is easy. All you
have to do is tell them they are being attacked, and denounce
the pacifists for lack of patriotism and exposing the country to
danger. It works the same in every country. -Hermann Goering
_______________________________________________
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