sabhazi Posted November 28, 2010 Posted November 28, 2010 Hello,I am creating a script to remote force logoff computers.This part is working:$data = InputBox("Test", "Enter computername.") if $data = "*" Then MsgBox (16, "Info", "Not allowed" & @CRLF & @CRLF & "Restart the program" ,30) ElseShellExecute("psshutdown.exe", "-o -f -accepteula -u administrator -p 1234567 \\" & $data, @SW_MINIMIZE)EndIfNow i want to add a dropdown list with computers from a .ini file of .txt file. And also is not allowed to enter a computername by typing...Can anybody help me out?Thx
Developers Jos Posted November 28, 2010 Developers Posted November 28, 2010 Just look at building your own gui with a ComboBox. Give it a try by looking at the examples in the helpfile. Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
sabhazi Posted November 28, 2010 Author Posted November 28, 2010 Just look at building your own gui with a ComboBox. Give it a try by looking at the examples in the helpfile. Jos Done that Look: #include <File.au3> #include <Array.au3> #include <GUIConstants.au3> #include <GUIConstantsEx.au3> ;read file and load it to array Dim $aPcs _FileReadToArray("wks.txt",$aPCs) ;Create window $Form1 = GUICreate("MCH Remote Force Logoff", 300, 139) $Combo1 = GUICtrlCreateCombo(" -Computer Selecteren- ", 40, 23, 229, 125) $Check = GUICtrlCreateButton("Force Logoff", 96, 76, 113, 35) ;Load Pc's into combobox For $i=1 To $aPcs[0] GUICtrlSetData($Combo1,$aPCs[$i] & "|") Next ;Show GUI GUISetState(@SW_SHOW) ;Main Loop While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Check ShellExecute("psshutdown.exe", "-o -f -accepteula -u administrator -p 123456 \\" & GUICtrlRead($Combo1)) EndSwitch WEnd Now only i need a way to protect the combo box for manual typing info in the box... i cannot find that :S. I have tried to work with $CBS_DROPDOWNLIST but where i have to put this?
Developers Jos Posted November 28, 2010 Developers Posted November 28, 2010 $CBS_DROPDOWNLIST is a Style: GUICtrlCreateCombo ( "text", left, top [, width [, height [, style [, exStyle]]]] ) SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
sabhazi Posted November 28, 2010 Author Posted November 28, 2010 oke, i understand but how can i protect the combobox for manual typing data? Is there another way? this is my first script. Thx for your help
Fubarable Posted November 28, 2010 Posted November 28, 2010 (edited) Have you tried what Jos has recommended before re-asking your question? To use $CBS_DROPDOWNLIST in the style parameter of the GUICtrlCreateCombo function call? You will need to add #include <ComboConstants.au3> to your include list to do this. So, if you've already done this, what happened? Edited November 28, 2010 by Fubarable
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