Jump to content

runwait function?


Recommended Posts

#include <GUIConstants.au3>
GUICreate("Update Mods", 600, 600, 0, 0); width height left top
GUISetBkColor(0x00E0FFFF)
GUISetFont(9, 300)
$tab=GUICtrlCreateTab (0,0, 600,600)
$A=GUICtrlCreateTabitem ("A")
$start = GUICtrlCreateButton("Start Selected", 281, 370 , 120, 30)
$Checkbox1 = GUICtrlCreateCheckbox("A", 20, 5)
$Checkbox2 = GUICtrlCreateCheckbox("B", 20, 25)
$Checkbox3 = GUICtrlCreateCheckbox("C", 20, 45)


GUISetState()
While 1
$Msg = GUIGetMsg()
Select
Case $Msg = $GUI_EVENT_CLOSE
Exit
Case $Msg = $start
    
$Read = GUICtrlRead($Checkbox1);start
If $Read = $GUI_CHECKED Then
$addon = 'whatever
runwait(addon())

EndIf
$Read = GUICtrlRead($Checkbox2);start
If $Read = $GUI_CHECKED Then
$addon = 'whatever
runwait(addon())$Read = GUICtrlRead($Checkbox3)
If $Read = $GUI_CHECKED Then
$addon = 'whatever
runwait(addon());
EndIf
EndSelect
WEnd

once the button is clicked(start selected) it runs the selected checkboxes.

What I want it to do for every checkbox: run the function addon() and wait until it finishes before moving onto the next checkbox. What would I do to make this possible?

heres the addon() functon

Func addon()
$Name = @Homedrive & "\Downloads\" & $addon
$URL = "http://files.wowace.com/" & $addon & "/" & $addon & ".zip"
If FileExists(@HomeDrive & "\Downloads") Then
sleep(10)
Else
msgbox(0, "Folder Not Found", @Homedrive & "\Downloads does not exist")
EndIf
InetGet($URL,$Name,0,1)
sleep(1000)
tooltip( "Extracting Addon..." , 69 , 14 , "" , 0 , 4 )
If FileExists(@Homedrive & "\Downloads\" & $addon & ".zip") Then
Send("#r")
winwaitactive( "Run" )
sleep(500)
send(@Homedrive & "\Downloads\" & $addon & ".zip" & "{enter}")
sleep(500)
EndIf
If WinActive($addon & ".zip - WinRAR") Then
Sleep(750)
send('{altdown}w{altup}')
sleep(2000)
send('{altdown}{f4}{altup}')
sleep(1000)
If FileExists(@Homedrive & "\Downloads\" & $addon & ".zip") Then
filedelete(@Homedrive & "\Downloads\" & $addon & ".zip")
tooltip( "Moving Addon to WoW folder." , 69 , 14 , "" , 0 , 4 )
sleep(1000)
DirMove(@Homedrive & "\Downloads\" & $addon, @ProgramFilesDir & "\World of Warcraft\Interface\Addons\" , 1 )
tooltip("")
EndIf
EndIf
EndFunc
Link to comment
Share on other sites

Just call addon() by itself. The script will not return to the next line until that function does a Return. Make sure the code inside addon() does not Return until its finished.

:)

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

thanks I added a call( "addon" )

but It only downloads the files now if 2 of them are checked, I tried checking just 1 of the boxes then clicking start selected that doesent work anymore so I must of done something wrong with the addon() function when adding $addon.

for example:

If FileExists(@Homedrive & "\Downloads\Omen.zip") Then

to

If FileExists(@Homedrive & "\Downloads\" & $addon & ".zip") Then

not sure if thats correct or not.

Link to comment
Share on other sites

thanks I added a call( "addon" )

Why? :P

It's should be just this:

addon()
No Call() or Run() required!

If you want to run it conditionally, it would just be something like this:

If $fRunMe = True Then addon()

:)

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

Why? :P

It's should be just this:

addon()
No Call() or Run() required!

If you want to run it conditionally, it would just be something like this:

If $fRunMe = True Then addon()

:)

Thanks again, I added a true and false with the addon() it seems to work until I get an error

it open runs by sending the windows key + R

then types C:\Downloads\ what $addon is = to .zip, but sence has a ! in it, it has an error when trying to open it. and ! = altkey

is there away to declare a variable with a ! in it?

Link to comment
Share on other sites

Why? :P

It's should be just this:

addon()
No Call() or Run() required!

If you want to run it conditionally, it would just be something like this:

If $fRunMe = True Then addon()

:)

Thanks again, I added a true and false with the addon() it seems to work until I get an error

it open runs by sending the windows key + R

then types C:\Downloads\ what $addon is = to .zip, but sence has a ! in it, it has an error when trying to open it. and ! = altkey

is there away to declare a variable with a ! in it?

Link to comment
Share on other sites

Thanks again, I added a true and false with the addon() it seems to work until I get an error

it open runs by sending the windows key + R

then types C:\Downloads\ what $addon is = to .zip, but sence has a ! in it, it has an error when trying to open it. and ! = altkey

is there away to declare a variable with a ! in it?

To Send() or ControlSend() a string without interpreting the special key characters (!, +, ^, etc.), add the raw flag. See the help file under those functions.

:)

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

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