Jump to content

AutoIT questions


kaje_ovo

Recommended Posts


i am wondering if exist a function , in beta or UDF who can WinWaiActive

for 2 variants of title/text ?

i have same script in 2 languages :

english script

$text__05 = "Choose the setup type"

   WinWaitActive ( $title_02 , $text__05 )

   ControlClick ( $title_02 , $text__05 , "Button3")

$text__06 = "Getting ready to install"

   WinWaitActive ( $title_02 , $text__06 )

   ControlClick ( $title_02 , $text__06 , "Button1")

romanian script

$text__05 = "Alegeti tipul de instalare"

   WinWaitActive ( $title_02 , $text__05 )

   ControlClick ( $title_02 , $text__05 , "Button3")

$text__06 = "Se pregateste instalarea"

   WinWaitActive ( $title_02 , $text__06 )

   ControlClick ( $title_02 , $text__06 , "Button1")

a function something like : ok i will wait for a window, but i will

finish the waiting when will appear one window who have the couple

title/text equal with title1/text1 or title2/text2 ?

if not exist ... well...i will study the while function .

thank you !

Link to comment
Share on other sites

thank you for your answer.

is not exactly what i want , but i get the main ideea and

this is for me more than a hint .

what i want is an UDF function , to use it in different scenarious .

like (shorted sintax) :

;------------------begin script

$option = 0

$title_02e ="Settings" ; e from english

$title_02r ="Setari" ; r from romanian

$text__05e = "Choose the setup type"

$text__05r = "Alegeti tipul de instalare"

_pair_WinWaitActive ($title_02e , $title_02r , $text__05e , $text__05r, $option)

_pair_ControlClick ($title_02e , $title_02r , $text__05e , $text__05r, $option , "Button3")

$text__06e = "Getting ready to install"

$text__06r = "Se pregateste instalarea"

_pair_WinWaitActive ($title_02e , $title_02r , $text__06e , $text__06r, $option)

_pair_ControlClick ($title_02e , $title_02r , $text__06e , $text__06r, $option , "Button1")

...and so on to "Finished" / "Terminat" window

;------------------end script

function _pair_WinWaitActive

; $option is set here to 1(if will appear english window) or 2(romanian);

$option = 0

While = 1

.... WinWaitActive ( english or romanian window)

.... set the $option variable to 1 or 2

WEnd

end

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

function _pair_ControlClick ($title1 , $title2 , $text1 , $text2, $option , $button)

; $option is set allready by _pair_WinWaitActive to 1 or 2

if $option =1 then ControlClick ( $title1 , $text1 , $button)

if $option =2 then ControlClick ( $title2 , $text2 , $button)

; can be used a case option here..

end

Link to comment
Share on other sites

i am wondering if exist a function , in beta or UDF who can WinWaiActive

for 2 variants of title/text ?

i have same script in 2 languages :

english script

$text__05 = "Choose the setup type"

   WinWaitActive ( $title_02 , $text__05 )

   ControlClick ( $title_02 , $text__05 , "Button3")

$text__06 = "Getting ready to install"

   WinWaitActive ( $title_02 , $text__06 )

   ControlClick ( $title_02 , $text__06 , "Button1")

romanian script

$text__05 = "Alegeti tipul de instalare"

   WinWaitActive ( $title_02 , $text__05 )

   ControlClick ( $title_02 , $text__05 , "Button3")

$text__06 = "Se pregateste instalarea"

   WinWaitActive ( $title_02 , $text__06 )

   ControlClick ( $title_02 , $text__06 , "Button1")

a function something like : ok i will wait for a window, but i will

finish the waiting when will appear one window who have the couple

title/text equal with title1/text1 or title2/text2 ?

if not exist ... well...i will study the while function .

thank you !

oneless,

On the last part mentioned, the beta of AutoIt has RegExp support for Window Titles which would allow you to recognize more then one title per WinWait() check, but I would consider too much resources used to control different language installation, as Nologic shows as needing to get the title with WinGetTitle as well to confirm and use.

For the script to be efficient, I would try the @OSLANG macro to 1st sort out which language to use, then process that language solely.

As you have posted in the quote, "ClassNameNN" strings normally do not change, so would be choice to use instead of ControlID or the controls text.

I would consider trying this concept 1st.

If @OSLang = '0418' Then
; Romanian
$title_01 = 'Setari'
$text_01 = 'Alegeti tipul de instalare'
$title_02 = ''
$text_02 = ''
$title_03 = ''
$text_03 = ''
$paste_03 = 'Romanian text'
$title_04 = ''
$text_04 = ''
$title_05 = ''
$text_05 = ''
Else
; Other (English)
$title_01 = 'Settings'
$text_01 = 'Choose the setup type'
$title_02 = ''
$text_02 = ''
$title_03 = ''
$text_03 = ''
$paste_03 = 'English text'
$title_04 = ''
$text_04 = ''
$title_05 = ''
$text_05 = ''
EndIf

$pid = Run(@ScriptDir & '\program.exe')

If WinWait($title_01, $text_01, 60) Then
ControlClick($title_01, $text_01, 'Button1')

WinWait($title_02, $text_02)
ControlClick($title_02, $text_02, 'Button3')

WinWait($title_03, $text_03)
ControlSetText($title_03, $text_03, 'Edit1', $paste_03)
ControlClick($title_03, $text_03, 'Button2')

WinWait($title_04, $text_04)
ControlClick($title_04, $text_04, 'Button4')

WinWait($title_05, $text_05)
ControlClick($title_05, $text_05, 'Button1')
Else
ProcessClose($pid)
Exit 1
EndIf

ProcessWaitClose($pid)

Link to comment
Share on other sites

@Nologic

Thanks for the reply. I earlier had been trying to send "windows key +D" and then mouse right click or menu key from the keyboard. I finished off again with "windows key +D".

I will try your suggestion, "WinMinimizeAllUndo ( )" would help to do the rest I believe.

Link to comment
Share on other sites

Hi,

I've been building my own unattended install DVD, and have come across a few programs that I can't get to install silently, so want to make an AutoIT script to run the program and automatically put in serial numbers, or just go through the installation process for me.

I've used SciTE's recording facility to generate a script of what mouse clicks are needed, and what text needsto be entered, etc, but I can't figure out how to make the script call the installation program in the first place.

Can anyone help?

Many thanks,

Paul

Link to comment
Share on other sites

  • 2 weeks later...

Hello,

Can someone help me with this two difficulties, please?

1 - I am trying to automate the creation of my unattended cd with CDImageGui. So I remembered to use Autoit.

I am using ControlCommand to give the orders, just like I do to automate the installation of a program. The problem is that "Autoit Window Info" does not show the ControlID or the ClassNameNN of the individual buttons of CDImageGui, so I don't know how to do it.

On the left panel of CDImageGui I wanted to click on "Creation" button, then "Start Image Creation" button.

I don't know how, but I managed to select the "Creation" button with this code:

Run("D:\Unattended\CDIMAGE\cdimagegui.exe")
WinWait("CDImage GUI Beta 3 by CyBerian","Directory Configurat")
ControlCommand("CDImage GUI Beta 3 by CyBerian", "Directory Configuration", "TFEGXOutlookBar1", "Check", "")
WinWait("CDImage GUI Beta 3 by CyBerian","Start the Image Creation")

"TFEGXOutlookBar1" is the ClassNameNN that "Autoit Window Info" shows for all the left panel. I don't know why, but it manages to choose "Creation" button, which is exactly what I want.

Now I just miss the "Start Image Creation" button.

2- This second doubt shows all my ignorance with Autoit.

I use MS Virtual PC to test my unattended cds. When I try a new iso I have to delete the old Virtual PC files.

So I want Autoit to delete those files, but showing first a warning.

MsgBox(4096+1, "Attention!", "This will delete some files")

This code shows a window with 2 buttons: OK and Cancel.

How can I continue the script if I click OK and exit if I click Cancel?

Thank you

PS. - Well, I partially solved the second one through here

Now I just have to understand how do I click ok and execute the rest of the script

Edited by JohnS
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
  • Recently Browsing   0 members

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