Sign in to follow this  
Followers 0
Boris76

AutoIT on Virtual Machine doesn't work

8 posts in this topic

Hello All! I have tried the same script on two computers (Win Serv 2008 both)

in RDP-session. On the one of them script works, on the another doesn't work!

Command "Run" works and my application starts

but then mouse doesn't move and doesn't make LeftClick!

Both Server 2008 are virtual machines.

Please, give me a hint, why ONE OF THEM doesn't work?

Then I have tried my script on the real mashines with Windows-7 (without RDP).

On some mashines it works, but on some - doesn't work.

I changed speed of mouse's moving from 0 to 100 - no difference!

(No, there was a difference on the one virtual Server-2008: when

speed is less then 100 script did not move a mouse.)

Only under XP my script works good (in RDP-session works too!

On a virtual machines under XP script works!)

My script is very simple:

Run("...")

$hWnd = WinWaitActive("...", 10)

$size = WinGetPos($hWnd);

MouseMove($size[0]+100, $size[1]+100, 100)

MouseClick("left")

Last two commands on some machines doesn't work! I was looking

through FAQ and forum but did not find anything about this subject.

I tried ControlClick instead of MouseClick - no difference (under

XP works, under virtual Server-2008 doesn't work).

I use only the last version of AutoIT on all machines.

Please help!

What should I do to force my script works?

Thanks.

Share this post


Link to post
Share on other sites



Don't use MouseMove and MouseClick. They depend on the screen resolution and window position.

Use the Control* functions. They are much more reliable!


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

MouseClick accompanied with MouseMove should only be used as a last resort if the UI isn't created with the Windows API.


_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 04/09/2015

Share this post


Link to post
Share on other sites

That's what I said ;)


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

That's what I said ;)

True, but I enforced your statement.

_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 04/09/2015

Share this post


Link to post
Share on other sites

Why don't you explain more about what you're trying to accomplish. There may be a much more simple way to do it.


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites

Sorry for being late!

I had temporary problem with access to my virtual servers (on remote computers).

This is my script:

-------------------------------------------------------

Global $size

Global $hWnd

;Opt("GUIOnEventMode", 1)

Opt("WindowTitleMatchMode",3)

Run("C:AA_v3.exe") ; start Ammyy-application

Sleep (5000)

$hWnd = WinWaitActive("Ammyy Admin v3.0 - Free", "", 10)

$size = WinGetPos($hWnd)

; MsgBox(0, "Active window stats (x,y,width,height):", $size[0] & " " & $size[1] & " " & $size[2] & " " & $size[3], 5)

; MsgBox (0, "hWnd=", $hWnd, 5)

MouseMove ( $size[0]+300, $size[1]+240, 100 ) ; button "connect"

MouseClick ( "left" )

; ControlClick ("Ammyy Admin v3.0 - Free", "", 1507 ) ; 1507 - ID of button "Connect"

Sleep (5000)

-------------------------------------------------------

I made the table of all available computers:

1. My own comp number 1 (XP SP3) 1440x900x32bit - works (both: MouseClick and ControlClick)

2. My own comp number 1 (XP SP3) (RDP-session): 1024x768x16bit - works both variants

3. My own comp number 2 (Windows-7): 1024x768x16bit - doesn't work (both variants)

4. 1280x1024x32bit - doesn't work (both variants)

5. My friend's comp (XP SP3): 1280x1024x32bit - works both variants!

6. My friend's comp (Windows-7): 1024x768x32bit - doesn't work (both variants)

7. Virtual Server-2008 number 1 (RDP-session): 1440x900 - doesn't work (both variants)

but yesterday did work both variants!

8. Virtual Server-2008 number 2 (RDP-session): 1440x900x16bit - doesn't work (both variants)

All systems are licensed and up-to-date.

-------------------------------------------------------

"doesn't work" means:

1. Command "Run" works and application "Ammyy" starts (new process in Task Manager)

2. The main window of Ammyy opens

3. Array $size and $hWnd have non-zero values (MsgBox works)

4. MouseMove doesn't work

5. MouseClick doesn't work

6. ControlClick doesn't work

----------------------------------------------------------------------------------------------

I have downloaded very good program "dc.exe" (Display Changer) from here:

http://12noon.com/?page_id=80

Since "screen parameters can not be changed during RDP-session" I made bat-file

for "dc.exe -width 1024 -height 768 -depth 32 -force"

and my script.

And I made Sheduled Task for this bat-file. Then I closed my RDP-session and waited.

After few minutes I entered again to my virtual servers and saw results:

"Graphic adapter's driver failed to this resolution parameters values".

Now I am trying other "resolution parameters values" but I think it doesn't depend on resolution

(look at the table).

But what is a real reason of not working my script?

Share this post


Link to post
Share on other sites

9. I made virtual XP SP3 (on the host Win7): 800x600x32bit - works (both variants)

10. the same virtual XP SP3 (RDP-session): 800x600x32bit - works (both variants)

11. I asked another my friend (sysadmin) to try my script on his work on a

real Server-2008: 1024x768x32bit - doesn't work (both variants)

12. real Server2008 (RDP-session): 1024x768x32bit - doesn't work (both variants)

All Servers-2008 are 64bit. I tried "Compile Script (64)" and "Compile Script (x86)" -

no difference. I had reinstalled Autoit3 (version 3.3.8.1) as x64 and as x86 - no difference.

I think it doesn't depend on resolution. But what the reason may be? I have already damaged my mind!

Share this post


Link to post
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
Sign in to follow this  
Followers 0