Alienchild Posted July 2, 2014 Report Share Posted July 2, 2014 Hi All, I am trying to hold my left mouse button down and drag if a condition is met. The below code causes the Editor to complain about Syntax Errors: If Variable %xVal% Is Greater Than "100" Mouse Left Button Down Mouse Move: %xx%, %yy% Relative to Screen End If Notice that the editor indents the "End If" , so clearly it is getting confused. What, if anything am I doing incorrectly and how do I implement a mouse drag if a condition is met, without producing a syntax error? (Here is the actual code as requested) <IF VARIABLE Variable="%xVal%" Condition="\x03" Value="100" IgnoreCase="FALSE"/> <MOUSE LEFT BUTTON DOWN/> <MOUSE MOVE Option="\x01" X="%xx%" Y="%yy%" _PROMPT="0x000A"/> <END IF/> Quote Link to comment Share on other sites More sharing options...
Cory Posted July 2, 2014 Report Share Posted July 2, 2014 Can you post the command code. IE not the display text. Note there is a code box option in this forum. Quote Link to comment Share on other sites More sharing options...
Alienchild Posted July 2, 2014 Author Report Share Posted July 2, 2014 Sorry, no idea how to make code box work, but here is the relevant code <IF VARIABLE Variable="%xVal%" Condition="\x03" Value="100" IgnoreCase="FALSE"/><MOUSE LEFT BUTTON DOWN/><MOUSE MOVE Option="\x01" X="%xx%" Y="%yy%" _PROMPT="0x000A"/><END IF/> Quote Link to comment Share on other sites More sharing options...
joe Posted July 2, 2014 Report Share Posted July 2, 2014 If Variable %xVal% Is Greater Than "100" Mouse Left Button Down Mouse Move: %xx%, %yy% Relative to Screen Mouse Left Button Up End If Add the Mouse Left Button Up line. Quote Link to comment Share on other sites More sharing options...
Alienchild Posted July 2, 2014 Author Report Share Posted July 2, 2014 If Variable %xVal% Is Greater Than "100" Mouse Left Button Down Mouse Move: %xx%, %yy% Relative to Screen Mouse Left Button Up End If Add the Mouse Left Button Up line. That defeats the whole purpose of the drag because if I use the "Mouse button up" and I am still on the same area of the screen it, then counts as a mouse click which has a completely different action associated with it. Edit: Having said that I will try it out and see - perhaps I can do multiple drags, each with its own mouse down and mouse up, without them been considered mouse clicks by the application - I will let you guys know. Quote Link to comment Share on other sites More sharing options...
joe Posted July 2, 2014 Report Share Posted July 2, 2014 Within MXPro, the Button Down / Button Up commands are a code structure same as the If / End If and the Repeat / End Repeat structures. You will receive the same syntax error message when any part of any code structure is missing. Quote Link to comment Share on other sites More sharing options...
Alienchild Posted July 2, 2014 Author Report Share Posted July 2, 2014 Within MXPro, the Button Down / Button Up commands are a code structure same as the If / End If and the Repeat / End Repeat structures. You will receive the same syntax error message when any part of any code structure is missing. Yes it does seem so. It is irritating as a mousedown should not have an enforced mouseup. I might have perfectly good reasons for never releasing a mouse button and it shouldn't be up to the language to try enforce how I use my mouse! As it stands now, I have to release the mouse button within the same block of code - or suffer Syntax error warnings. Not happy. In any case it does not effect the logic and the program runs perfectly ok , just every time I save it I get warned about the syntax error. I know I can disable the warning but want to keep it for a "real" syntax error! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.