Sign in to follow this  
Followers 0
digitalprisoner

Noob Question...

12 posts in this topic

can someone please post some sample code of a program install... I am stuck on the parts after launching the .exe. I want to be able to provide all information during setup so I do not have to input anything. I know how to get the window titles using window spy. I need some guidance on selecting the window and filling it the data in different fields. Thx in advance.

Share this post


Link to post
Share on other sites



Here is a script that opens two notepad windows and names them program and info dump

WinMinimizeAll()

;minimizes all open windows

run("notepad","",@SW_MAXIMIZE)

;runs notepad and maximizes it, same as start run and typing in notepad

winwait("Untitled - Notepad")

;waits for the window called "Untitled - Notepad" to exist

WinSetTitle ("","","Program" )

;change the current window to be called "program"

run("notepad","",@SW_MAXIMIZE)

winwait("Untitled - Notepad")

WinSetTitle ("","","Info Dump" )

All the windows are found by just looking at the title bar

Share this post


Link to post
Share on other sites

oh... oops wrong post. hehe my script did it not me.

You are gonna want to use controlsend and controlclick and change the wintitlematchmode to 4.

Share this post


Link to post
Share on other sites
:D thx, i will try it and see how far i get.

Share this post


Link to post
Share on other sites

okay this is what i have using window spy, when launching nero...

>>>>>>>>>>>>( Window Title )<<<<<<<<<<<<<

New Compilation

( classname=#32770 )

>>>>>>>>>>>( Mouse Position )<<<<<<<<<<<<

On Desktop: x: 290 y: 295

In Window: x: 236 y: 137

>>>>>>>>>>>>>( Pixel Color Under Mouse)<<<<<<<<<<<<<

Dec: 14215660 Hex: 0xD8E9EC

>>>>>>>>>>>( Window Position )<<<<<<<<<<<

left: 54 top: 158 width: 623 height: 372

>>>>>>>>( Last Control Under Mouse )<<<<<<<

Class: Button3 Text: No Multisession

>>>>>>>>>( Status Bar Text )<<<<<<<<

>>>>>>>>>>>( Visible Window Text )<<<<<<<<<

Multisession

&Multisession

Start Multisession disc

Continue Multisession disc

No Multisession

Options

Refresh &compilation automatically (without asking)

&Replace files in compilation

Archive bit set

File date or length changed

File content changed

Always

Remove &deleted files from compilation

Add &new files to compilation

Volume label

&ISO 9660:

NEW

Add Dat&e...

Add &Counter...

&Joliet:

NEW

Add Da&te...

A&dd Counter...

A&lso use the ISO 9660 text for Joliet

&More fields

New

Cancel

CD

Nero Express

Open...

>>>>>>>>>>( Hidden Window Text )<<<<<<<<<

Label

&Apply

Help

;;so what i am trying to do persay is to, launch nero.exe, and when the intial window shows up i would like to select the "No Multisession" button as listed above, just because i want something other than the default so i know it's working. Please submit some sample code on how i can accomplish this, so i can continue exploring this program. I am lost at this point, i don't know where to use cntrl click and cntrl send, or what the syntax should look like. I haven't been able to find any example code. Please HELP!

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

This is no perfect code, but it should get you started. I did not test this code but there should be no real errors:

;First line: start nero.exe
Run("nero.exe")

; Wait until the window appears
If not WinWait("New Compilation", "", 60) Then
  ; Show an error message
    MsgBox(4096, "Timed out", 'The window "New compilation" did not show up within 60 seconds!')
  ; And exit the script after showing the message
    Exit(1)
EndIf

; Simulate a mouseclick on the control "Button3"
ControlClick("New Compilation", "", "Button3")
Edited by sugi

Share this post


Link to post
Share on other sites

was there any modification needed SUGI for the the first button click to happen? It didnt do anything different. Just launched the program.. :D

Share this post


Link to post
Share on other sites

you may want to add a winactivate after the winwait, oh, wait, it's a command click... don't have to wait... exept that I noticed on mine that it doesn't immediately allow the control to be clicked, so you may want to put in a 1 second pause or something.... (another interesting note, on mine, the spy shows the command as Button4, not Button3) You can also Control Click by text and not classname, if cross-version support matters (like it's for more than just you?)


"I'm not even supposed to be here today!" -Dante (Hicks)

Share this post


Link to post
Share on other sites

is the syntax here correct ...i still have no results :D

; ----------------------------------------------------------------------------

;

; AutoIt Version: 3.0

; Language: English

; Platform: Win9x / NT

; Author: A.N.Other <myemail@nowhere.com>

;

; Script Function:

; Template AutoIt script.

;

; ----------------------------------------------------------------------------

; ----------------------------------------------------------------------------

; Set up our defaults

; ----------------------------------------------------------------------------

;AutoItSetOption("MustDeclareVars", 1)

;AutoItSetOption("MouseCoordMode", 0)

;AutoItSetOption("PixelCoordMode", 0)

;AutoItSetOption("RunErrorsFatal", 0)

;AutoItSetOption("TrayIconDebug", 1)

;AutoItSetOption("WinTitleMatchMode", 4)

; ----------------------------------------------------------------------------

; Script Start

; ----------------------------------------------------------------------------

run("C:\Program Files\Ahead\Nero\Nero.exe")

; Wait until the window appears

If not WinWait("New Compilation", "", 60) Then

; Show an error message

MsgBox(4096, "Timed out", 'The window "New compilation" did not show up within 60 seconds!')

; And exit the script after showing the message

Exit(1)

EndIf

; wait for a breif second

WinWait ("New Compilation","", 5)

; Simulate a mouseclick on the control "Button3"

ControlClick("No Multisession", "", "Button3")

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

; wait for a breif second

WinWait ("New Compilation","", 5)

WinWait does exactly what the name suggests: Wait until a window appears. If it already exists, the command will just continue. Use Sleep(5000) instead.

; Simulate a mouseclick on the control "Button3"

ControlClick("No Multisession", "", "Button3")

Here you're telling AutoIt to simulate a click in the window "No Multisession" on the control named Button3. I don't use Nero but according to what you've pasted, the window is not named "No Multisession" but "New Compilation", so I guess you want

ControlClick("New Compilation", "", "No Multisession")

You might need to change the text "No Multisession" in the command so that every underlined character is preceded with an &.

@emmanuel: Thanks, didn't know I could just click "on the description"

Edited by sugi

Share this post


Link to post
Share on other sites

thx suga...that did it

Share this post


Link to post
Share on other sites

sugi...for some reason if the script is executed it wont run the controlclick all the time...if the window is launched to the foreground it will work maybe 1 out of 10 (and that's pushn it)...but if launched in the background, it will be more consistent...any ideas?

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