Reaper Posted July 17, 2010 Share Posted July 17, 2010 (edited) Basically what I have is a script that has 4 check boxes.... Each one performs a specific function... What i would like to find out is how to have one of the check boxes "greyed" out or unclickable depending on what version of Windows 7 is being used... So I need the script to know how to find out if Windows 7 is x86 or x64 then, grey out "certain" checkboxes depending on what version of Windows 7 is being used.... I dont want the user to be able to "check" a box that runs a program for a x86 system if they are using a x64 system... (and vice versa) Hope I explained that well enough... If possible, please provide a example. (Im just learning AutoIt.) Thanks for any help you can provide.... Edited July 17, 2010 by Reaper Link to comment Share on other sites More sharing options...
JohnOne Posted July 17, 2010 Share Posted July 17, 2010 guictrlsetstate() AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
Reaper Posted July 17, 2010 Author Share Posted July 17, 2010 Here is the part of the code I have... Func _jobs() Local $guicheck, $go, $msg Dim $Checkbox[7], $descript[7], $out_string[7], $out[7], $status[7] $out_string[0] = "A" $out_string[1] = "B" $out_string[2] = "C" $out_string[3] = "D" $descript[0] = "Test 1 (x64)" $descript[1] = "Test 2 (x86)" $descript[2] = "Test 3 (x64)" $descript[3] = "Test 2 (x86)" $guicheck = GUICreate("*Test Installer", 600, 190) For $i = 0 To 3 $Checkbox[$i] = GUICtrlCreateCheckbox($descript[$i], 100, (30 * $i + 20), 410, 20) Next $go = GUICtrlCreateButton("Start", 220, 150, 150, 20) GUISetState() While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then Exit If $msg = $go Then ExitLoop For $j = 0 To 3 $status[$j] = GUICtrlRead($Checkbox[$j]) If $status[$j] <> $GUI_CHECKED Then $out[$j] = '' Else $out[$j] = $out_string[$j] EndIf Next WEnd $jobs = $out[0] & $out[1] & $out[2] & $out[3] GUIDelete($guicheck) Return $jobs EndFunc ;==>_jobs So how would I modify it, and how do I get my script to find out if they are running a x86 or x64 system? Thanks again. Link to comment Share on other sites More sharing options...
JohnOne Posted July 17, 2010 Share Posted July 17, 2010 @OSArch AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
Reaper Posted July 17, 2010 Author Share Posted July 17, 2010 Thanks... But maybe example, or modify my current script.... Im very new at this... Link to comment Share on other sites More sharing options...
somdcomputerguy Posted July 17, 2010 Share Posted July 17, 2010 (edited) Switch @OSArch Case "X86" ConsoleWrite("Architecture is X86" & @LF) Case "X64" ConsoleWrite("Architecture is X64" & @LF) EndSwitch Edit: Well I was bored for a second so I sorta rewrote the code, and added the use of the @OSArch macro. Any questions? Ask away.. BTW, the includes and the ConsoleWrite were just for local use, just remove them, they're not needed for the function to run in your add'l code, but the function alone needs them.. expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> ConsoleWrite(@LF & "jobs -> " & _jobs() & @LF) Func _jobs() Local $guicheck, $go, $msg Dim $Checkbox[7], $descript[7], $out_string[7], $out[7], $status[7] $out_string[0] = "A" $out_string[1] = "B" $out_string[2] = "C" $out_string[3] = "D" ; note where I changed your code somewhat here.. $descript[0] = "Test 1 (x64)" $descript[1] = "Test 2 (x64)" $descript[2] = "Test 3 (x86)" $descript[3] = "Test 4 (x86)" ;; $guicheck = GUICreate("*Test Installer", 600, 190) ; this is the addition, and another slight change in the 'For..Next' loop.. Switch @OSArch Case "X86" For $i = 2 To 3 $Checkbox[$i] = GUICtrlCreateCheckbox($descript[$i], 100, (30 * $i + 20), 410, 20) Next Case "X64" For $i = 0 To 1 $Checkbox[$i] = GUICtrlCreateCheckbox($descript[$i], 100, (30 * $i + 20), 410, 20) Next EndSwitch ;; $go = GUICtrlCreateButton("Start", 220, 150, 150, 20) GUISetState() While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then Exit If $msg = $go Then ExitLoop For $j = 0 To 3 $status[$j] = GUICtrlRead($Checkbox[$j]) If $status[$j] <> $GUI_CHECKED Then $out[$j] = '' Else $out[$j] = $out_string[$j] EndIf Next WEnd $jobs = $out[0] & $out[1] & $out[2] & $out[3] GUIDelete($guicheck) Return $jobs EndFunc ;==>_jobs Edited July 17, 2010 by somdcomputerguy - Bruce /*somdcomputerguy */ If you change the way you look at things, the things you look at change. Link to comment Share on other sites More sharing options...
Reaper Posted July 18, 2010 Author Share Posted July 18, 2010 Thank you VERY much somdcomputerguy... It works very well.... Only thing is..... Is there a way so that the other 2 lines are still visible but you can't "check" them. In other words, if you were using a x64 system, you could still see all 4 options, but you could only actually "check" the 2 for x64.. Thanks again for all your help. I really appreciate it. Link to comment Share on other sites More sharing options...
JohnOne Posted July 18, 2010 Share Posted July 18, 2010 Yes, GuiCtrlSetState()expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> ConsoleWrite(@LF & "jobs -> " & _jobs() & @LF) Func _jobs() Local $guicheck, $go, $msg Dim $Checkbox[7], $descript[7], $out_string[7], $out[7], $status[7] $out_string[0] = "A" $out_string[1] = "B" $out_string[2] = "C" $out_string[3] = "D" ; note where I changed your code somewhat here.. $descript[0] = "Test 1 (x64)" $descript[1] = "Test 2 (x64)" $descript[2] = "Test 3 (x86)" $descript[3] = "Test 4 (x86)" ;; $guicheck = GUICreate("*Test Installer", 600, 190) For $i = 0 To 3 $Checkbox[$i] = GUICtrlCreateCheckbox($descript[$i], 100, (30 * $i + 20), 410, 20) Next ; this is the addition, and another slight change in the 'For..Next' loop.. Switch @OSArch Case "X86" GUICtrlSetState($Checkbox[0],$GUI_DISABLE) GUICtrlSetState($Checkbox[1],$GUI_DISABLE) Case "X64" GUICtrlSetState($Checkbox[2],$GUI_DISABLE) GUICtrlSetState($Checkbox[3],$GUI_DISABLE) EndSwitch ;; $go = GUICtrlCreateButton("Start", 220, 150, 150, 20) GUISetState() While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then Exit If $msg = $go Then ExitLoop For $j = 0 To 3 $status[$j] = GUICtrlRead($Checkbox[$j]) If $status[$j] <> $GUI_CHECKED Then $out[$j] = '' Else $out[$j] = $out_string[$j] EndIf Next WEnd $jobs = $out[0] & $out[1] & $out[2] & $out[3] GUIDelete($guicheck) Return $jobs EndFunc ;==>_jobs AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
Reaper Posted July 18, 2010 Author Share Posted July 18, 2010 Outstanding. Thanks to both of you.... Thats exactly what I was looking for. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now