Jump to content

Check if a certain form is open else move on


jben
 Share

Recommended Posts

Hi everyone.

Been working on some code and trying to find an answer to a problem thats really got the better of me.

Basically I have a script that automates software installation. This works fine on the initial installation but on re-install a form appears stating that the software has already been installed. Therefore I'm wondering if its possible to add something to my code to recognize this.

An example

------------

winwait("name of form")

if the form = ("this software is installed") then

controlclick ("OK button") ;this is the problem.

winwaitactive ("install shield","welcome to the wizard 1 of 2")

controlclick ("whatever the button is")

winwaitactive ("install shield","welcome to the wizard part 2 of 2")

controlclick ("whatever the button is")

I know the code above wont work, just a basic example. Basically the bit where I put "if the form =" is the piece of code that I only want to run if that form appears, if not then it will just proceed to the next bit of code.

Any ideaS?. Thanks

Link to comment
Share on other sites

Hi everyone.

Been working on some code and trying to find an answer to a problem thats really got the better of me.

Basically I have a script that automates software installation. This works fine on the initial installation but on re-install a form appears stating that the software has already been installed. Therefore I'm wondering if its possible to add something to my code to recognize this.

An example

------------

winwait("name of form")

if the form = ("this software is installed") then

controlclick ("OK button") ;this is the problem.

winwaitactive ("install shield","welcome to the wizard 1 of 2")

controlclick ("whatever the button is")

winwaitactive ("install shield","welcome to the wizard part 2 of 2")

controlclick ("whatever the button is")

I know the code above wont work, just a basic example. Basically the bit where I put "if the form =" is the piece of code that I only want to run if that form appears, if not then it will just proceed to the next bit of code.

Any ideaS?. Thanks

If you think that the form would appear within a time $time1 then you can do something like

if WinWait("title of already installed window prompt","",$time1) = 1 then
;handle already installed situation
else
 install as before
endif

or you could say

while 1
 $currentTitle = WinGetTitle() 
  if StringCompare($currentTitle,"title of already installed") = 0  then
   $installdone = true
   exitloop
 endif
 if StringCompare($currentTitle,"Title of next window for install") = 0 then
    $installdone = false
    exitloop
 endif

wend
Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

I ended up looking back at previous posts and actually discovered I have covered this before haha. Waisting the day away when I actually have done something similar before, but just forgot.

http://www.autoitscript.com/forum/index.ph...amp;qpid=497350 this is where I found out the information from a previous post. Must be the Friday feeling, I can't switch my brain on

If you think that the form would appear within a time $time1 then you can do something like

if WinWait("title of already installed window prompt","",$time1) = 1 then
;handle already installed situation
else
 install as before
endif

or you could say

while 1
 $currentTitle = WinGetTitle() 
  if StringCompare($currentTitle,"title of already installed") = 0  then
   $installdone = true
   exitloop
 endif
 if StringCompare($currentTitle,"Title of next window for install") = 0 then
    $installdone = false
    exitloop
 endif

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