Jump to content

Help A Noob


Recommended Posts

im new to this programming stuff and i was trying to make a gui to help me with tasks like system restore and defrag. theres probly one alrdy made but i want to try to learn by making this. i need to know how to run a file like defrag after a radio has been clicked. this is wat i have so far.

; ----------------------------------------------------------------------------
;
; Windows XP Help Script by BlueSmoke_ScR AkA Bounda, Bounder, LILELWOOD423
; Script Function:
;   To teach XP and Optimize performance.
;
; ----------------------------------------------------------------------------

#include <GUIConstants.au3>

GuiCreate("Windows XP Help", 500, 100)
$Frag = GuiCtrlCreateRadio("Defragment", 10, 10)
$Help = GuiCtrlCreateRadio("Teach", 10, 30)
$Res = GuiCtrlCreateRadio("System Restore", 10, 50)
$Set = GuiCtrlCreateRadio("Display Computer Information", 10, 70)
GuiSetState()
While GuiGetMsg() <> $GUI_EVENT_CLOSE
WEnd

If $frag = $GUI_CHECKED Then
 Run Cmd
Endif
Link to comment
Share on other sites

aight i did the syntax in my script which now looks like this

; ----------------------------------------------------------------------------
;
; Windows XP Help Script by BlueSmoke_ScR AkA Bounda, Bounder, LILELWOOD423
; Script Function:
;   To teach XP and Optimize performance.
;
; ----------------------------------------------------------------------------

#include <GUIConstants.au3>

GuiCreate("Windows XP Help", 500, 100)
$Frag = GuiCtrlCreateRadio("Defragment", 10, 10)
$Help = GuiCtrlCreateRadio("Teach", 10, 30)
$Res = GuiCtrlCreateRadio("System Restore", 10, 50)
$Set = GuiCtrlCreateRadio("Display Computer Information", 10, 70)
GuiSetState()
While GuiGetMsg() <> $GUI_EVENT_CLOSE
WEnd

If $frag = $GUI_CHECKED Then
 Run("Disk Defragmenter.exe", "", @SW_MAXIMIZE)
Endif

same as last time. when i click radio button nothing happens. is there something i have to add?

Link to comment
Share on other sites

aight i did the syntax in my script which now looks like this

; ----------------------------------------------------------------------------
;
; Windows XP Help Script by BlueSmoke_ScR AkA Bounda, Bounder, LILELWOOD423
; Script Function:
;   To teach XP and Optimize performance.
;
; ----------------------------------------------------------------------------

#include <GUIConstants.au3>

GuiCreate("Windows XP Help", 500, 100)
$Frag = GuiCtrlCreateRadio("Defragment", 10, 10)
$Help = GuiCtrlCreateRadio("Teach", 10, 30)
$Res = GuiCtrlCreateRadio("System Restore", 10, 50)
$Set = GuiCtrlCreateRadio("Display Computer Information", 10, 70)
GuiSetState()
While GuiGetMsg() <> $GUI_EVENT_CLOSE
WEnd

If $frag = $GUI_CHECKED Then
 Run("Disk Defragmenter.exe", "", @SW_MAXIMIZE)
Endif

same as last time. when i click radio button nothing happens. is there something i have to add?

Your While loop is lacking sustenance.

$Button = GuiCtrlCreateButton ([buttonstuff]); need a "go" button
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        Exit
    Case $msg = $Button; which you should add
       ButtonPressed()
    EndSelect
WEnd

Func ButtonPressed()
    If GuiCtrlRead ($Frag) = $GUI_CHECKED Then
       ; Do fraggy stuff
    ElseIf GuiCtrlRead ($Help) = $GUI_CHECKED Then
       ; Helpful stuff
    ElseIf GuiCtrlRead ($Res) = $GUI_CHECKED Then
       ; Res stuff
    ElseIf GuiCtrlRead ($Set) = $GUI_CHECKED Then
       ; Whatever needs to go here
    Else
        MsgBox (0, "Err", "Please check an option first.")
    EndIf
EndFunc

Might be some errors in there, I wrote it in the box and didn't check anything.

Link to comment
Share on other sites

; ----------------------------------------------------------------------------
;
; Windows XP Help Script by BlueSmoke_ScR AkA Bounda, Bounder, LILELWOOD423
; Script Function:
;   To teach XP and Optimize performance.
;
; ----------------------------------------------------------------------------

#include <GUIConstants.au3>

GuiCreate("Windows XP Help", 500, 100)
$Frag = GuiCtrlCreateRadio("Defragment", 10, 10)
$Help = GuiCtrlCreateRadio("Teach", 10, 30)
$Res = GuiCtrlCreateRadio("System Restore", 10, 50)
$Set = GuiCtrlCreateRadio("Display Computer Information", 10, 70)
$Button = GuiCtrlCreateButton ("Go", 100, 10); need a "go" button
GuiSetState()
While GuiGetMsg() <> $GUI_EVENT_CLOSE
WEnd

While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        Exit
    Case $msg = $Button; which you should add
       ButtonPressed()
    EndSelect
WEnd

Func ButtonPressed()
    If GuiCtrlRead ($Frag) = $GUI_CHECKED Then
       Run("Disk Defragmenter.exe")
    ElseIf GuiCtrlRead ($Help) = $GUI_CHECKED Then
      ; Helpful stuff
    ElseIf GuiCtrlRead ($Res) = $GUI_CHECKED Then
      ; Res stuff
    ElseIf GuiCtrlRead ($Set) = $GUI_CHECKED Then
      ; Whatever needs to go here
    Else
        MsgBox (0, "Err", "Please check an option first.")
    EndIf
EndFunc

Link to comment
Share on other sites

Your other while loop was in the way. This works:

; ----------------------------------------------------------------------------
;
; Windows XP Help Script by BlueSmoke_ScR AkA Bounda, Bounder, LILELWOOD423
; Script Function:
;   To teach XP and Optimize performance.
;
; ----------------------------------------------------------------------------

#include <GUIConstants.au3>

GuiCreate("Windows XP Help", 500, 100)
$Frag = GuiCtrlCreateRadio("Defragment", 10, 10)
$Help = GuiCtrlCreateRadio("Teach", 10, 30)
$Res = GuiCtrlCreateRadio("System Restore", 10, 50)
$Set = GuiCtrlCreateRadio("Display Computer Information", 10, 70)
$Button = GuiCtrlCreateButton ("Go", 100, 10); need a "go" button
GuiSetState()


While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        Exit
    Case $msg = $Button; which you should add
       ButtonPressed()
    EndSelect
WEnd

Func ButtonPressed()
    If GuiCtrlRead ($Frag) = $GUI_CHECKED Then
       Run("Disk Defragmenter.exe")
    ElseIf GuiCtrlRead ($Help) = $GUI_CHECKED Then
      MsgBox (0, "help", "help checked")
    ElseIf GuiCtrlRead ($Res) = $GUI_CHECKED Then
      MsgBox (0, "res", "Res checked")
    ElseIf GuiCtrlRead ($Set) = $GUI_CHECKED Then
      MsgBox (0, "Set", "Set checked")
    Else
        MsgBox (0, "Err", "Please check an option first.")
    EndIf
EndFunc

Also, you're going to want the full path to the exe that you're trying to run, otherwise it probably won't find it.

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