Jump to content

While statement in a Switch/Array Help


Recommended Posts

What does the whole code look like now? The code I posted (whole thing) works and the buttons work too...

The version I posted a long time ago worked for me too. But with a modified $ConfigINI path because I didn't want to recreate his. Something has been wrong with that path every since on his end.

:)

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

  • Replies 44
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

#include <GUIConstants.au3>
#include <Constants.au3>
#include <array.au3>

;Set Vars
Global $ConfigINI = @ScriptDir & "\Glaunch\Launcher Files\Info Files\Config.ini"
MsgBox(64, "Debug", $ConfigINI) ; <-- Temporary debug message
Global $ver = IniRead($ConfigINI, "Version", "ver", "Not Found")
Global $Progs = IniRead($ConfigINI, "Progs", "num", "Not Found")
MsgBox(64, "Debug", "$ver = " & $ver & @CRLF & "$Progs = " & $Progs) ; <-- Temporary debug message
Global $Program_[$Progs + 1] ; Array to hold button control IDs
Global $Name_ = IniReadSection($ConfigINI, "Name")
_ArrayDisplay($Name_, "Name_") ; <-- Temporary debug message
Global $Path_ = IniReadSection($ConfigINI, "Path")
_ArrayDisplay($Path_, "Path_") ; <-- Temporary debug message

;Create Window
MsgBox(64, "Debug", "$Progs = " & $Progs) ; <-- Add this line to see if it is reading $Progs correctly
If $Progs > 0 Then
    $i = 1 ; program number
    $s = 80 ; top of buttons
    $MainWindow = GUICreate("Game Launcher v1.0", 415, 290)
    $Tab1 = GUICtrlCreateTab(0, 0, 417, 273)
    $Programs = GUICtrlCreateTabItem("Games");===>Games Tab
    Do
        $Program_[$i] = GUICtrlCreateButton($Name_[$i][1], 237, $s, 120, 17)   ;<==== Problem 1
        MsgBox(64, "Debug", "$Path = " & $Path_[$i][1]) ; <-- Add this line to see if it is reading $Path correctly
        $i = $i + 1
        $s = $s + 20
    Until $i > $Progs
    GUISetState(@SW_SHOW)

    ;Launch a Program
    While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
            Case $GUI_EVENT_CLOSE
                Exit
            Case $GUI_EVENT_MINIMIZE
                GUISetState(@SW_HIDE)
            ;Case $Exit  <===== Problem 2
                ExitLoop
        EndSwitch
        For $p = 1 To $Progs
            If $nMsg = $Program_ Then
                Run($Path_)
                Sleep(3000)
                ExitLoop
            EndIf
        Next
    WEnd
EndIf

IT WORKSSSSS!! Thanks so much for all your help guys. no i just have to play with positioning and making the buttons actually do something.

Posted Image

Edited by Mast3rpyr0
Link to comment
Share on other sites

wow after that part i feel like Autoit is my native language lol

EDIT: Oops one more thing, If i have a menu like the one at the top of every windows GUI, how can i have an option when clicked goto a tab

Heres my guess:

;Tab initialize

$Tab2 = GUICtrlCreateTab(0, 0, 417, 273) ;Create Tab

;In a switch

Case $Setup
    $Tab2
Edited by Mast3rpyr0
Link to comment
Share on other sites

You need to look closer at the various tab control commands, including the _GuiCtrlTab* series from GuiTab.au3. You don't select the tab, you select the TabItem in the tab. The control to do that is _GUICtrlTabSetCurSel(). Check out the demo script in the help file for that command.

:)

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