send sendtext and press

General Macro Scheduler discussion

Moderators: Dorian (MJT support), JRL

Post Reply
NancyM
Pro Scripter
Posts: 66
Joined: Mon Jul 18, 2016 7:01 pm

send sendtext and press

Post by NancyM » Wed Jul 27, 2016 1:52 pm

I'm having an odd thing happen when I send this code:

SRT>Clear
SetFocus>CurWindow
Press>CTRL
Wait>.5
SendText>a
Wait>.5
Release>CTRL
Wait>.5
Press>BACKSPACE
Wait>.5
END>Clear

It does what it is supposed to do, clears the value out of the field by selecting everything ctl-a then pressing backspace. But it is sending something else too and making me nuts. I hear a "ding" from the UI like there's an erroneous character that isn't allowed in that field. I can replicate it by hitting enter in that field.

Debugging is really tough because it doesn't work at all in debug mode. I guess focus doesn't automatically switch back after each command.

So any suggestions?

Also, is there any difference between send and sendtext? The manual seemed to indicate they're the same, but I just want to doublecheck. Maybe just coincidence but it seems like they're different, I couldn't tell you how though.

User avatar
JRL
Automation Wizard
Posts: 3497
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Re: send sendtext and press

Post by JRL » Wed Jul 27, 2016 2:12 pm

I use this trick all the time. Add a message box before you start the area of code you want to check then use SetControlText> to put data in the message box. The reason to use SetControlText> is that it does not steal focus like popping up a new message will do. Also set the coordinates of the message so it will display on screen someplace out of the way.

As an idea for how to debug your issue I put in two second waits after each step. You will see the code line number display in the message box. This way you'll know which line of code causes the "ding".

Send> and SendText> call the same function.

Code: Select all

Let>Msg_Xpos=10
Let>Msg_Ypos=10
Let>msg_Width=400
Message>

GoSub>Clear

SRT>Clear
  SetFocus>CurWindow
  Press>CTRL
  SetControlText>Macro Scheduler Message,TMemo,1,_line_num
  Wait>2
  SendText>a
  SetControlText>Macro Scheduler Message,TMemo,1,_line_num
  Wait>2
  Release>CTRL
  SetControlText>Macro Scheduler Message,TMemo,1,_line_num
  Wait>2
  Press>BACKSPACE
  SetControlText>Macro Scheduler Message,TMemo,1,_line_num
  Wait>2
END>Clear

NancyM
Pro Scripter
Posts: 66
Joined: Mon Jul 18, 2016 7:01 pm

Re: send sendtext and press

Post by NancyM » Fri Jul 29, 2016 2:08 pm

Sweet! Great tip, thanks!

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts