Jump to content

AutoIT not working on remote machine


Go to solution Solved by vm2007,

Recommended Posts

Hi All,

This is my first post. I am using Autoit for automation of our website. The script I have works fine if i run it on my machine and i have the same setup on a different machine which i access using Remote Desktop Connection. The script works fine on RDC only till the time i keep the RDC session maximized. If i minimize the window, the script runs but it does not do anything. Please help me.

1st Script that i was using. This works on my machine.

WinWaitActive("[CLASS:ViewsTextfieldEdit]","","15")
 Send("vm2007{TAB}")
 Send("abcdef{Enter}")
 
after reading the posts on forum i changed it to:
 
WinWait("[CLASS:ViewsTextfieldEdit]","","20")
ControlSend("", "", "[CLASS:ViewsTextfieldEdit; INSTANCE:2]", "vm2007{TAB}")
ControlSend("", "", "[CLASS:ViewsTextfieldEdit; INSTANCE:1]", "abcdef{Enter}")
 
The second one works even if i focus on something else on my primary machine but i need to keep the RDC session maximized. If i minimize it then it fails.
 
I read something about ControlID but do not know how to use it in my 2nd script. Can that solve the problem?
 

 

Link to comment
Share on other sites

Link to comment
Share on other sites

Yes i access the machine (Win XP) using mstsc only.....the 2nd script works as long as the RDP window is maximized...i can even work on other applications on my main machine (I use 2 monitors and i can work on applications on 2nd monitor). So focus i guess is not the problem but if i minimize the RDP window then autoit fails to execute the steps i have mentioned.

Is the script i mentioned correct? or do i need to enter some other parameters to it?

Edited by vm2007
Link to comment
Share on other sites

please clarify: when you run the script on the remote machine over RDC, you mean:

1) the script is running on your machine and interacts with the RDC window

       or

2) the script is running on the remote machine

which scenario is it?

Edited by orbs

Signature - my forum contributions:

Spoiler

UDF:

LFN - support for long file names (over 260 characters)

InputImpose - impose valid characters in an input control

TimeConvert - convert UTC to/from local time and/or reformat the string representation

AMF - accept multiple files from Windows Explorer context menu

DateDuration -  literal description of the difference between given dates

Apps:

Touch - set the "modified" timestamp of a file to current time

Show For Files - tray menu to show/hide files extensions, hidden & system files, and selection checkboxes

SPDiff - Single-Pane Text Diff

 

Link to comment
Share on other sites

The script is running on the remote machine.....I only use 'mstsc' for starting the execution which again i do on remote machine only and then I simply monitor it.

There is nothing related to the setup on my main machine.

Link to comment
Share on other sites

ok, so you're one step in the right direction.

how about this: when the script reaches a point in which the dialog window is expected to be active, but may be not active if you minimize the RDC window, put some reasonable Sleep() and then try to force it by WinActivate().

another option: add the title/text of the dialog window to the ControlSend()

Signature - my forum contributions:

Spoiler

UDF:

LFN - support for long file names (over 260 characters)

InputImpose - impose valid characters in an input control

TimeConvert - convert UTC to/from local time and/or reformat the string representation

AMF - accept multiple files from Windows Explorer context menu

DateDuration -  literal description of the difference between given dates

Apps:

Touch - set the "modified" timestamp of a file to current time

Show For Files - tray menu to show/hide files extensions, hidden & system files, and selection checkboxes

SPDiff - Single-Pane Text Diff

 

Link to comment
Share on other sites

ok, so you're one step in the right direction.

how about this: when the script reaches a point in which the dialog window is expected to be active, but may be not active if you minimize the RDC window, put some reasonable Sleep() and then try to force it by WinActivate().

another option: add the title/text of the dialog window to the ControlSend()

 

Sounds good to me...will come back after trying it out to let you know whether it worked or not. Thanks.

Link to comment
Share on other sites

Without being able to test the specifics it seems like using direct control manip. vs. send keys is the way to go.  Not sure why is doesn't work.  Perhaps adding some debug checks to see where in the process fails will lead you to a solution.  Are you running the script compiled or in SCITE (just a matter of outputing to a file instead of ConsoleWrite)?   A mystery this is...

Edited by spudw2k
Link to comment
Share on other sites

I tried the suggestions but it did not work. I have modified the script to this now:

WinWait("[CLASS:ViewsTextfieldEdit]","","20")
WinActivate("[CLASS:Chrome_WidgetWin_1]", "")
ControlSend("[CLASS:ViewsTextfieldEdit]", "", "[CLASS:ViewsTextfieldEdit; INSTANCE:2]", "vm2007{TAB}")
ControlSend("[CLASS:ViewsTextfieldEdit]", "", "[CLASS:ViewsTextfieldEdit; INSTANCE:1]", "abcdef{Enter}")
 
But this does not work at all. The previous version at least used to work when RDP was in focus and maximized.
 
The details of the window using Tool are like this
*******************************************
>>>> Window <<<<
Title: TestPage3456 - Google Chrome
Class: Chrome_WidgetWin_1
Position: -4, -4
Size: 1928, 1054
Style: 0x17CF0000
ExStyle: 0x00000100
Handle: 0x00290788
 
>>>> Control <<<<
Class: ViewsTextfieldEdit
Instance: 2
ClassnameNN: ViewsTextfieldEdit2
Name:
Advanced (Class): [CLASS:ViewsTextfieldEdit; INSTANCE:2]
ID: 108113024
Text:
Position: 894, 537
Size: 196, 19
ControlClick Coords: 53, 3
Style: 0x56000080
ExStyle: 0x00000000
Handle: 0x001706B0
 
>>>> Mouse <<<<
Position: 947, 540
Cursor ID: 5
Color: 0xFFFFFF
 
*************************
 
Any more suggestions as to what change do i need to make in the script so that it works in all scenarios??
Edited by vm2007
Link to comment
Share on other sites

  • Solution

Finally i was able to make it work...I guess I did less research before jumping into this. The working script is as follows. It works even when RDP window is minimized.

sleep(10000)
WinWait("[CLASS:Chrome_WidgetWin_1]","","20")
ControlSend("[CLASS:Chrome_WidgetWin_1; Title:TestPage3456 - Google Chrome", "", "[CLASS:ViewsTextfieldEdit; INSTANCE:2]", "vm2007{TAB}")
ControlSend("[CLASS:Chrome_WidgetWin_1; Title:TestPage3456 - Google Chrome]", "", "[CLASS:ViewsTextfieldEdit; INSTANCE:1]", "abcdef{Enter}")
 
Thanks everyone for your inputs...:)
Link to comment
Share on other sites

  • 6 years later...

Hi vm2007 , could you please help me resolving this , i have the exact same problem as you had , but  i can see that it has been solved for you but i am not able to solve it 

could you please help me 

email address bhupinder.7575@gmail.com

Link to comment
Share on other sites

@Bhupi Considering this thread is over 6 years old and that vm2007 hasn't been on the forums for almost 6 years, I doubt he'll be reaching out to you any time soon.  May I suggest you start a new post/thread with what you are trying to accomplish so a fresh set of eyes can look at it and give you guidance (hopefully).

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...