Jump to content

Script that works locally doesn't work while being executed remotelly


Recommended Posts

Hello

I have script:

Local $sTitle
Func _GetLanguage()
    Switch StringRight(@MUILang,2)
        Case "09"
            Return "English"
        Case "15"
            Return "Polish"
    EndSwitch
EndFunc ;==>_GetLanguage
ConsoleWrite($sTitle)

If _GetLanguage() == "English"  Then Assign("sTitle", "Open")
If _GetLanguage() == "Polish"   Then Assign("sTitle", "Otwieranie")

WinWaitActive($sTitle)
ControlFocus($sTitle,"","Edit1")
ControlSetText($sTitle,"","Edit1",$CmdLine[1])
ControlClick($sTitle,"","Button1")

that simply operates on "Open" window used for selecting files to upload.

I have application under test, and when I run tests at localhost (tests are being fired on the same machine where web browser is being installed) then everything works ok.

But when I run tests remotelly (e.g. by Bamboo's remote agent, or by PowerShell's remote access) then application under test still displays "Open" window, but AutoIT doesn't execute this script on it.

What's important- if AutoIT is still in memory and I open this "Open" windows manualy, then script is being fired.

 

How to fix this?

Link to comment
Share on other sites

15 hours ago, TomaszWojciechowski said:

AutoIT is still in memory and I open this "Open" windows manualy, then script is being fired

Seems to me that AutoIt waits at WinWaitActive($sTitle) endlessly.  So you would need to WinActivate ($sTitle) before.  If that doesn't work, log all returns value and variables in a log file to follow path of the script.

Link to comment
Share on other sites

  • 2 years later...

Hello!

I have similar problem and I decided to write here instead to open a new topic.

I'm trying to open a project via "Open Project" from "File" menu of an IDE for building of software for specific processor. When the "Open" dialog is shown I want to write the path to the project file and click on "Open" button.  This is executed on a remote node (a part of an automated build system). When I'm connected via remote desktop and execute the script, all works fine. Even if I click outside of the application to change the focus. But when I'm disconnected from this PC and the script is executed from the build system, it stops on the dialog "Open" and stays forever. It just doesn't set the text in the edit box of the dialog. If I connect in this moment to the PC with remote desktop and click on the dialog "Open" to get the focus, all further actions are correctly executed.

I tried to set the focus and currently in my script I just send the text to the needed dialog, but I cannot solve my problem. Here is my script:

Local $ProjectPath = "Path\to\my\project"
Local $ProjectName = "project_name"

Func _WinWaitActivate($title,$text,$timeout=0)
    WinWait($title,$text,$timeout)
    If Not WinActive($title,$text) Then WinActivate($title,$text)
    WinWaitActive($title,$text,$timeout)
EndFunc

Run("C:\Program Files (x86)\MyIde.exe")
WinWait("Welcome","", 10)
ControlSend("My Ide", "", "", "{ALTDOWN}f{ALTUP}{DOWN}{ENTER}")
_WinWaitActivate("Open","")
ControlSetText("Open", "", "Edit1", $ProjectPath & "\.solproject")
ControlSend("Open", "", "Edit1", "{ENTER}")
_WinWaitActivate($ProjectName & " - My Ide","")
ControlSend($ProjectName & " - My Ide", "", "", "{CTRLDOWN}b{CTRLUP}{ENTER}")
WinWait("Building Workspace","", 10)
WinWaitClose ("Building Workspace", "", 120)
ControlSend($ProjectName & " - My Ide", "", "", "{ALTDOWN}f{ALTUP}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{ENTER}")
WinWait("My Ide","", 10)
WinKill ("My Ide")

So the script hangs on the line:

_WinWaitActivate("Open","")

Can somebody help me, please?

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...