Jump to content

Program help!


Recommended Posts

I am kind of a newb at auto it and i was making a pro gram open for my self, but when i opened it and tried to open programs with it Firefox opened for everything. if someone could look at my code and tell me what i did wrong or how to fix it i would greatly appreciate it. Thanks in advance :D .

#NoTrayIcon
#include <GUIConstants.au3>

GUICreate("Prgram Opener", 280, 300)
GuiSetIcon ("C:\Documents and Settings\Bob\Desktop\Program Opener\Icon\ICON.ico")
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
GUICtrlCreateLabel("Which program Would you like to open?", 43, 13)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
GuiCtrlCreateGroup("Programs", 20, 30, 200, 250)
$ff = GuiCtrlCreateRadio("Firefox", 40, 50, 80)
$saf = GuiCtrlCreateRadio("Safari", 40, 70, 130)
$wmp = GuiCtrlCreateRadio("Windows Media Player", 40, 90, 130)
$aim = GuiCtrlCreateRadio("Aim 6", 40, 110, 130)
$word = GuiCtrlCreateRadio("Word", 40, 130, 130)
$np2 = GuiCtrlCreateRadio("Notepad2", 40, 150, 130)
$pb = GuiCtrlCreateRadio("PowerBatch", 40, 170, 130)
$sci = GuiCtrlCreateRadio("SciTE", 40, 190, 130)
$cmd = GuiCtrlCreateRadio("Command Prompt", 40, 210, 130)
$dd = GuiCtrlCreateRadio("Diner Dash", 40, 230, 130)
GUICtrlCreateGroup ("",-99,-99,1,1)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
$ok= GUICtrlCreateButton("Run", 20, 260, 200)
GUISetState(@SW_SHOW)

While 1 = 1
  $msg = GUIGetMsg()
  
  Select
    Case $msg = $ok and $ff
        Run("C:\Program Files\Mozilla Firefox\Firefox.exe")
        MsgBox (0, "Opening Program", "Program is opening...")
        
    Case $msg = $ok and $saf2
        Run ("C:\Program Files\Safari\safari.exe")
        MsgBox (0, "Opening Program", "Program is opening...")
        
    Case $msg = $ok and $wmp
        Run ("C:\Program Files\Windows Media Player\wmplayer.exe")
        MsgBox (0, "Opening Program", "Program is opening...")
        
    Case $msg = $ok and $aim
        Run ("C:\Program Files\AIM6\aim6.exe")
        MsgBox (0, "Opening Program", "Program is opening...")
        
    Case $msg = $ok and $word
        Run ("C:\Program Files\Microsoft Office\OFFICE11\winword.exe")
        MsgBox (0, "Opening Program", "Program is opening...")
        
    Case $msg = $ok and $np2
        Run ("C:\Program Files\notepad2\notepad2.exe")
        MsgBox (0, "Opening Program", "Program is opening...")
        
    Case $msg = $ok and $pb
        Run ("C:\Program Files\Astase\PowerBatch\powerbatch.exe")
        MsgBox (0, "Opening Program", "Program is opening...")
        
    Case $msg = $ok and $sci
        Run ("C:\Program Files\AutoIt3\SciTE\scite.exe")
        MsgBox (0, "Opening Program", "Program is opening...")
        
    case $msg = $ok and $cmd
        Run ("cmd.exe")
        MsgBox (0, "Opening Program", "Program is opening...")
        
    Case $msg = $ok and $dd
        Run ("C:\Program Files\Diner Dash Flo on the Go\diner dash - flo on the go.exe")
        MsgBox (0, "Opening Program", "Program is opening...")
        
    Case $msg = $GUI_EVENT_CLOSE
      
    ExitLoop
  EndSelect
WEnd
Link to comment
Share on other sites

#NoTrayIcon
#include <GUIConstants.au3>

GUICreate("Prgram Opener", 280, 300)
GuiSetIcon ("C:\Documents and Settings\Bob\Desktop\Program Opener\Icon\ICON.ico")
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
GUICtrlCreateLabel("Which program Would you like to open?", 43, 13)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
GuiCtrlCreateGroup("Programs", 20, 30, 200, 250)
$ff = GuiCtrlCreateRadio("Firefox", 40, 50, 80)
$saf = GuiCtrlCreateRadio("Safari", 40, 70, 130)
$wmp = GuiCtrlCreateRadio("Windows Media Player", 40, 90, 130)
$aim = GuiCtrlCreateRadio("Aim 6", 40, 110, 130)
$word = GuiCtrlCreateRadio("Word", 40, 130, 130)
$np2 = GuiCtrlCreateRadio("Notepad2", 40, 150, 130)
$pb = GuiCtrlCreateRadio("PowerBatch", 40, 170, 130)
$sci = GuiCtrlCreateRadio("SciTE", 40, 190, 130)
$cmd = GuiCtrlCreateRadio("Command Prompt", 40, 210, 130)
$dd = GuiCtrlCreateRadio("Diner Dash", 40, 230, 130)
GUICtrlCreateGroup ("",-99,-99,1,1)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
$ok= GUICtrlCreateButton("Run", 20, 260, 200)
GUISetState(@SW_SHOW)

While 1
  $msg = GuiGetMsg()
 
  Select 
      
    Case $msg = $ok
        If GuiCtrlRead($ff) = $GUI_CHECKED then; If the radio for firefox is selected..
            Run("C:\Program Files\Mozilla Firefox\Firefox.exe")
            MsgBox (0, "Opening Program", "Program is opening...")
        ElseIf GuiCtrlRead($saf) = $GUI_CHECKED then 
            Run ("C:\Program Files\Safari\safari.exe")
            MsgBox (0, "Opening Program", "Program is opening...")
        ElseIf GuiCtrlRead($wmp) = $GUI_CHECKED then 
            Run ("C:\Program Files\Windows Media Player\wmplayer.exe")
            MsgBox (0, "Opening Program", "Program is opening...")
        ElseIf GuiCtrlRead($aim) = $GUI_CHECKED then 
            Run ("C:\Program Files\AIM6\aim6.exe")
            MsgBox (0, "Opening Program", "Program is opening...")          
        ElseIf GuiCtrlRead($word) = $GUI_CHECKED then 
            Run ("C:\Program Files\Microsoft Office\OFFICE11\winword.exe")
            MsgBox (0, "Opening Program", "Program is opening...")
        ElseIf GuiCtrlRead($np2) = $GUI_CHECKED then 
            Run ("C:\Program Files\notepad2\notepad2.exe")
            MsgBox (0, "Opening Program", "Program is opening...")
        ElseIf GuiCtrlRead($pb) = $GUI_CHECKED then 
            Run ("C:\Program Files\Astase\PowerBatch\powerbatch.exe")
            MsgBox (0, "Opening Program", "Program is opening...")          
        ElseIf GuiCtrlRead($sci) = $GUI_CHECKED then 
            Run ("C:\Program Files\AutoIt3\SciTE\scite.exe")
            MsgBox (0, "Opening Program", "Program is opening...")      
        ElseIf GuiCtrlRead($cmd) = $GUI_CHECKED then 
            Run ("cmd.exe")
            MsgBox (0, "Opening Program", "Program is opening...")
        ElseIf GuiCtrlRead($dd) = $GUI_CHECKED then 
            Run ("C:\Program Files\Diner Dash Flo on the Go\diner dash - flo on the go.exe")
            MsgBox (0, "Opening Program", "Program is opening...")
        EndIf
        
    Case $msg = $GUI_EVENT_CLOSE
      
        ExitLoop
  EndSelect
WEnd
I think you're problem was that you were expecting $msg to be two things, which doesn't happen... The $msg would just be that $ok was pressed. Then you have to find out which one is selected and do the appropiate action... If you don't understand anything in my code please ask.

My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list]
Link to comment
Share on other sites

#NoTrayIcon
#include <GUIConstants.au3>

GUICreate("Prgram Opener", 280, 300)
GuiSetIcon ("C:\Documents and Settings\Bob\Desktop\Program Opener\Icon\ICON.ico")
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;



;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
GUICtrlCreateLabel("Which program Would you like to open?", 43, 13)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;



;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
GuiCtrlCreateGroup("Programs", 20, 30, 200, 250)
$ff = GuiCtrlCreateRadio("Firefox", 40, 50, 80)
$saf = GuiCtrlCreateRadio("Safari", 40, 70, 130)
$wmp = GuiCtrlCreateRadio("Windows Media Player", 40, 90, 130)
$aim = GuiCtrlCreateRadio("Aim 6", 40, 110, 130)
$word = GuiCtrlCreateRadio("Word", 40, 130, 130)
$np2 = GuiCtrlCreateRadio("Notepad2", 40, 150, 130)
$pb = GuiCtrlCreateRadio("PowerBatch", 40, 170, 130)
$sci = GuiCtrlCreateRadio("SciTE", 40, 190, 130)
$cmd = GuiCtrlCreateRadio("Command Prompt", 40, 210, 130)
$dd = GuiCtrlCreateRadio("Diner Dash", 40, 230, 130)
GUICtrlCreateGroup ("",-99,-99,1,1)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;



;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
$ok= GUICtrlCreateButton("Run", 20, 260, 200)
GUISetState(@SW_SHOW)

While 1
  $msg = GuiGetMsg()
 
  Select 
      
    Case $msg = $ok
        If GuiCtrlRead($ff) = $GUI_CHECKED then; If the radio for firefox is selected..
            Run("C:\Program Files\Mozilla Firefox\Firefox.exe")
            MsgBox (0, "Opening Program", "Program is opening...")
        ElseIf GuiCtrlRead($saf) = $GUI_CHECKED then 
            Run ("C:\Program Files\Safari\safari.exe")
            MsgBox (0, "Opening Program", "Program is opening...")
        ElseIf GuiCtrlRead($wmp) = $GUI_CHECKED then 
            Run ("C:\Program Files\Windows Media Player\wmplayer.exe")
            MsgBox (0, "Opening Program", "Program is opening...")
        ElseIf GuiCtrlRead($aim) = $GUI_CHECKED then 
            Run ("C:\Program Files\AIM6\aim6.exe")
            MsgBox (0, "Opening Program", "Program is opening...")          
        ElseIf GuiCtrlRead($word) = $GUI_CHECKED then 
            Run ("C:\Program Files\Microsoft Office\OFFICE11\winword.exe")
            MsgBox (0, "Opening Program", "Program is opening...")
        ElseIf GuiCtrlRead($np2) = $GUI_CHECKED then 
            Run ("C:\Program Files\notepad2\notepad2.exe")
            MsgBox (0, "Opening Program", "Program is opening...")
        ElseIf GuiCtrlRead($pb) = $GUI_CHECKED then 
            Run ("C:\Program Files\Astase\PowerBatch\powerbatch.exe")
            MsgBox (0, "Opening Program", "Program is opening...")          
        ElseIf GuiCtrlRead($sci) = $GUI_CHECKED then 
            Run ("C:\Program Files\AutoIt3\SciTE\scite.exe")
            MsgBox (0, "Opening Program", "Program is opening...")      
        ElseIf GuiCtrlRead($cmd) = $GUI_CHECKED then 
            Run ("cmd.exe")
            MsgBox (0, "Opening Program", "Program is opening...")
        ElseIf GuiCtrlRead($dd) = $GUI_CHECKED then 
            Run ("C:\Program Files\Diner Dash Flo on the Go\diner dash - flo on the go.exe")
            MsgBox (0, "Opening Program", "Program is opening...")
        EndIf
        
    Case $msg = $GUI_EVENT_CLOSE
      
        ExitLoop
  EndSelect
WEnd
I think you're problem was that you were expecting $msg to be two things, which doesn't happen... The $msg would just be that $ok was pressed. Then you have to find out which one is selected and do the appropiate action... If you don't understand anything in my code please ask.

Thanks for the help . i have one question though. does the GUIctrlread() = $GUI_checked then

just check to see if the radio button is checked?

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