Jump to content

Noobie asking for help


Recommended Posts

Hi I'm really new to scripting and AutoIT.

What I'm trying to do is automate an installation of some software and sometimes at one spot during the installation this window comes up declaring that there have been changes and I should reboot. You really don't need to and I never do, I just continue with the install and it works properly. The problem is that the box sometimes comes up and sometimes doesn't, I need to insert an IF statement or something like that, that will look for that box as well as the next dialogue box for the install. If the warning comes up to reboot, controlclick no, if the window comes up to continue the install, continue the install.

I'm just having some problems wrapping my head around what loop I should use and how I should code it. Any suggestions would be appreciated.

Thanks

Link to comment
Share on other sites

Thanks for responding, I've been fiddling around with AdlibRegister() and I can't seem to get the hang of it. I wrote the following to try and understand it but I keep getting the the error "AdlibRegister(): undefined function."? Can you help me figure out what I'm doing wrong?

Thanks!

Run("notepad.exe")
Sleep(1000)

AdlibRegister("WinCheck")

Func WinCheck()
If WinExists("Untitled - Notepad") Then
     WinClose("Untitled - Notepad")
EndIf
EndFunc
Edited by Esquared
Link to comment
Share on other sites

Hi, I'm still having a really hard time with the Adlib() function. I'm basically just trying to automate the install of Simply Accounting throught the dialog boxes. I tryed putting in the Adlib() but it doesn't seem to do anything, when the warning box pops up nothing happens. Here is my code.

I've confirmed that the WinExist works because I copied the function into the body of the code and put it to sleep for 20 seconds so the warning would pop up and it got rid of it, it just seems like the Adlib isn't doing it's job and looping?

Opt("WinTitleMatchMode", 2)
AdlibRegister("_WinCheck")
 
WinWait ("Sage Simply Accounting 2012 - InstallShield Wizard", "Select the language")
WinActivate ("Sage Simply Accounting 2012 - InstallShield Wizard", "Select the language")
WinWaitActive("Sage Simply Accounting 2012 - InstallShield Wizard", "Select the language")
ControlClick("Sage Simply Accounting 2012 - InstallShield Wizard", "Select the language", 1)

Func _WinCheck()
If WinExists("Question", "Sage Simply Accounting has detected") Then
ControlClick("Question", "Sage Simply Accounting has detected", 7)
EndIf
EndFunc

Thanks

Edited by Esquared
Link to comment
Share on other sites

Have you tried it with a WinActivate before doing the ControlClick in your function?

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

While I was waiting I kept going with the code for the other dialog boxes and as soon as I did the next dialog box the Adlib started working? Was it because it was at the end of the script and even though the warning had come up it didn't just keep going, it stopped, I was under the impression that you had to unregister it for it to stop?

I also did change it to WinActivate and it seems to work now.

Thanks

Edited by Esquared
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...