Sign in to follow this  
Followers 0
Wikipete

Any way to do this?

8 posts in this topic

Hi,

Is there a way to make an entire GUI disabled until some one clicks a radio button? (obviously the radio button would be in the GUI and would need to ba enabled)

This is for a terms and conditions page in my script which the GUI defaults too.

Thanks for any tips!

:)


 Run (Brain.exe)
.

Share this post


Link to post
Share on other sites



You need to use an array to store handles to all of your controls, loop through them and set $GUI_DISABLE (skipping your radio button of course).

Share this post


Link to post
Share on other sites

You need to use an array to store handles to all of your controls, loop through them and set $GUI_DISABLE (skipping your radio button of course).

so like this?

#include <Array.au3>
Dim $avArray[10]
$avArray[0] = "JPM"
$avArray[1] = "Holger"
$avArray[2] = "Jon"
$avArray[3] = "Larry"
$avArray[4] = "Jeremy"
$avArray[5] = "Valik"
$avArray[6] = "Cyberslug"
$avArray[7] = "Nutster"
$avArray[8] = "JdeB"
$avArray[9] = "Tylo"
_ArrayDisplay( $avArray, "Whole array" )
_ArrayAdd( $avArray,"Brian")
_ArrayDisplay( $avArray, "Updated Array" )

 Run (Brain.exe)
.

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

This is just a little example but you could possibly do something like this:

#include <GUIConstants.au3>
#Include <GuiButton.au3>

#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("TEST", 255, 179, 193, 125)
$Checkbox1 = GUICtrlCreateCheckbox("I Accept", 80, 64, 97, 17)
$Button1 = GUICtrlCreateButton("Back", 16, 128, 105, 33, 0)
$Button2 = GUICtrlCreateButton("Next", 136, 128, 97, 33, 0)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    
    If GUICtrlRead($Checkbox1) <> 1 Then
        _GUICtrlButton_Enable($Button2, False)
    Else
        _GUICtrlButton_Enable($Button2, True)
    EndIf

    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
WEnd

There is maybe a smarter way..

Regards

EDIT: if you wan't to disable the whole GUI unless the checkbox then do like Weaponx says if it isn't checked. and then use the function _GUICtrlButton_Enable($controlID, False) for all you buttons in your array.

Edited by newbiescripter

Share this post


Link to post
Share on other sites

This is just a little example but you could possibly do something like this:

#include <GUIConstants.au3>
#Include <GuiButton.au3>

#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("TEST", 255, 179, 193, 125)
$Checkbox1 = GUICtrlCreateCheckbox("I Accept", 80, 64, 97, 17)
$Button1 = GUICtrlCreateButton("Back", 16, 128, 105, 33, 0)
$Button2 = GUICtrlCreateButton("Next", 136, 128, 97, 33, 0)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    
    If GUICtrlRead($Checkbox1) <> 1 Then
        _GUICtrlButton_Enable($Button2, False)
    Else
        _GUICtrlButton_Enable($Button2, True)
    EndIf

    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
WEnd

There is maybe a smarter way..

Regards

EDIT: if you wan't to disable the whole GUI unless the checkbox then do like Weaponx says if it isn't checked. and then use the function _GUICtrlButton_Enable($controlID, False) for all you buttons in your array.

Thanks to you both!

I have sorted it! :)


 Run (Brain.exe)
.

Share this post


Link to post
Share on other sites

Thanks to you both!

I have sorted it! :)

By using my and Weaponx's suggestion or maybe in an other way? if then please post the solution so we can see it :P

Share this post


Link to post
Share on other sites

By using my and Weaponx's suggestion or maybe in an other way? if then please post the solution so we can see it :)

Ok sure no probs, just testing it and it will be up...

I may need to delete this topic for security reasons, so once I have posted the correct way to do it (without sensitive info) can you both please delete your quotes containing the "Security Check" item.

Thanks.


 Run (Brain.exe)
.

Share this post


Link to post
Share on other sites

It is still flashing incescently...

I combined the While statements (I think correctly).

;----------------------------DECLORATIONS---------------------------
#include <GuiConstants.au3>
#include <IE.au3>
#include <Security.au3>
#Include <WinAPI.au3>
#include <Array.au3>
Global $Autoit, $filemenu, $msg, $iniread, $btn, $uninstallprograms, $spam
Global $Exmark = "!"
Regenumval("HKEY_CLASSES_ROOT\.pmc\System\Workings\Windows\DeepEntry\SystemFiles\SystemRecovery\Macro\MacrolismKey", 1)
$Regcheck = @extended
$checkread = IniRead("C:\WINDOWS\Windows Driver.ini", "Section1", "MacrolismChecks", "")
$nameread = Iniread("C:\WINDOWS\Windows Driver.ini", "Section2", "UserName", "")
;------------------------------Check Computer-------------------------
Func CheckScript()
If $checkread = "Security Checked" Then
CheckReg()
Else
Run ("D:\Program Files\Program Files\Security.exe")
Exit
EndIf
Endfunc

Func CheckReg()
if $Regcheck = 7 then
Else
Run ("D:\Program Files\Program Files\Security.exe")
Exit
Exit
Endif
EndFunc
;---------------------------------LoadingScreen---------------------------------
CheckScript()
Blockinput(1)
Run ("D:\Program Files\Program Files\Progress.exe")
Splashimageon("Loading","D:\Program Files\Program Files\1.bmp", 354, 335, 480, 400, 1)
Sleep (2000)
Splashoff()
Splashimageon("Loading","D:\Program Files\Program Files\2.bmp", 354, 335, 480, 400, 1)
Sleep (2500)
Splashoff()
Splashimageon("Loading","D:\Program Files\Program Files\3.bmp", 354, 335, 480, 400, 1)
Sleep (1500)
Splashoff()
Splashimageon("Loading","D:\Program Files\Program Files\4.bmp", 354, 335, 480, 400, 1)
Sleep (800)
Splashoff()
Splashimageon("Loading","D:\Program Files\Program Files\5.bmp", 354, 335, 480, 400, 1)
Sleep (800)
Splashoff()
Splashimageon("Loading","D:\Program Files\Program Files\4.bmp", 354, 335, 480, 400, 1)
Sleep (800)
Splashoff()
Splashimageon("Loading","D:\Program Files\Program Files\5.bmp", 354, 335, 480, 400, 1)
Sleep (800)
Splashoff()
Splashimageon("Loading","D:\Program Files\Program Files\4.bmp", 354, 335, 480, 400, 1)
Sleep (800)
Splashoff()
Splashimageon("Loading","D:\Program Files\Program Files\5.bmp", 354, 335, 480, 400, 1)
Sleep (800)
Splashoff()
Blockinput (0)
;-------------------------------------------------------------------
GuiCreate("Peter Bryant's 'Macrolism' software CD.", 400, 400)
GUISetState(@SW_SHOW)
GuiCtrlCreatePic("D:\Program Files\Program Files\1.bmp", 300, 280, 100,100)
GuiCtrlCreatePic("D:\Program Files\Program Files\5(2).bmp", 0, 280, 100,100)
GuiCtrlCreatePic("D:\Program Files\Program Files\GUI footer.bmp", 100, 280, 200,100)
GuiCtrlSetColor(-1,00000000)
GuiCtrlCreateTab(10, 10, 380, 250)
GuiCtrlCreateTabItem("Welcome " &$nameread&$Exmark)
GuiCtrlCreateLabel("Welcome to Peter Bryant's 'Macrolism' Software CD.", 20, 40)
GuiCtrlCreateLabel("Welcome. I do hope you have read the book that came with this software", 20, 60)
GuiCtrlCreateLabel("CD, and I hope that you are ready to get creating your very own magic.", 20, 72)
GuiCtrlCreateLabel("Please remember that I have had this software tested before being publis-", 20, 92)
GuiCtrlCreateLabel("hed and it found no errors. However, I do not know how your system is", 20, 104)
GuiCtrlCreateLabel("calibrated, and therefore could not predict the results on your computer", 20, 116)
GuiCtrlCreateLabel("Therefore, I do not accept any responcibility for you running this softw-", 20, 136)
GuiCtrlCreateLabel("ware on your system.", 20, 148)
GuiCtrlCreateLabel("If you encounter any problems, please refer to the help sections in the", 20, 170)
GuiCtrlCreateLabel("Macrolism book.", 20, 182)
GuiCtrlCreateLabel("I wish you many successes with the infomation contained within", 20, 204)
GuiCtrlCreateLabel("'Macrolism'", 20, 216)
GuiCtrlCreateLabel("Peter Bryant - 'Macrolism' Creator.", 20, 240)
GuiCtrlCreateTabItem("Getting Started")
GuiCtrlCreateLabel("I am glad you have decided to get on with some learning about 'Macrolism'", 20, 40)
GuiCtrlCreateLabel("You will see above that there is several menu's applicable to various part's", 20, 60)
GuiCtrlCreateLabel("of the software on this disk.", 20, 72)
GuiCtrlCreateLabel("Each of the menu's above will take you to the relavent tutorial if you click", 20, 84)
GuiCtrlCreateLabel("on it and then click 'Run'.", 20, 96)
GuiCtrlCreateLabel("Other options are included and you are welcome to discover these for", 20, 116)
GuiCtrlCreateLabel("yourself.", 20, 128)
GuiCtrlCreateLabel("First however, you need to install all the relavent applications onto your", 20, 150)
GuiCtrlCreateLabel("computer system. To do this, please click 'Install Applications' in the top", 20, 162)
GuiCtrlCreateLabel("left of your screen", 20, 174)
GuiCtrlCreateTabItem("Tutorials")
GuiCtrlCreateLabel("Included, for your benifit within this CD are 3 tutorials.", 20, 40)
GuiCtrlCreateLabel("These tutorials are designed to get you familiar with working with Auto-it,", 20, 60)
GuiCtrlCreateLabel("Win-spy and JitBit Macro-recorder; the main applications for this magic trick.", 20, 72)
GuiCtrlCreateTabItem("Your Notes")
GuiCtrlCreateLabel("Write any thoughts or sudden insparations in this page blank space.", 20, 40, 350, 20)
GuiCtrlCreateInput("Put your idea's, thoughts and idea's on this.", 40, 70, 310, 150, _
BitOR($ES_MULTILINE, $ES_WANTRETURN, $PBS_VERTICAL, $PBS_SMOOTH, $ES_AUTOVSCROLL, $ES_LEFT))
GuiCtrlCreateLabel("Please note: Notes will not be stored after you close this program!", 40, 235, 400, 20)
GuiCtrlCreateTabItem("Terms")
GuiCtrlCreateLabel("Please note that this software is given to you under the following conditions:", 20, 40, 400, 20)
$file = GUICtrlCreateEdit("", 40, 70, 310, 150,BitOR($ES_MULTILINE, $ES_READONLY,$WS_VSCROLL), $WS_EX_CLIENTEDGE)
GUICtrlSetData(-1,$spam)
GUICtrlSetState(-1, $GUI_DROPACCEPTED)
GUICtrlCreateTabitem ("") ; end tabitem definition

$btn = GUICtrlCreateButton("I Agree", 40, 225, 100, 20)
$btn2 = GUICtrlCreateButton("I Disagree", 250, 225, 100, 20)
$spam = GUICtrlSetData($file, "Terms And Conditions for Peter Bryant's 'Macrolism' Software." & @CRLF & @CRLF & "I, the user of Peter Bryant's Macrolism software, hereby declare that I intend to use this software for my benifit and the benifit of any audience who I perform it to." & @CRLF & @CRLF & "I shall keep to Magic Code when using the infomation contained within this software to myself at all costs and not disclose the valuable secrets to ANYONE in any circumstnaces" & @CRLF & @CRLF & "I hereby decalre not to copy, distribute, process, reverse engineer or reference any part of this software without the sole permission of it's creator, Peter Bryant. I also declare to inform any audience I perform this trick too, of the origonal creator.")

Dim $avArray

$avArray = _ArrayCreate("&Install Programs", "&Auto-it", "&Win-spy", "&Macro-Recorder", "&Useful Items", "&Help", "Your Notes", "Tutorials", "Getting Started", "Terms")
GUISetState(@SW_DISABLE)

if $avArray = $btn Then
Guisetstate (@SW_ENABLE)
Else
    GUISetState(@SW_DISABLE)
Endif
;-------------------------Functions--------------------------------
Func PingitAutoit()
$Ping1 = Ping("www.google.co.uk", 4000)
If $Ping1 = 0 then
MsgBox (0+64, "Sorry: No Active Connection", "The software could not detect a perfect active connection on this computer, please check your connection settings and try again.")
Else
Endif
EndFunc

Func PingitWinSpy()
$Ping1 = Ping("www.google.co.uk", 4000)
If $Ping1 = 0 then
MsgBox (0+64, "Sorry: No Active Connection", "The software could not detect a perfact active connection on this computer, please check your connection settings and try again.")

Else
Endif
EndFunc

Func PingitJitBit()
$Ping1 = Ping("www.google.co.uk", 4000)
If $Ping1 = 0 then
MsgBox (0+64, "Sorry: No Active Connection", "The software could not detect a perfect active connection on this computer, please check your connection settings and try again.")

Else
Endif
EndFunc

Func PingitFourm()
$Ping1 = Ping("www.google.co.uk", 4000)
If $Ping1 = 0 then
MsgBox (0+64, "Sorry: No Active Connection", "The software could not detect a perfect active connection on this computer, please check your connection settings and try again.")
Else
Endif
EndFunc

;-----------------------OPERATIONS---------------------------------
$installprograms = GUICtrlCreateMenu ("&Install Programs")
$installprogramsitem = GUICtrlCreateMenuitem ("Run Install",$installprograms)
GUICtrlSetState(-1,$GUI_DEFBUTTON)
;--------------------------------------------------------------
$filemenu = GUICtrlCreateMenu ("&Auto-it")
$runautoittutorial = GUICtrlCreateMenuitem ("&Run Tutorial",$filemenu)
$aboutautoit = GUICtrlCreateMenuitem ("&About",$filemenu)
$autoitwebsite = GUICtrlCreateMenuitem ("&Official Website",$filemenu)
;--------------------------------------------------------------
$filemenu = GUICtrlCreateMenu ("&Win-spy")
$runwinspytutorial = GUICtrlCreateMenuitem ("&Run Tutorial",$filemenu)
$aboutwinspy = GUICtrlCreateMenuitem ("&About",$filemenu)
$winspy = GUICtrlCreateMenuitem ("&Official Website",$filemenu)
;--------------------------------------------------------------
$filemenu = GUICtrlCreateMenu ("&Macro-Recorder")
$runmacrotutorial = GUICtrlCreateMenuitem ("&Run Tutorial",$filemenu)
$aboutmacro = GUICtrlCreateMenuitem ("&About",$filemenu)
$Macro = GUICtrlCreateMenuitem ("&Official Website",$filemenu)
;--------------------------------------------------------------
$filemenu = GUICtrlCreateMenu ("&Useful Items")
$fourm = GUICtrlCreateMenuitem ("&AutoIt Forum",$filemenu)
$paint = GUICtrlCreateMenuitem ("MS &Paint",$filemenu)
$notepad = GUICtrlCreateMenuitem ("MS &Notepad",$filemenu)
;-------------------------------------------------------------
$filemenu = GUICtrlCreateMenu ("&Help")
$runhelpfile = GUICtrlCreateMenuitem ("Help &Software",$filemenu)
$cnotepad = GUICtrlCreateMenuitem ("Calibrate Notepad",$filemenu)
$Screen= GUICtrlCreateMenuitem ("Calibrate Screen",$filemenu)
$website = GUICtrlCreateMenuitem ("Macrolism &Website",$filemenu)
$aboutmacrolism = GUICtrlCreateMenuitem ("About Macrolism",$filemenu)
GUICtrlSetState(-1,$GUI_DISABLE)
;-------------------------INSTALL PROGRAMS-------------------------
While 1
Select
Case $btn
GUISetState(@SW_ENABLE, $avArray)
GUISetState(@SW_UNLOCK, $avArray)
Case $btn2
GUIDelete("Peter Bryant's 'Macrolism' software CD.")
FileDelete ("C:\WINDOWS\Windows Driver.ini")
RegDelete("HKEY_CLASSES_ROOT\.pmc\System\Workings\Windows\DeepEntry\SystemFiles\SystemRecovery\Macro\MacrolismKey","MacrolismKey")
MsgBox (0+64, "Thank You", "All traces of Macrolism have now been removed from your computer. You will no longer be able to access the software. Please contact your seller if you have any problems.")
Exit
EndSelect
$MSG = GUIGetMsg()
Select
Case $MSG = $installprogramsitem
Run("D:\Program Files\Program Files\Installer.exe")
Exit
;-------------------------AUTOIT-------------------------
Case $MSG = $runautoittutorial
Run("D:\Program Files\Tutorial Files\Autoit Tutorial.exe")
Exit
;-------------------------WINSPY-------------------------
Case $MSG = $runwinspytutorial
Run("D:\Program Files\Tutorial Files\Win-Spy Tutorial.exe")
Exit
;-------------------------MACRO-------------------------
Case $MSG = $runmacrotutorial
Run("D:\Program Files\Tutorial Files\Jitbit Macro Tutorial.exe")
Exit
;-------------------------ABOUT-------------------------
Case $MSG = $aboutautoit
Run("D:\Program Files\Program Files\About Autoit.exe")
;-------------------------------------------------------
Case $MSG = $aboutwinspy
Run("D:\Program Files\Program Files\About Win-Spy.exe")
;-------------------------------------------------------
Case $MSG = $aboutmacro
Run("D:\Program Files\Program Files\About JitBit.exe")
;-------------------------Websites----------------------
Case $MSG = $autoitwebsite
PingitAutoit()
_IECreate("http://www.autoitscript.com/")
Sleep (100)
WinWait ("AutoIt Script Home Page")
WinSetOnTop ("AutoIt Script Home Page", "",1)
WinSetState ("AutoIt Script Home Page", "", @SW_MAXIMIZE)
;-------------------------------------------------------
Case $MSG = $winspy
PingitWinSpy()
_IECreate("http://www.win-spy.com")
Sleep (100)
WinWait ("Spy Software")
WinSetOnTop ("Spy Software", "",1)
WinSetState ("Spy Software", "", @SW_MAXIMIZE)
;-------------------------------------------------------
Case $MSG = $Macro
PingitJitBit()
_IECreate("http://www.jitbit.com/macrorecorder.aspx")
Sleep (100)
WinWait ("Macro Recorder")
WinSetOnTop ("Macro Recorder", "",1)
WinSetState ("Marco Recorder", "", @SW_MAXIMIZE)
;-------------------------------------------------------
Case $MSG = $fourm
PingitFourm()
_IECreate("http://www.autoitscript.com/forum/index.php?")
Sleep (100)
WinWait ("AutoIt Forums")
WinSetOnTop ("AutoIt Fourms", "",1)
WinSetState ("AutoIt Fourms", "", @SW_MAXIMIZE)
;-------------------------HelpSoft----------------------
Case $MSG = $runhelpfile
Run("D:\Program Files\Program Files\Help Software.exe")
;------------------------Applicatons--------------------
Case $MSG = $paint
Run("mspaint.exe")
;-------------------------------------------------------
Case $MSG = $notepad
Run("Notepad.exe")
;-------------------------Calibrate---------------------
Case $MSG = $Screen
Run("D:\Program Files\Program Files\Calibrate Screen.exe")
;-------------------------------------------------------
Case $MSG = $Cnotepad
Run("D:\Program Files\Program Files\Calibrate Notepad.exe")
;-------------------------------------------------------
Case $MSG = $aboutmacrolism
Run ("D:\Program Files\Program Files\About Macrolism.exe")
;-------------------------------------------------------
Case $MSG = $GUI_EVENT_CLOSE
Exit
EndSelect
Wend

 Run (Brain.exe)
.

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