Jump to content
Sign in to follow this  
Wikipete

Help Please.

Recommended Posts

Wikipete

Hi. I have tried to declare variables on the script below, and it worked for one of them, however the second one kept running an error message whenever I ran the .au3 file. (no error message from SCITE).

Can you give me an idea of what I am doing wrong.

I have marked the offending script with the ; command (and it is in BOLD)

Thanks.

Func downloadcomplete ()
    msgbox (0+64, "Thanks", "The download that you requested has completed and is ready for your installation. Please just click on the icon on the desktop to install it. Please be warned that your computer may need to be restarted in order to successfully install the software you just downloaded. Thanks, and enjoy your new software!")
Endfunc
Dim $sAnswer = Msgbox (6+64, "Hello again!", "The latest version of Autoit will now be downloaded to your computer, If you do not wish to do this yet, please click cancel and this presentation will cancel and you will return to normal functionality of your computer. If you do wish to proceed, click continue.")
If $sAnswer >=9 then
    InetGet("http://www.autoitscript.com/cgi-bin/getfile.pl?autoit3/autoit-v3-setup.exe", "autoit.exe")
Dim $scontinuepressed = MsgBox (6+64, "Downloading...", "Please install the file to your system, I will give you 90 seconds to do this, If you do not finish before this period is up, please click continue when you are ready. I have included a free game, just incase you get bored.", 1279)
[b]Elseif $scontinuepressed = 11 then[/b] ; this is the offending section.
downloadcomplete ()
Else 
EndIf
If $scontinuepressed = 2 then       
    msgbox (0+64, "Please restart this application", "The software was NOT installed on your computer, please restart this application before running any other program off the disk in your disk drive")
Endif
    $decision = MsgBox (4+64, "Make a decision", "Do you wish to continue installing the rest of the downloads on this disk?")
If $decision = 7 Then
    msgbox (0+64, "Thanks", "Only Autoit was installed on your system, if you have not already installed the other applications, please do so immediately by restarting this application and running completely through it. If not, please enjoy your renewed version of Autoit.")
Exit
Else
    $sAnswer2 = msgbox (4+64, "Did you beat me to it?", "Have you already installed autoit and wish to install another program on your system?")
Endif
If $sAnswer2 = 7 Then
    msgbox (0+64, "You are confusing", "Please decide what you actually want to do before running this installer again. Thank you.")
Exit
Else
    msgbox (0+64, "Great!", "Lets insall the other applications on this CD")
Endif

Please see bottom for update.

Edited by Wikipete

 Run (Brain.exe)
.

Share this post


Link to post
Share on other sites
evilertoaster

you have alot of variants declared and evaluation out of scope (which is ok in autoit technically but it can lead to bad design as you've seen). Try sth like-

Func downloadcomplete ()
    msgbox (0+64, "Thanks", "The download that you requested has completed and is ready for your installation. Please just click on the icon on the desktop to install it. Please be warned that your computer may need to be restarted in order to successfully install the software you just downloaded. Thanks, and enjoy your new software!")
Endfunc

Dim $sAnswer = Msgbox (6+64, "Hello again!", "The latest version of Autoit will now be downloaded to your computer, If you do not wish to do this yet, please click cancel and this presentation will cancel and you will return to normal functionality of your computer. If you do wish to proceed, click continue.")

If $sAnswer >=9 then
    InetGet("http://www.autoitscript.com/cgi-bin/getfile.pl?autoit3/autoit-v3-setup.exe", "autoit.exe")
    $scontinuepressed= MsgBox (6+64, "Downloading...", "Please install the file to your system, I will give you 90 seconds to do this, If you do not finish before this period is up, please click continue when you are ready. I have included a free game, just incase you get bored.", 1279)
    if $scontinuepressed = 11 then downloadcomplete ()
    If $scontinuepressed = 2 then msgbox (0+64, "Please restart this application", "The software was NOT installed on your computer, please restart this application before running any other program off the disk in your disk drive")
EndIf

$decision = MsgBox (4+64, "Make a decision", "Do you wish to continue installing the rest of the downloads on this disk?")

If $decision = 7 Then
    msgbox (0+64, "Thanks", "Only Autoit was installed on your system, if you have not already installed the other applications, please do so immediately by restarting this application and running completely through it. If not, please enjoy your renewed version of Autoit.")
    Exit
Else
    $sAnswer2 = msgbox (4+64, "Did you beat me to it?", "Have you already installed autoit and wish to install another program on your system?")
    If $sAnswer2 = 7 Then
        msgbox (0+64, "You are confusing", "Please decide what you actually want to do before running this installer again. Thank you.")
        Exit
    Else
        msgbox (0+64, "Great!", "Lets insall the other applications on this CD")
    Endif
Endif

Share this post


Link to post
Share on other sites
Wikipete

you have alot of variants declared and evaluation out of scope (which is ok in autoit technically but it can lead to bad design as you've seen). Try sth like-

Func downloadcomplete ()
    msgbox (0+64, "Thanks", "The download that you requested has completed and is ready for your installation. Please just click on the icon on the desktop to install it. Please be warned that your computer may need to be restarted in order to successfully install the software you just downloaded. Thanks, and enjoy your new software!")
Endfunc

Dim $sAnswer = Msgbox (6+64, "Hello again!", "The latest version of Autoit will now be downloaded to your computer, If you do not wish to do this yet, please click cancel and this presentation will cancel and you will return to normal functionality of your computer. If you do wish to proceed, click continue.")

If $sAnswer >=9 then
    InetGet("http://www.autoitscript.com/cgi-bin/getfile.pl?autoit3/autoit-v3-setup.exe", "autoit.exe")
    $scontinuepressed= MsgBox (6+64, "Downloading...", "Please install the file to your system, I will give you 90 seconds to do this, If you do not finish before this period is up, please click continue when you are ready. I have included a free game, just incase you get bored.", 1279)
    if $scontinuepressed = 11 then downloadcomplete ()
    If $scontinuepressed = 2 then msgbox (0+64, "Please restart this application", "The software was NOT installed on your computer, please restart this application before running any other program off the disk in your disk drive")
EndIf

$decision = MsgBox (4+64, "Make a decision", "Do you wish to continue installing the rest of the downloads on this disk?")

If $decision = 7 Then
    msgbox (0+64, "Thanks", "Only Autoit was installed on your system, if you have not already installed the other applications, please do so immediately by restarting this application and running completely through it. If not, please enjoy your renewed version of Autoit.")
    Exit
Else
    $sAnswer2 = msgbox (4+64, "Did you beat me to it?", "Have you already installed autoit and wish to install another program on your system?")
    If $sAnswer2 = 7 Then
        msgbox (0+64, "You are confusing", "Please decide what you actually want to do before running this installer again. Thank you.")
        Exit
    Else
        msgbox (0+64, "Great!", "Lets insall the other applications on this CD")
    Endif
Endif
Thanks a lot! It worked a treat!

 Run (Brain.exe)
.

Share this post


Link to post
Share on other sites
Wikipete

Why does Run (...) not work for folders?!

For example:

Run ("Download Timer.exe", "C:\Documents and Settings\Admin\Desktop\")oÝ÷ Û
+Ê^­÷¶ºÖ®¶­sb'VâgV÷C´F÷væÆöBFÖW"æWRgV÷C²ÂgV÷C´3¢b3#´Fö7VÖVçG2æB6WGFæw2b3#´FÖâb3#´FW6·F÷b3#µ&öw&ÒfÆW2b3#²gV÷C²
does not.

It's a mystery. Thanks.

Edited by Wikipete

 Run (Brain.exe)
.

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  

×