Jump to content

Skip forward to another line


Recommended Posts

Okay so I am trying to make a java6 update 6 silent installer, just for fun... Autoit is cool so I figure the way to learn is to do... Anyway, I'm trying to figure out how to have a conditional statement like if this window pops up click this button, then continue from this point... The if part is easy, but the part I am having a hard time doing it continue from this point in the script.

For instance if when I execute the file a Open File - Security Warning pops up, then hit button one, but what if I'm on a computer where that doesn't pop up, or someone unblocks the file? Well then I just do a Else statement. But the problem is if the first statement is true how can I jump forward a few lines? Because the install will be the same for the rest of the install... I could put it in there twice but that isn't efficient. I thought about using call function but it just exits the script, plus I don't think that is the best way to do it... I've looked through the functions and can't seem to find what I am looking for.

Following is what I got so far...

FileInstall ("java6u6.exe", "java6u6.exe")
Run("java6u6.exe")

If WinActive( "Open File - Security Warning" ) Then
    ControlClick    ( "Open File - Security Warning" , "" , "[CLASS:Button; INSTANCE:1]" )
    Call ( "install" )
    Else
    Call ( "install" )
EndIf

Func install()
    WinActive ( "Java Setup - Welcome" , "Welcome to Java" )
    ControlClick ( "Java Setup - Welcome" , "" , "[CLASS:Button; INSTANCE:2]" )
EndFunc
Link to comment
Share on other sites

Okay so I am trying to make a java6 update 6 silent installer, just for fun... Autoit is cool so I figure the way to learn is to do... Anyway, I'm trying to figure out how to have a conditional statement like if this window pops up click this button, then continue from this point... The if part is easy, but the part I am having a hard time doing it continue from this point in the script.

For instance if when I execute the file a Open File - Security Warning pops up, then hit button one, but what if I'm on a computer where that doesn't pop up, or someone unblocks the file? Well then I just do a Else statement. But the problem is if the first statement is true how can I jump forward a few lines? Because the install will be the same for the rest of the install... I could put it in there twice but that isn't efficient. I thought about using call function but it just exits the script, plus I don't think that is the best way to do it... I've looked through the functions and can't seem to find what I am looking for.

Following is what I got so far...

FileInstall ("java6u6.exe", "java6u6.exe")
Run("java6u6.exe")

If WinActive( "Open File - Security Warning" ) Then
    ControlClick    ( "Open File - Security Warning" , "" , "[CLASS:Button; INSTANCE:1]" )
    Call ( "install" )
    Else
    Call ( "install" )
EndIf

Func install()
    WinActive ( "Java Setup - Welcome" , "Welcome to Java" )
    ControlClick ( "Java Setup - Welcome" , "" , "[CLASS:Button; INSTANCE:2]" )
EndFunc
You can set an AdLibEnable() function that watches for the security warning and handles it.

If the welcome window doesn't appear until after the security window is handled then you can use WinWait(), WinActivate(), WinWaitActive() to ensure the welcome window is up before continuing.

:)

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

Hey, thanks that worked great...

I experimented with the call function some more and figured out why it didn't work... I had WinActive instead of WinWaitActive... So it didn't wait when I called the function it just kept on going...

Thanks

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