Technical support and scripting issues
Moderators: Dorian (MJT support), JRL
-
gchichester
- Pro Scripter
- Posts: 132
- Joined: Mon Dec 22, 2008 4:56 pm
- Location: St Augustine FL
Post
by gchichester » Wed Feb 24, 2016 8:44 pm
I'm trying to determine if one of the following commands "GetWindowHandle", "FindObject" or "ObjectSendText" would cause the preceding "Send>" commands to append the data in the field instead of overwriting it?
Code: Select all
//------------------------------------------------------------------------------------------
GetWindowHandle>Export Manager - [E0HSEG: House/Master Common Information],hWndParent
FindObject>hWndParent,ThunderRT6TextBox,,57,hWnd,X1,Y1,X2,Y2,result
ObjectSendText>hWnd,%RefNum%
Wait>sw
//------------------------------------------------------------------------------------------
Press Tab *6
Send>%SLCode%
Wait>sw
Press Tab *2
Send>%DDate%
Wait>sw
Press Tab *2
Send>%varLoadPort%
Wait>sw
Press Tab
Send>%varUnLoadPort%
Wait>sw
CapsOff
Press Tab *2
Send>%VName%
Wait>sw
Thank you in advance for all your help
Gil
-
JRL
- Automation Wizard
- Posts: 3526
- Joined: Mon Jan 10, 2005 6:22 pm
- Location: Iowa
Post
by JRL » Thu Feb 25, 2016 2:20 pm
If there is existing text in a field, tabbing to the field sometimes highlights the existing text and sometimes does not highlight the existing text. In my experience that is a choice made by the author of the program you're automating. If you're experiencing that the "GetWindowHandle", "FindObject" or "ObjectSendText" functions are causing the field to not have highlighted existing text when you tab to a field and that the text would be highlighted without those functions, that's something I've never seen before and would not expect. Weird!
In any case try adding these four lines after the "Press Tab" and ahead of the Send> that is causing your grief. They should highlight any unhighlighted existing text. If the text is highlighted, Send> should replace the text rather than appending to it.
Press Home
Press Shift
Press end
Release Shift
-
gchichester
- Pro Scripter
- Posts: 132
- Joined: Mon Dec 22, 2008 4:56 pm
- Location: St Augustine FL
Post
by gchichester » Thu Feb 25, 2016 6:59 pm
Yes I thought it was weird as well.
Do you think the use of WIN_USEHANDLE would have any weird effects?
Should It be used whenever the GetWindowHandle is used?
Thank you in advance for all your help
Gil
-
JRL
- Automation Wizard
- Posts: 3526
- Joined: Mon Jan 10, 2005 6:22 pm
- Location: Iowa
Post
by JRL » Thu Feb 25, 2016 7:15 pm
I've never noticed odd effects from WIN_USEHANDLE and I use it often. You don't need it turned on (set to 1) when using GetWindowHandle> but you will need it turned on much of the time to use the resultant variable that contains the window handle acquired by GetWindowHandle>. I try to make it a habit to set WIN_USEHANDLE back to 0 (zero) as soon as the few lines that need it are complete. I do that simply to prevent problems and make problem resolution easier. Really irritating finding out your 2000 line script fails on line 1679 because you changed the default value of a system variable on line 312. Sometimes hard to track down.
To answer the question in your subject line. I believe the major difference between Send> and ObjectSendText> is that ObjectSendText> does not require that the field being filled is focused or even visible. Send> requires both. Also ObjectSendText> adds text by programmatically altering the targeted object's properties more like SetControlText> does. In contrast, Send> behaves more like a keyboard sending one character at a time to the target field.
-
gchichester
- Pro Scripter
- Posts: 132
- Joined: Mon Dec 22, 2008 4:56 pm
- Location: St Augustine FL
Post
by gchichester » Thu Feb 25, 2016 7:55 pm
So if I set WIN_USEHANDLE=0 then it needs to be reset to WIN_USEHANDLE=1 In order to use the resultanting variable.
Right?
Thank you in advance for all your help
Gil
-
JRL
- Automation Wizard
- Posts: 3526
- Joined: Mon Jan 10, 2005 6:22 pm
- Location: Iowa
Post
by JRL » Thu Feb 25, 2016 9:56 pm
The default value for WIN_USEHANDLE is zero. In order to use a window handle with functions such as MoveWindow>, ResizeWindow, WaitWindowClosed, etc. WIN_USEHANDLE must be set to one. If WIN_USEHANDLE is set to zero, window names must be used in applicable window functions. If WIN_USEHANDLE is set to one window handles must be used in those functions.
Hope that helps.
-
gchichester
- Pro Scripter
- Posts: 132
- Joined: Mon Dec 22, 2008 4:56 pm
- Location: St Augustine FL
Post
by gchichester » Fri Feb 26, 2016 1:59 pm
Yes that does help.
Thanks
Thank you in advance for all your help
Gil