rblue
New Member
Posts: 4
|
Post by rblue on Feb 14, 2020 5:17:31 GMT
I'm having problems understanding what's going wrong here.
I have the following macro, of which target can be something like an editor such as note pad:
1 | 1400 | 916 | 100 | Left Click Down 2 | X | X | 172 | Left Click Release 3 | X | X | 1000 | Keypress 1: 4 | X | X | 1000 | Keypress enter 5 | X | X | 234 | RUN ACTION | DEFINE INTEGER VARIABLE | %INTEGER1% | %RANDOM_1-10% 6 | X | X | 1000 | Keypress 2: 7 | X | X | 1000 | Keypress enter 8 | X | X | 300 | Keypress 3: some val %INTEGER1% 9 | X | X | 1000 | Keypress enter 10 | X | X | 2000 | IF | INTEGER VARIABLE | %INTEGER1% | GREATER THAN | 2 | Keypress 4: It works! 11 | X | X | 342 | Keypress 5: 12 | X | X | 342 | Keypress enter
It produces this output:
1: N2: 3: some val 0 5:
With the Error message: 10 | X | X | 2000 | IF | INTEGER VARIABLE | %INTEGER1% | GREATER THAN | 2 | Keypress 4: It works! - Action value not readable, incorrect entry
So a few questions here: 1. Where is the "N" coming from on line 2 of the output? From what I can tell it's being generated by the assignment of the integer variable?
2. Why isn't the integer variable being assigned any values? On line three it's showing a value of 0 which indicates it was never initialized.
3. I do not understand that error message since it matches the examples of an IF statement comparing a variable to a number. What is wrong with it?
Thanks greatly for any help you can provide!
RBlue
|
|
|
Post by Steve on Feb 14, 2020 5:27:19 GMT
Hi RBlue, It looks like your syntax was incorrect. This is the correct syntax: 1 | 1400 | 916 | 100 | Left Click Down 2 | X | X | 172 | Left Click Release 3 | X | X | 1000 | Keypress 1: 4 | X | X | 1000 | Keypress enter 5 | RUN ACTION | DEFINE INTEGER VARIABLE | %INTEGER1%::%RANDOM_1-10% 6 | X | X | 1000 | Keypress 2: 7 | X | X | 1000 | Keypress enter 8 | X | X | 300 | Keypress 3: some val %INTEGER1% 9 | X | X | 1000 | Keypress enter 10 | IF | INTEGER VARIABLE | %INTEGER1% | GREATER THAN | 2 | Keypress | 4: It works! 11 | X | X | 342 | Keypress 5: 12 | X | X | 342 | Keypress enter Check out this forum or www.turnssoft.com/conditions.html for help with syntax. This post here shows how using the 'add condition' tool can help with syntax. Regards, Steve.
|
|
rblue
New Member
Posts: 4
|
Post by rblue on Feb 14, 2020 7:36:28 GMT
Oh yes! I see it now! Thanks!! Unfortunately the example does not really show that the "RUN ACTION" replaces the mouse x & Y and the duration. But yes, this makes it so clear for sure! I tried it with your changes, and it is now assigning a value to %INTEGER1%. Awesome! I did look at the contions.html and it was under "Working with random numbers" that showed this syntax: RUN ACTION | DEFINE INTEGER VARIABLE | %INTEGER1% | %RANDOM% Of which, I'm guessing, it should have been: RUN ACTION | DEFINE INTEGER VARIABLE | %INTEGER1%::%RANDOM% But there is still an issue. When that value is greater than 2, such as 7, the "4: It Works!" never prints. It's generating another error message indicating that "Condition action is not valid. This condition action is not found in the ACTION list of valid actions: Keypress" 10 | IF | INTEGER VARIABLE | %INTEGER1% | GREATER THAN | 2 | Keypress | 4: It works! Also tried, which didn't work either: 10 | IF | INTEGER VARIABLE | %INTEGER1% | GREATER THAN | 2 | RUN ACTION | Keypress | 4: It works! 10 | IF | INTEGER VARIABLE | %INTEGER1% | GREATER THAN | 2 | 4: It works! Is there another way to enable Keypress or a different way to achieve the same output results? I tried the add condition option as you suggested, and I did not see thing to enable the Keypress. Thanks!! RBlue
|
|
rblue
New Member
Posts: 4
|
Post by rblue on Feb 14, 2020 7:42:36 GMT
Ok, I played around a little more with this and I got it to work with a "goto". oof... lol 1 | 1400 | 916 | 100 | Left Click Down 2 | X | X | 172 | Left Click Release 3 | X | X | 1000 | Keypress 1: 4 | X | X | 1000 | Keypress enter 5 | RUN ACTION | DEFINE INTEGER VARIABLE | %INTEGER1%::%RANDOM_1-10% 6 | X | X | 1000 | Keypress 2: 7 | X | X | 1000 | Keypress enter 8 | X | X | 300 | Keypress 3: some val %INTEGER1% 9 | X | X | 1000 | Keypress enter 10 | IF | INTEGER VARIABLE | %INTEGER1% | LESS THAN EQUAL TO | 2 | GOTO MACRO LINE | 13 11 | X | X | 1000 | Keypress 4: It worked! 12 | X | X | 1000 | Keypress enter 13 | X | X | 342 | Keypress 5: 14 | X | X | 342 | Keypress enter
With the following results:
1: 2: 3: some val 5 4: It worked! 5: So I think at this point, I have a much better understanding of the syntax, and also the benefit of using the add condition option too. Also I have the working example that I can now integrate in to the main macro.
Thanks so much for your help! RBlue
|
|
|
Post by Steve on Feb 14, 2020 22:27:27 GMT
I did look at the conditions.html and it was under "Working with random numbers" that showed this syntax: RUN ACTION | DEFINE INTEGER VARIABLE | %INTEGER1% | %RANDOM% Of which, I'm guessing, it should have been: RUN ACTION | DEFINE INTEGER VARIABLE | %INTEGER1%::%RANDOM% Thank you. Yes you are right, the syntax on that needs to be updated on the conditions page. I'll do that now. But there is still an issue. When that value is greater than 2, such as 7, the "4: It Works!" never prints. It's generating another error message indicating that "Condition action is not valid. This condition action is not found in the ACTION list of valid actions: Keypress" 10 | IF | INTEGER VARIABLE | %INTEGER1% | GREATER THAN | 2 | Keypress | 4: It works! This syntax is fine and works as expected. Are you running version 7.3? The KEYPRESS action was released with update 7.3. If you are running line 10 as I have it above it will work with version 7.3.
Glad you got this working and cheers for the pick up on the conditions page.
|
|
rblue
New Member
Posts: 4
|
Post by rblue on Feb 15, 2020 5:45:14 GMT
Glad to have been able to return the favor on the helps. BTW... I just did update to v7.3.0.0 from v7.2.0.0. Thanks for the reminder on that. I honestly should have done that first just to confirm there was still an issue, but I really had the macro messed up such that updates would not have saved me much. Still, both techniques are good to know how to use: A simple inline one, or a multi lined approach. Thanks again!
|
|