Jump to content

Window with no Title


pegmanm
 Share

Recommended Posts

I am trying to automate a fairly simple procedure in a product called Sage Line 50. However the program starts with a splash screen with no title. I believe that this is causing my script to fail. I can see my script start the application ( splash screen) but no windows appear after that like either the "Select Company" or "Login" windows.

Can you please let me know the easiest way to manage a window with no title that disappears after 3 seconds and start interacting with the following Logon screen.

Perhaps my script has an error elsewhere that you could point out.

Any Help is greatly appreciated.

Regards and Thanks in advance

**** Script ****

; Prints report from Sage Line 50

;

Opt("WinTitleMatchMode", 1) ;1=start, 2=subStr, 3=exact, 4=advanced, -1 to -4=Nocase

Opt("SendKeyDownDelay", 3) ;Default 5ms

Opt("RunErrorsFatal", 1) ;Sets if the script should terminate with a fatal error if a Run/RunWait function fails due to bad paths/file not found/Bad login IDs:

;1 = fatal error (default)

;0 = silent error (@error set to 1)

; Run the Sage line 50 Program

AutoItSetOption("SendKeyDelay", 200)

; Prompt the user to run the script - use a Yes/No prompt (4 - see help file)

$answer = MsgBox(4, "AutoIt Example", "This script will run the sage and save the report as a csv file. Run?")

; Check the user's answer to the prompt (see the help file for MsgBox return values)

; If "No" was clicked (7) then exit the script

If $answer = 7 Then

MsgBox(0, "AutoIt", "OK. Bye!")

Exit

EndIf

Run("C:\Program Files\Common Files\Sage SBD\SBDDesktop.exe")

; Wait for the Select Company Screen to become active so we can choose

; our company from the drop down. Default chosen here.

;

Sleep(4000)

WinWaitActive("Select")

WinActivate("Select")

If WinExists("Logon") Then

MsgBox(0, "", "Window exists")

EndIf

Send("{ENTER}")

Sleep(2000)

; Wait for the login screen. Login using default manager username

WinWaitActive("Logon")

WinActivate("Logon")

Send("manager{ENTER}")

Sleep(2000)

Send("{ENTER}")

;Wait once more for the Sage Line 50 main screen to open.

;Whew finally was can try and do something.

WinWaitActive("Sage")

Sleep(2000)

Send("!a")

Send("{ENTER}")

***End of script ****

Link to comment
Share on other sites

Use this mode: Opt("WinTitleMatchMode", 4)

Use AU3Info.exe, the AutoIt Window Info utility, to get the class and any visible text that might help.

Access the window this way: $hWin = WinGetHandle("[CLASS:#32770]", "Text, if any")

Of course, #32770 is just an example your window class will vary.

Once you get the window handle in $hWin, just use that anywhere else you need to ID that window.

:D

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

I Did not attach the out put from the Window Info tool. This may be helpful to any resposnce so please find below.

>>>> Window <<<<

Title:

Class: #32770

Position: 590, 358

Size: 500, 300

Style: 0x9408084C

ExStyle: 0x00010000

Handle: 0x000B0306

>>>> Control <<<<

Class:

Instance:

ClassnameNN:

ID:

Text:

Position:

Size:

ControlClick Coords:

Style:

ExStyle:

Handle: 0x000A011A

>>>> Mouse <<<<

Position: 225, 283

Cursor ID: 15

Color: 0xFFFFFF

>>>> StatusBar <<<<

>>>> Visible Text <<<<

>>>> Hidden Text <<<<

Regards

Martin P

Link to comment
Share on other sites

Access the window this way: $hWin = WinGetHandle("[CLASS:#32770]", "Text, if any")

Once you get the window handle in $hWin, just use that anywhere else you need to ID that window.

:D

Sorry I had not seen this post before I posted the output from Window Info.

Can I use this variable like the following?

$hWin=WinGetHandle("[CLASS:#32770]")

WinWaitClose($hWin)

WinWaitActive("Select")

WinActivate("Select")

Link to comment
Share on other sites

Sorry I had not seen this post before I posted the output from Window Info.

Can I use this variable like the following?

$hWin=WinGetHandle("[CLASS:#32770]")

WinWaitClose($hWin)

Yes, anywhere AutoIt would normally take $sWinTitle, you can pass it a handle instead. While the title of a window might change (or not exist) the handle is stable for as long as the window exists.

:D

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

Great Thanks for all the help.

Martin P (Newbie)

Yes, anywhere AutoIt would normally take $sWinTitle, you can pass it a handle instead. While the title of a window might change (or not exist) the handle is stable for as long as the window exists.

:D

Link to comment
Share on other sites

  • 2 years later...

Sorry for the necro but...

Sage Line 50 has a standalone setup.exe. The splash screen is avoided if you use \Install\Setup.exe

Anyway, yesterday was my first look at AutoIT and I came up with the following very simple script for installing sage line 50.

#cs ----------------------------------------------------------------------------

AutoIt Version: 3.3.6.1

Author: MNewton

Script Function:

Sage 2010 Installation

#ce ----------------------------------------------------------------------------

; Runs the install .exe

Run("\\nott-gb-sms-01\Software\SAGEL50V2010\Install\Setup.exe")

; waits for focus of the wizard

WinWaitActive("Accounts - InstallShield Wizard")

; Selects the YES button

Send("!y")

; waits for focus of the wizard

WinActivate("Accounts - InstallShield Wizard")

; selects the custom install option

ControlClick( "", "", 102)

; takes focus of the wizard

WinActivate("Accounts - InstallShield Wizard")

; waits 2 seconds for machine to realise it's moved on (required)

ProcessWait("", 2)

; Selects the Browse option to change default directory name

Send("!r")

; Waits for the Choose Folder window

WinWaitActive("Choose Folder")

; Sends the path below to be the install directory

Send("c:\program files\sage\accounts 2010")

; Hits enter on that window

Send("{ENTER}")

; Waits 2 seconds for machine to realise it's moved on (required)

ProcessWait("", 2)

; Selects the Next button

Send("!n")

; Waits 2 seconds for machine to realise it's moved on (required)

ProcessWait("", 2)

; Sets Start Menu Programs folder to Sage Accounts 2010 to differentiate from other versions

Send("Sage Accounts 2010")

; Waits 2 seconds

ProcessWait("", 2)

; Selects the Next button

Send("!n")

; Now at final confirmation window

; Waits 2 seconds

ProcessWait("", 2)

;Selects the Next button

Send("!n")

; Program now installs

; Waits 10 seconds for dialogue boxes to clear

ProcessWait("", 400)

; Sends final Finish Command

Send("{SPACE}")

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