Author Topic: Text compare inside text compare not working  (Read 1558 times)

Malic

  • Full Member
  • ***
  • Posts: 102
Text compare inside text compare not working
« on: September 24, 2018, 01:33:59 AM »
I am trying to put a series of text compare inside a text compare, and it refuses to work, the portion in bold is what I am having an issue with

I have also tried to reverse it by switching "Does Not Equal" with "Equal" and either way will not function, it just skips over the entire section.

It is supposed to detect if the variable "Body" has something, if it is empty, use the format where it does not include Body, and if there is something, use text format with "Body" in it and then paste to the target program and hit enter automagicly.

The "Lat" section under it works fine, but the first part does not.


Quote
Begin Text Compare : [MyPrefix] Equals 'Location'
    Begin Text Compare : [Body] Does Not Equal ''
        Set Windows clipboard to '{TXT:NavClipboard}'
    Else If Text Compare : [Body] Equals ''
        Set Windows clipboard to '{TXT:NavClipboard} {TXT:Body}'
    End Condition

    Press Left Ctrl+V keys and hold for 0.05 seconds and release
    Press Enter key and hold for 0.05 seconds and release
    Begin Text Compare : [Lat] Does Not Equal ''
        Set Windows clipboard to 'Lat: [ {TXT:Lat} ]  - Long: [ {TXT:Long} ]'
        Press Left Ctrl+V keys and hold for 0.05 seconds and release
        Press Enter key and hold for 0.05 seconds and release
    End Condition
End Condition

TheThingIs

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 278
    • HCS Voicepacks
Re: Text compare inside text compare not working
« Reply #1 on: September 24, 2018, 02:20:03 AM »
It's a funny quirk with text conditions I've had discussions with Gary about previously...the following should work:

Begin Text Compare : [Body] Does Not Equal 'Not set'

as in check for the literal words "Not set"
The Singularity profile - One profile to rule them all and at HCS we bound them ;)

You see, TheThingIs, eventually you'll be allright.

Malic

  • Full Member
  • ***
  • Posts: 102
Re: Text compare inside text compare not working
« Reply #2 on: September 24, 2018, 02:52:53 AM »
That did not work either, I ended up doing the following:


Quote
    Begin Boolean Compare : [Body] Has Not Been Set
        Set Windows clipboard to '{TXT:NavClipboard}'
    Else If Boolean Compare : [Body] Has Been Set
        Set Windows clipboard to '{TXT:NavClipboard} {TXT:Body}'
    End Condition

Gary

  • Administrator
  • Hero Member
  • *****
  • Posts: 2827
Re: Text compare inside text compare not working
« Reply #3 on: September 24, 2018, 07:25:41 AM »
I know you've solved your situation, but, just in case you need to change it back for some reason:


If text variable, 'Body' is NOT set (null), and you don't have the, 'Evaluate Not Set as Blank' option selected, neither of these will return true: 


Begin Text Compare : [Body] Does Not Equal ''

Else If Text Compare : [Body] Equals ''

Because Body is null, and null is a state and is not comparable to literal strings.

You'll want to turn on 'Evaluate Not Set as Blank' or change the 'else if' line to just an, 'Else' statement (I *think* that would cover it)

-OR- Your condition could look like this (to be more clear):

If Body Is Set AND Body does not equal ''
    do stuff
else
   do other stuff
end if

Again, you can do it that way if you can't or don't want to turn on, 'Evaluate Not Set as Blank'.


Also, the literal value of 'Not Set' is only rendered if you are using a token.  It could have easily just said, 'NULL', but I wanted to make it a little bit friendlier for the non-programmer-y folks.

Hope that helps!