Sign in to follow this  
Followers 0
Zerocool

My program doesnt work.

5 posts in this topic

#Include<GUIConstants.au3>
Opt("WinTitleMatchMode",4)

$GUI = GUICreate("Downloading Apache 2.2.3",314,56,193,115,BitOR($WS_MINIMIZEBOX,$WS_CAPTION,$WS_GROUP,$WS_BORDER,$WS_CLIPSIBLINGS))
$Progress=GUICtrlCreateProgress(8,8,297,17,$PBS_SMOOTH)
$Label=GUICtrlCreateLabel("0000/0000",120,32,67,17,BitOR($SS_CENTER,$SS_SUNKEN))
GUICtrlSetFont(-1,8,400,0,"Lucida Console")
GUISetState(@SW_SHOW)

$size=InetGetSize("http://apache.proserve.nl/httpd/binaries/win32/apache_2.2.3-win32-x86-no_ssl.msi")
InetGet("http://apache.proserve.nl/httpd/binaries/win32/apache_2.2.3-win32-x86-no_ssl.msi",@HomeDrive&"\setup.msi",1,1)
If @error Then
    MsgBox(0+16,"ERROR","Apache 2.2.3 is currently not available.")
    FileDelete(@HomeDrive&"\setup.msi")
    Exit
EndIf

While @InetGetActive
    GUICtrlSetData($Progress,Round(@InetGetBytesRead/$size*100))
    GUICtrlSetData($Label,Round(@InetGetBytesRead/1024)&"/"&Round($size/1024))
    Sleep(10)
WEnd

_Run(@HomeDrive&"\setup.msi")

WinWaitActive("Apache HTTP Server 2.2 - Installation Wizard")

;====================== Installation ==========================
$handle=WinGetHandle("classname=MsiDialogCloseClass","")
If @error Then
    MsgBox(0+16,"ERROR","Could not find correct window.")
    Exit
EndIf

Do
    $page_1=ControlGetText($handle,"",4817)
    Sleep(50)
Until $page_1=IniRead("install.ini","Install","Page_1","")

_Next()

InstallCheck()

ControlClick($handle, IniRead("install.ini","Install","Page_2",""), 4110, "left", 1)
_Next()

Do
    $page_3=ControlGetText($handle,"",4169)
    Sleep(50)
Until $page_3=IniRead("install.ini","Install","Page_3","")

_Next()

Do
    $page_4=ControlGetText($handle,"",3986)
    Sleep(50)
Until $page_4=IniRead("install.ini","Install","Page_4","")

ControlSetText($handle,"",5027,"localhost")
ControlSetText($handle,"",5030,"localhost")
ControlSetText($handle,"",5021,"admin@localhost")

;======================= Functions ============================
Func _Run($path)
    If Not FileExists($path) Then Return -1
    If Not FileExists(@SystemDir&'\msiexec.exe') Then Return -2
    $pid = Run('"'&@SystemDir&'\msiexec.exe" /i "'&$path&'"')
    Return $pid
EndFunc

Func InstallCheck()
    Do
        $check=ControlGetText($handle,"",4814)
        Sleep(50)
    Until $check="NewBinary1"
    
    ;;; Arrived in Page2 ;;;
    
    $remove=ControlGetText($handle,"",624)
    
    If $remove="&Remove" Then
        Uninstall()
    EndIf
EndFunc

Func _Next()
    ControlClick($handle,"&Next >",4188,"left",1)
EndFunc

Func Uninstall()
    MsgBox(0+16,"ERROR","Underconstruction.")
EndFunc

Help please.

Share this post


Link to post
Share on other sites



My program doesnt work.

Too lazy to read code, but yu would be more likely to get help if you listened to this:

For future reference, when posting a thread , make its title remotely pertinent to question/subject you are posting about.

This is the support section of the forum, its meant for questions, so naming a thread "I Have A Problem", or "Question", or "Help Me My, Code Doesn't Work", or "Noob Requesting Assistance" Is redundant, and makes it harder for anyone else who has the same/similar questions as you to find the answer by searching the forums, which in turn means people often have to make extra threads and people who are answering the threads just end up repeating themselves several times over.

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Ye, Well how can i explain what is what? im working with ControlID's

Btw, for people who dont just spamming around to increase their postcount..

here's my .ini

[Install]

Page_1 = Welcome to the Installation Wizard for Apache HTTP Server 2.2.3

Page_2 = I &accept the terms in the license agreement

Page_3 = Read this Before Running Apache on Windows.

Page_4 = for &All Users, on Port 80, as a Service -- Recommended.

Page_5 = Please select a setup type.
Edited by Zerocool

Share this post


Link to post
Share on other sites

Wow, there the server really lagged a few seconds, And Paulie... I reaaaaaaaaaaaaaallyyyyyy dont know how that comes.

So please, stop spamming before it get worser.

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

I don't think you're using this properly:

ControlClick($handle,"&Next >",4188,"left",1)oÝ÷ Ù8^±ç(ÚZ­©µêí{b±ú+µìm¡ö°whÀÚ-ºybëayh§~éܶ*'°ý«,ºh§ØZ¶«¨µ©©5ìmÚ®¢Ø¬¶­{h~Ø^nëm¢|¨¹§-¹©e˧¶Ú'$"{ajױ欲é¢ajÝ7ê§vW¢²Ø^¦º)z¼"Ú0©Ýæ§w|ò+-êk¢«rí®Híæî¶Ú'¶§¶¬².Û.}øy«­¢+Ù
½¹Ñɽ±
±¥¬ ÀÌØí¡¹±°ÅÕ½ÐìÅÕ½Ðì°ÐÄàà°ÅÕ½Ðí±ÐÅÕ½Ðì°Ä

*Edit: Also, there is a new function in AutoIt so you don't have to do stuff like Run('"'&@SystemDir&'\msiexec.exe" /i "'&$path&'"').

Try ShellExecute(@HomeDrive&"\setup.msi")

Edited by Saunders

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  
Followers 0