Sign in to follow this  
Followers 0
RogerDat

Help needed with installation script

4 posts in this topic

Hello everyone!

Thank you, this is good forum and helped me alot with Autoit scripting. Now I'm stuck, cant go on. My script is basically working, but when OS is set to WIN_VISTA or WIN_7 it will not show the Vista-menu or 7-menu for me. I got one menu for all OS's, and each of them has "own menu" (for each OS).

With XP I got this right, but VISTA or 7 it wont work. Any help? Thank you!

#include <GUIConstantsEx.au3>
#include <GuiTab.au3>
#Include<WindowsConstants.au3>
;;#requireadmin

Global $Frm_XP, $Frm_Vista, $Gw = 450, $Gh = 600
$seppover = "1.0"
Opt("GUICoordMode", 2)

;;$sMode = @OSVersion
$sMode = "WIN_VISTA"
If $sMode = "WIN_XP" Then
    $sMode2 = "XP:lle"
ElseIf $sMode = "WIN_VISTA" Then
    $sMode2 = "Vistalle"
Elseif $sMode = "WIN_7" Then
    $sMode2 = "Seiskalle"
EndIf

$kansio = @WorkingDir

Interface()

Func Interface()

    $Frm_Main = GUICreate("SEPPO " & $seppover, $Gw, $Gh)
    GUISetBkColor(0xe0f1d1)
    $Lbl_Os = GUICtrlCreateLabel("Valitse asennettavat sovellukset", 10, 10, 380, 20, 0x01)
    $Lbl_ver = GUICtrlCreateLabel("VER: " & $seppover, -170, 365)
    $Lbl_kayttis = GUICtrlCreateLabel("OS: " & $sMode, -1, 5)
    $Lbl_dirri = GUICtrlCreateLabel("DIR: " & $kansio, -1, 5)
    GUICtrlSetFont($Lbl_Os, 9, 600)
    GUISetCoord($Gw/2 -30, $Gh -35)
    $asenna = GUICtrlCreateButton("Asenna", -1, -1, 60, 25)
    GUISetState()
    $Frm_Ctrls = GUICreate("Controls",$Gw -20, $Gh -90, 10, 40, $WS_CHILD, -1, $Frm_Main)
        
    ;;;This menu for ALL OS's
    
    GUICtrlCreateLabel("Kaikille käyttöjärjestelmille:", 20, 30, 150)
    GUICtrlSetFont(-1, 9, 400, 4)
    GUISetBkColor(0xe0f1d1)
    $seiskazip = GUICtrlCreateCheckbox("7zip", -1, 10)
    $adobereader = GUICtrlCreateCheckbox("Acrobat Reader", -1, 10)
    $cdburnerxp = GUICtrlCreateCheckbox("CDBurnerXP", -1, 10)
    $dopdf = GUICtrlCreateCheckbox("doPDF", -1, 10)
    $firefox = GUICtrlCreateCheckbox("Firefox", -1, 10)
    $flash = GUICtrlCreateCheckbox("Flash player", -1, 10)
    $java = GUICtrlCreateCheckbox("Java", -1, 10)
    $openoffice = GUICtrlCreateCheckbox("OpenOffice", -1, 10)
    $shockwave = GUICtrlCreateCheckbox("Shockwave player", -1, 10)
    $teamviewer = GUICtrlCreateCheckbox("TeamViewer", -1, 10)
    $vlc = GUICtrlCreateCheckbox("VLC", -1, 10)
    $wmp = GUICtrlCreateCheckbox("WMP plugin", -1, 10)
    
    ;;GUICtrlCreateLabel($sMode, -1, 30)
    
    ;;;This is XP's extramenu
    $XPstart = GUICtrlCreateDummy()
    GUICtrlCreateLabel("Vain XP:lle:", 30, -392, 200)
    GUICtrlSetFont(-1, 9, 400, 4)
    $dotnet35sp1 = GUICtrlCreateCheckbox(".NET 3.5 SP1", -1, 10)
    $aktivoixp = GUICtrlCreateCheckbox("Aktivointi", -1, 10)
    $ie8 = GUICtrlCreateCheckbox("Internet Explorer 8", -1, 10)
    $oeminfo = GUICtrlCreateCheckbox("OEM info", -1, 10)
    $pikkusalat = GUICtrlCreateCheckbox("Pikkusälät (IE aloitussivu + suosikki)", -1, 10)
    $wmp11 = GUICtrlCreateCheckbox("Windows Media Player 11", -1, 10)
    $XPend = GUICtrlCreateDummy()

    ;;;This is Vista's extramenu
    $Vistastart = GUICtrlCreateDummy()
    GUICtrlCreateLabel("Vain Vistalle:", 30, -392, 200)
    GUICtrlSetFont(-1, 9, 400, 4)
    $dotnet20 = GUICtrlCreateCheckbox(".NET 2.0", -1, 10)   
    $Vistaend = GUICtrlCreateDummy()
    
    ;;;This is W7's extramenu
    $Seiskastart = GUICtrlCreateDummy()
    GUICtrlCreateLabel("Vain Seiskalle:", 30, -392, 200)
    GUICtrlSetFont(-1, 9, 400, 4)
    ;;$dotnet20 = GUICtrlCreateCheckbox(".NET 2.0", -1, 10) 
    $Seiskaend = GUICtrlCreateDummy()

For $i = $seiskazip To $Seiskaend
        GUICtrlSetState($i, $GUI_CHECKED)
    Next

    GUISetState()

    If $sMode = "WIN_XP" Then
        For $i = $Vistastart To $Vistaend
            GUICtrlSetState($i, BitOR($GUI_UNCHECKED, $GUI_HIDE))
        Next
        For $i = $Seiskastart To $Seiskaend
            GUICtrlSetState($i, BitOR($GUI_UNCHECKED, $GUI_HIDE))
        Next
    EndIf

    If $sMode = "WIN_VISTA" Then
        For $i = $Seiskastart To $Seiskaend
            GUICtrlSetState($i, BitOr($GUI_UNCHECKED, $GUI_HIDE))
        Next
        For $i = $XPstart To $XPend
            GUICtrlSetState($i, BitOr($GUI_UNCHECKED, $GUI_HIDE))
        Next
    EndIf
    
    If $sMode = "WIN_7" Then
        For $i = $Vistastart To $Vistaend
            GuiCtrlSetState($i, BitOr($GUI_UNCHECKED, $GUI_HIDE))
        Next
        For $i = $XPstart To $XPend
            GUICtrlSetState($i, BitOr($GUI_UNCHECKED, $GUI_HIDE))
        Next
    EndIf

    While 1
        $vastaus = GUIGetMsg()
        Switch $vastaus
            Case $GUI_EVENT_CLOSE
                ExitLoop
            Case $asenna
                If BitAND(GUICtrlRead($seiskazip), $gui_checked) Then seiskazip()
                If BitAND(GUICtrlRead($adobereader), $gui_checked) Then adobereader()
                If BitAND(GUICtrlRead($dopdf), $gui_checked) Then dopdf()
        EndSwitch
    WEnd


EndFunc   ;==>Interface

Func seiskazip()
        ;; ShellExecuteWait("7Zip.bat")
        RunWait(@COMSPEC & " /c 7zip.bat", @WorkingDir)
        ;; I would actually change this to ShellExecuteWait("7Zip.bat") but that choice is yours to make
EndFunc

Func adobereader()
        ;; ShellExecuteWait("acroread.bat")
        RunWait(@COMSPEC & " /c acroread.bat", @WorkingDir)
EndFunc

Func dopdf()
    MsgBox(0, "TEST", "Function dopdf")
EndFunc

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

For start you can do your OSVersion test like this

$sMode=@OSVersion
Switch $sMode
    Case "WIN_XP", "WIN_XPe"
        $sMode2 = "XP:lle"
    Case "WIN_VISTA"
        $sMode2 = "Vistalle"
    Case "WIN_7"
        $sMode2 = "Seiskalle"
EndSwitch
Edited by wakillon

AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Share this post


Link to post
Share on other sites

Thank you, but I just noticed that I dont need that OSversion test. But the problem is still, if OS is Vista or 7, it wont give that extramenu.

Trying to find error.

Share this post


Link to post
Share on other sites

Wonderful, I got it work!

Problem was location of 7's and Vista's menus, they werent on the screen :unsure:

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