Jump to content

inputbox from .ini file


sabhazi
 Share

Recommended Posts

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)

Else

ShellExecute("psshutdown.exe", "-o -f -accepteula -u administrator -p 1234567 \\" & $data, @SW_MINIMIZE)

EndIf

Now 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

Link to comment
Share on other sites

  • Developers

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

Link to comment
Share on other sites

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 :graduated:

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?

Link to comment
Share on other sites

  • Developers

$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.
  :)

Link to comment
Share on other sites

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