Author Topic: Question about why a {EXP} doesn't work.  (Read 3971 times)

iceblast

  • Sr. Member
  • ****
  • Posts: 372
Question about why a {EXP} doesn't work.
« on: December 11, 2016, 02:00:49 AM »
I'm trying to check if 1 of 2 different keys are being held down.

{EXP:({STATE_RIGHTMOUSEBUTTON} + {STATE_LEFTMOUSEBUTTON})}

Or

{EXP:({STATE_KEYSTATE:SHIFT} + {STATE_KEYSTATE:CTRL})}

Just as examples...

I figure the answer to either would be 0, 1, or 2.

If the answer is 0, then the command would continue, and if not, it would stop.

I tried to log the answer, when there was one. It was something like {EXP:(0 + 0)}, Sorry, didn't think to write down at the time.

My question, what am I doing wrong. I want to be able to add two tokens to get a answer. I can do it other ways, but this would be faster. Is it possible to do it this way?, if so, what am I doing wrong....

Thanks for any help you can give.

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4747
  • RTFM
Re: Question about why a {EXP} doesn't work.
« Reply #1 on: December 11, 2016, 03:35:12 AM »
Which version of VoiceAttack are you running? Can you post the exact command you're using?

I tried your examples, they work fine in v1.6.1.4, returning 0,1, or 2, depending on how many keys/buttons are pressed.

iceblast

  • Sr. Member
  • ****
  • Posts: 372
Re: Question about why a {EXP} doesn't work.
« Reply #2 on: December 11, 2016, 04:47:22 AM »
1.6.1.5 with the new append to file feature.

It doesn't make any since. It works fine now. I tried for like 2 hours to get that to work, and nothing. You tell me it works fine, and it works fine. You some kind of magician?!?!

Not only that, I worked on it yesterday as well. Doesn't make any since.

Here's the working command:

Multimedia Home key is the trigger for the command.

Code: [Select]
Set Text [Volume] to [C:\Program Files (x86)\VoiceAttack Beta\Apps\Volume.txt] (save value to profile)
Begin Text Compare : [{STATE_KEYSTATE:CTRL}] Equals '1'
    Set integer [Volume] to [Volume] plus 2
    Set system audio volume to [{INT:Volume}]
    Say, 'Volume Level is {STATE_SYSVOL}'
    Write (overwrite), '{INT:Volume}' to file 'C:\Program Files (x86)\VoiceAttack Beta\Apps\Volume.txt'
End Condition - Exit when condition met
Begin Text Compare : [{STATE_KEYSTATE:SHIFT}] Equals '1'
    Set integer [Volume] to [Volume] minus 2
    Set system audio volume to [{INT:Volume}]
    Say, 'Volume Level is {STATE_SYSVOL}'
    Write (overwrite), '{INT:Volume}' to file 'C:\Program Files (x86)\VoiceAttack Beta\Apps\Volume.txt'
End Condition - Exit when condition met
Begin Text Compare : [{EXP:({STATE_KEYSTATE:SHIFT} + {STATE_KEYSTATE:CTRL})}] Equals '0'
    Set integer [Volume] value to 20
    Set system audio volume to [{INT:Volume}]
    Write '[Blue] {INT:Volume}' to log
    Write (overwrite), '{INT:Volume}' to file 'C:\Program Files (x86)\VoiceAttack Beta\Apps\Volume.txt'
End Condition

No idea why this is working now. I didn't change anything, I didn't even close and restart VA. It was giving me that weird {EXP:(0 + 0)} before. I sure hope it keeps working. That command is much easier then my work around. I'm going to have to go back to some other commands now, and update them.

This is a real head scratcher..... For two days it didn't work, you says it works, and so it does. Magic I tell you! It has to be!



Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4747
  • RTFM
Re: Question about why a {EXP} doesn't work.
« Reply #3 on: December 11, 2016, 04:55:34 AM »


I can't explain it either, honestly. I don't see anything wrong with the syntax, the only change you could make is to remove the parentheses as they're not required(not even for multiple operations, if you respect the mathematical order of operations).