Sign in to follow this  
Followers 0
kaotkbliss

Declared variable returns a different result?

3 posts in this topic

Ok, so I've been working on this script and I've gotten to a part where the script looks for specific text in a subject line of an email, if found it is supposed to declare a variable:

$emailtext=WinGetText("Inbox - Microsoft Outlook", "")
    $reprint1=StringInStr($emailtext,"Reprint 3",0)
    If (Not $reprint1=0) Then $Recent2="Reprint3" And $job=3
    $reprint2=StringInStr($emailtext,"Reprint 2",0)
    If (Not $reprint2=0) Then $Recent2="Reprint2" And $job=2
    $reprint3=StringInStr($emailtext,"Reprint 1",0)
    If (Not $reprint3=0) Then $Recent2="Reprint" And $job=""

I have also tried:

$emailtext=WinGetText("Inbox - Microsoft Outlook", "")
    $reprint1=StringInStr($emailtext,"Reprint 3",0)
    If (Not $reprint1=0) Then $Recent2=IsString("Reprint3") And $job=3
    $reprint2=StringInStr($emailtext,"Reprint 2",0)
    If (Not $reprint2=0) Then $Recent2=IsString("Reprint2") And $job=2
    $reprint3=StringInStr($emailtext,"Reprint 1",0)
    If (Not $reprint3=0) Then $Recent2=IsString("Reprint") And $job=""

but in both cases $Recent2 is returned as "True"!

what gives?


010101000110100001101001011100110010000001101001011100110010000

001101101011110010010000001110011011010010110011100100001

My Android cat and mouse game
https://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek

We're gonna need another Timmy!

Share this post


Link to post
Share on other sites



I think this will achieve what you want.

your logic was incorrect in your code

"Reprint3" And $job=3

will always evaluate to True

$emailtext = WinGetText("Inbox - Microsoft Outlook", "")
If StringInStr($emailtext, "Reprint 3", 0) Then
    $Recent2 = "Reprint3"
    $job = 3
ElseIf StringInStr($emailtext, "Reprint 2", 0) Then
    $Recent2 = "Reprint2"
    $job = 2
ElseIf StringInStr($emailtext, "Reprint 1", 0) Then
    $Recent2 = "Reprint"
    $job = ""
EndIf

"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to build bigger and better idiots. So far, the universe is winning."- Rick Cook

Share this post


Link to post
Share on other sites

I think this will achieve what you want.

your logic was incorrect in your code

"Reprint3" And $job=3

will always evaluate to True

Ahhh, I thought And meant "as well as" in other words a way of linking multiple commands, kinda like "do this AND do that"


010101000110100001101001011100110010000001101001011100110010000

001101101011110010010000001110011011010010110011100100001

My Android cat and mouse game
https://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek

We're gonna need another Timmy!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0