
Cyborg5000
-
Posts
118 -
Joined
-
Last visited
Reputation Activity
-
Cyborg5000 reacted to Nine in Convert au3 scripts to html/CGI
Do not bump your thread within 24 hours. We are all here on our spare times, so be patient, someone may (or may not) have an answer for you.
-
Cyborg5000 reacted to FrancescoDiMuro in Want to restrict input to specific words/characters
@Cyborg5000
I think that there are some other ways to do it, but take a look at this one:
#include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Opt("GUIOnEventMode", 1) #Region ### START Koda GUI section ### Form= $frmMainForm = GUICreate("A Form", 285, 162, -1, -1) GUISetOnEvent($GUI_EVENT_CLOSE, "ExitApplication") $txtInput = GUICtrlCreateInput("", 20, 24, 249, 24) GUICtrlSetFont(-1, 10, 400, 0, "Arial") GUISetState(@SW_SHOW, $frmMainForm) GUIRegisterMsg($WM_COMMAND, "WM_COMMAND") #EndRegion ### END Koda GUI section ### While 1 Sleep(100) WEnd Func ExitApplication() Exit EndFunc Func WM_COMMAND($hWnd, $iMsg, $wParam, $lParam) Local $hdlWindowFrom, _ $intControlID_From, _ $intMessageCode, _ $strInputText = "" $intControlID_From = BitAND($wParam, 0xFFFF) $intMessageCode = BitShift($wParam, 16) Switch $intControlID_From Case $txtInput Switch $intMessageCode Case $EN_CHANGE $strInputText = GUICtrlRead($txtInput) If StringInStr($strInputText, "*.domain.com") Or StringInStr($strInputText, "*.domain.domain.com") Then ConsoleWrite("This wildcard is not accepted!" & @CRLF) ; If you want to clear the user input ; GUICtrlSetData($txtInput, "") ; If you want to make the input read-only GUICtrlSetStyle($txtInput, $ES_READONLY) EndIf ; ConsoleWrite($strInputText & " ") EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc
Cheers
-
Cyborg5000 reacted to Jos in would like to have only specific users to use the script
I am wondering why you think this should work at all?
You are creating an boolean result to which $User will be set.
One way is to do it like this:
Global $user = '|user1|user2|user3|user4|' If StringInStr($user, "|" & $userid & "|") Then ; EndIf also for the records: these kind of tests will always fail:
as Not $user will be evaluated as first step!
Jos
-
Cyborg5000 reacted to MikahS in Cannot use _GUICtrlEdit_SetText for 3-4 inputs..
A while loop is an event loop. Meaning that it is looking for events on the GUI. If you're trying to autofill these values before there has been an event on the GUI, then you need to fill them before going into the loop, like so:
#include <GUIConstants.au3> #include <GUIEdit.au3> #Region ### START Koda GUI section ### Form=c:\users\slingaya\desktop\system.kxf Local $System = GUICreate("BIOS", 652, 222, 194, 129, BitOR($GUI_SS_DEFAULT_GUI, $WS_MINIMIZE)) Local $Sysname = GUICtrlCreateLabel("System Name", 16, 8, 100, 20, -1, BitOR($WS_EX_CLIENTEDGE, $WS_EX_STATICEDGE)) GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif") Local $Sysbiosver = GUICtrlCreateLabel("System BIOS Version", 16, 104, 151, 20, -1, BitOR($WS_EX_CLIENTEDGE, $WS_EX_STATICEDGE)) GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif") Local $biosreldt = GUICtrlCreateLabel("BIOS Release Date", 16, 72, 139, 20, -1, BitOR($WS_EX_CLIENTEDGE, $WS_EX_STATICEDGE)) GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif") Local $model = GUICtrlCreateLabel("System Model", 16, 40, 102, 20, -1, BitOR($WS_EX_CLIENTEDGE, $WS_EX_STATICEDGE)) GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif") Local $dellavlbi = GUICtrlCreateLabel("Available Dell Bios Version", 16, 136, 194, 20, -1, BitOR($WS_EX_CLIENTEDGE, $WS_EX_STATICEDGE)) GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif") Local $Checkbox1 = GUICtrlCreateCheckbox("Download", 488, 136, 105, 33, $BS_CHECKBOX) GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif") Local $Button1 = GUICtrlCreateButton("Download and FLASH", 488, 168, 145, 41, $BS_DEFPUSHBUTTON) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") Local $Progress1 = GUICtrlCreateProgress(272, 176, 172, 25, BitOR($PBS_SMOOTH, $WS_BORDER), BitOR($WS_EX_CLIENTEDGE, $WS_EX_STATICEDGE)) Local $Button2 = GUICtrlCreateButton("Check BIOS Status", 488, 8, 145, 33, $BS_DEFPUSHBUTTON) GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif") Local $sysmodel = GUICtrlCreateInput("", 272, 40, 177, 21, BitOR($GUI_SS_DEFAULT_INPUT, $ES_CENTER), BitOR($WS_EX_CLIENTEDGE, $WS_EX_STATICEDGE)) Local $Biorlsdt = GUICtrlCreateInput("", 272, 72, 177, 21, BitOR($GUI_SS_DEFAULT_INPUT, $ES_CENTER), BitOR($WS_EX_CLIENTEDGE, $WS_EX_STATICEDGE)) Local $sysbiover = GUICtrlCreateInput("", 272, 104, 177, 21, BitOR($GUI_SS_DEFAULT_INPUT, $ES_CENTER), BitOR($WS_EX_CLIENTEDGE, $WS_EX_STATICEDGE)) Local $Avdlbiovr = GUICtrlCreateInput("", 272, 136, 177, 21, BitOR($GUI_SS_DEFAULT_INPUT, $ES_CENTER), BitOR($WS_EX_CLIENTEDGE, $WS_EX_STATICEDGE)) Local $sysnamd = GUICtrlCreateInput("", 272, 8, 177, 21, BitOR($GUI_SS_DEFAULT_INPUT, $ES_CENTER), BitOR($WS_EX_CLIENTEDGE, $WS_EX_STATICEDGE)) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### Local $compname = @ComputerName Local $sysmod = RegRead("HKLM64\HARDWARE\DESCRIPTION\System\BIOS", "SystemProductName") Local $biorldt = RegRead("HKLM64\HARDWARE\DESCRIPTION\System\BIOS", "BIOSReleaseDate") _GUICtrlEdit_SetText($sysmodel, $sysmod) _GUICtrlEdit_SetText($sysnamd, $compname) _GUICtrlEdit_SetText($Biorlsdt, $biorldt) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Sysname Case $Sysbiosver Case $biosreldt Case $model Case $dellavlbi Case $Checkbox1 Case $Button1 Case $Button2 Case $sysmodel _GUICtrlEdit_SetText($sysmodel, $sysmod) Case $Biorlsdt Case $sysbiover Case $Avdlbiovr Case $sysnamd _GUICtrlEdit_SetText($sysnamd, $compname) EndSwitch WEnd
-
Cyborg5000 reacted to AaronOoi in Auto Disable Wireless when ethernet detected
I have my own way to do this:
#include <File.au3> #include <Array.au3> #NoTrayIcon while 1 runwait(@ComSpec & ' /c for /F "tokens=1-10" %A in (''"netsh interface show interface | find /i "local""'') DO (echo %B %C %D %E %F %G) >> c:\temp\network.txt',"",@SW_HIDE) runwait(@ComSpec & ' /c for /F "tokens=1-10" %A in (''"netsh interface show interface | find /i "wireless""'') DO (echo %B %C %D %E %F %G) >> c:\temp\network.txt',"",@SW_HIDE) local $Network[10] _FileReadToArray("c:\temp\network.txt",$Network) $x = 1 $y = 1 Do if StringInStr($Network[$x],"Local") > 0 and StringInStr($Network[$x],"Connected",1) > 0 then ;if LAN is connected disable all wifi Do if StringInStr($Network[$y],"Wireless") > 0 and StringInStr($Network[$y],"Connected",1) > 0 Then ; if wireless and connected $Wireless_Name = StringReplace($Network[$y],"Connected Dedicated ","") runwait(@ComSpec & ' /c netsh interface set interface name="'&$Wireless_Name&'" disable',"",@SW_HIDE) EndIf $y += 1 Until $y = $Network[0]+1 EndIf if StringInStr($Network[$x],"Local") > 0 and StringInStr($Network[$x],"Disconnected",1) > 0 then Do if StringInStr($Network[$y],"Wireless") > 0 and StringInStr($Network[$y],"Disconnected",1) > 0 Then ; if wireless and disconnected $Wireless_Name = StringReplace($Network[$y],"Disconnected Dedicated ","") runwait(@ComSpec & ' /c netsh interface set interface name="'&$Wireless_Name&'" enable',"",@SW_HIDE) EndIf $y += 1 Until $y = $Network[0]+1 EndIf $x +=1 Until $x = $Network[0]+1 runwait(@ComSpec & ' /c del c:\temp\network.txt /f',"",@SW_HIDE) sleep(2000) WEnd