Advert
Maikey81
Members-
Posts
17 -
Joined
-
Last visited
Profile Information
-
Location
Netherlands
Maikey81's Achievements
Seeker (1/7)
0
Reputation
-
Default value when reading INI key
Maikey81 replied to Maikey81's topic in AutoIt General Help and Support
Ah... now that I see all your replies, it becomes clear. Thank you all for your replies. It's all clear to me now -
Default value when reading INI key
Maikey81 replied to Maikey81's topic in AutoIt General Help and Support
Thanks ripdad! But I don't seem to understand what the big difference is between your and my code. The only difference i see, is that you declare the ini file in a separate variable before reading the ini file. -
Hi, I may be overlooking something real simple, but I can't seem to figure it out. I'm trying the simplest of examples from the autoit site, IniSectionReadNames en combining this with IniRead. Below is the code: Local $var = IniReadSectionNames("c:\servers.ini") If @error Then MsgBox(4096, "", "Error occurred, probably no INI file.") Else For $i = 1 To $var[0] $ip = IniRead($var, $var[$i], "IP", "unknown") MsgBox(4096, "", $var[$i] & " has IP-address: " & $ip) Next EndIf When executing this file, it does read the section names without any problems but it won't return the value of the IP key. It always returns the default value. Below is the contents of the ini file: [Server1] IP=address [Server2] IP=test Any ideas whats going on?
-
Non editable text in editable inputbox
Maikey81 replied to Maikey81's topic in AutoIt General Help and Support
Thanks Xeno! That did the trick! Now I'm going to try and figure out what you did. -
Hi, Is it possible to create an Inputbox with text already in it, that isn't editable, but when you select the inputbox, you start typing behind the text that's already in the inputbox? For example: When having a series of product which all start with the same first four characters, is it possible to default have these first four characters in an inputbox, but people can't delete there characters and always start typing behind the default text? Maybe in the form of a picture? Thanks in advance.
-
Hi, I've created a custom tool for use in a Windows PE enviroment. Because of the number of buttons in use in de UI, I've planned on using the splitbutton in de UI. When I test the script under Windows, the button works perfectly, but when the button is tested under Windows PE, de button appears correctly (with dropdown arrow), but no dropdown menu is showing when the button is pressed. Is there a special requirement for this dropdown menu, that is not available under Windows PE? It's a Windows PE 3.1 (Win Vista/7) enviroment, so I think it should work. Code for the button: $doPC = _GUICtrlButton_Create($main, "Computer -> ", 255, 285, 90, 25, $BS_SPLITBUTTON) ;==> Create knop ;==> Code from Autoit site Func WM_NOTIFY($hWnd, $Msg, $wParam, $lParam) #forceref $hWnd, $Msg, $wParam Local Const $BCN_HOTITEMCHANGE = -1249 Local $tNMBHOTITEM = DllStructCreate("hwnd hWndFrom;int IDFrom;int Code;dword dwFlags", $lParam) Local $nNotifyCode = DllStructGetData($tNMBHOTITEM, "Code") Local $nID = DllStructGetData($tNMBHOTITEM, "IDFrom") Local $hCtrl = DllStructGetData($tNMBHOTITEM, "hWndFrom") Local $dwFlags = DllStructGetData($tNMBHOTITEM, "dwFlags") Local $sText = "" Switch $nNotifyCode Case $BCN_DROPDOWN _Popup_Menu($hCtrl) Case $BN_PUSHED _Popup_Menu($hCtrl) EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==> WM_NOTIFY Func _Popup_Menu($hCtrl) Local $hMenu Local Enum $idReboot = 1000, $idShutdown, $idInfo $hMenu = _GUICtrlMenu_CreatePopup() _GUICtrlMenu_InsertMenuItem($hMenu, 0, "Herstarten", $idReboot) _GUICtrlMenu_InsertMenuItem($hMenu, 1, "Afsluiten", $idShutdown) Switch _GUICtrlMenu_TrackPopupMenu($hMenu, $hCtrl, -1, -1, 1, 1, 2) Case $idReboot ;~ Shutdown(6) Exit Case $idShutdown ;~ Shutdown(13) Exit EndSwitch _GUICtrlMenu_DestroyMenu($hMenu) EndFunc ;==> _Popup_Menu
-
- dropdown
- splitbutton
-
(and 1 more)
Tagged with:
-
Is it possible to check the value of a ComboBox against the values of other ComboBoxes? The only thing I can think of is by making an IF statement for each of the ComboBoxes. But that means I'm getting a lot of code, because I have 10 combo boxes. Goal is to check if the selected value is not the same as the value in one of the other ComboBoxes.
-
Add character to string if character does not exist
Maikey81 replied to Maikey81's topic in AutoIt General Help and Support
That works even better Thanks Hannes! -
Add character to string if character does not exist
Maikey81 replied to Maikey81's topic in AutoIt General Help and Support
Already fixed it Your tip (that i was destroying the handle) made me think. I did a: Local $dxFolder Since the script runs in a function. Then I changed the following: If GUICtrlRead($dFolder) <> "" And StringRight(GUICtrlRead($dFolder), 1) <> "\" Then $dxFolder = GUICtrlRead($dFolder) & "\" And changed the the following $dFolder attributes to $dxFolder That solved the problem with the 1's and the issue that folder name could be entered just ones. Thanks again! -
Add character to string if character does not exist
Maikey81 replied to Maikey81's topic in AutoIt General Help and Support
Hi again Hannes, Your script didn't work. It doesn't change the value of $dFolder at all. The one's keep comming and now the $dFolder value stays 11, no matter what is entered in the input field. -
I'm trying to do a check if a \ exist at the end of a string, and if not then add the \ at the end of that string. To do this, i'm using to folowing code: If GUICtrlRead($dFolder) <> "" And StringRight(GUICtrlRead($dFolder), 1) <> "\" Then $dFolder = GUICtrlRead($dFolder) & "\" EndIf $dFolder (destination folder) is a GUICtrlCreateInput control. The weird thing is, that when $dFolder is empty, $dFolder becomes 11 and. Also, when you enter the destination folder the first time, the script works like a charm. But when you cancel your action and change the folder, the new value is not show. It still uses the old value. Anyone an idea what I'm doing wrong? Beneath you'll see the complete script (the text in this script is dutch): #include <GUIConstantsEx.au3> #include <Process.au3> #include <WindowsConstants.au3> #include <Date.au3> #include <ButtonConstants.au3> #include <EditConstants.au3> #include <ComboConstants.au3> $Admin = GUICreate("Admininistrator", 380, 280, -1, -1, $WS_CAPTION) GUICtrlCreatePic("image001.jpg",0,0,528,100) $doImage = GUICtrlCreateButton("Maak image", 5, 250, 100) $restartbtn = GUICtrlCreateButton("Afsluiten", 275, 250, 100) $cCMD = GUICtrlCreateButton("Open Command Prompt", 115, 250, 150) GUICtrlSetState($doImage, $GUI_DISABLE) GUICtrlSetState($restartbtn, $GUI_FOCUS) ;zet de focus op Exit de knop GUICtrlCreateLabel("Hieronder kun aangeven welke schijf gebruikt moet" & @CRLF & "worden voor de image en waar deze naartoe weg-" & @CRLF & "geschreven moet worden.", 5, 110) GUICtrlCreateLabel("Bron schijf:", 5, 160) GUICtrlCreateLabel("Doel schijf:", 115, 160) GUICtrlCreateLabel("Map (optioneel):", 5, 205) $dFolder = GUICtrlCreateInput("", 5, 222, 210) Global $ip = "localhost" $objWMIService = ObjGet("winmgmts:{impersonationLevel = impersonate}!\\" & $ip & "\root\cimv2") $colItems = $objWMIService.ExecQuery("SELECT Name, VolumeName FROM Win32_LogicalDisk", "WQL", 0x30) If IsObj($colItems) Then $label = "" $dropList = "" For $objItem In $colItems $Label = $Label & $objItem.Name & " -> " & $objItem.VolumeName & @CRLF $dropList = $dropList & $objItem.Name & "|" Next EndIf GUICtrlCreateLabel("Beschikbare schijven:" & @CRLF & "-----------------------------------", 264, 110) GUICtrlCreateLabel($Label, 265, 140) $sList = GUICtrlCreateCombo("", 5, 177, 100, 0, BitOR($WS_VSCROLL, $CBS_DROPDOWNLIST)) GUICtrlSetData($sList, $dropList) $dList = GUICtrlCreateCombo("", 115, 177, 100, 0, BitOR($WS_VSCROLL, $CBS_DROPDOWNLIST)) GUICtrlSetData($dList, $dropList) GUICtrlSetState($dList, $GUI_DISABLE) GUISetState(@SW_SHOW) While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE GUIDelete() ExitLoop Case $Msg = $sList If GUICtrlRead($Msg) <> "" Then GUICtrlSetState($dList, BitOR($GUI_ENABLE, $GUI_FOCUS)) Case $Msg = $dList If GUICtrlRead($Msg) <> "" Then GUICtrlSetState($doImage, $GUI_ENABLE) Case $msg = $doImage If GUICtrlRead($dFolder) <> "" And StringRight(GUICtrlRead($dFolder), 1) <> "\" Then $dFolder = GUICtrlRead($dFolder) & "\" EndIf $doCont = MsgBox(289, "Te verzenden opdracht:", "imagex /compress fast /check flags ""Professional"" /capture " & GUICtrlRead($sList) & " " & GUICtrlRead($dList) & "\" & $dFolder & "install.wim ""Windows 7 Professional"" ""Windows 7 Professional Custom""") Select Case $doCont = 1 ;Run("imagex /compress fast /check flags ""Professional"" /capture " & GUICtrlRead($sList) & " " & GUICtrlRead($dList) & "\" & $dFolder & "install.wim ""Windows 7 Professional"" ""Windows 7 Professional Custom""", @SCRIPTDIR) GUIDelete() ExitLoop EndSelect Case $msg = $restartbtn GUIDelete() ExitLoop Case $msg = $cCMD Run("cmd", @ScriptDir) EndSelect WEnd
-
I'm trying to disable a button, until two comboboxes contain values. I can get it to work, but then the buttons flickers at mouse movement. Anyone an idea how to do this without the button flickering? This is my code until now: While 1 $msg = GUIGetMsg() If GUICtrlRead($sList) = "" Then GUICtrlSetState($doImage, $GUI_DISABLE) ElseIf GUICtrlRead($dList) = "" Then GUICtrlSetState($doImage, $GUI_DISABLE) Else GUICtrlSetState($doImage, $GUI_ENABLE) EndIf Select Case $msg = $GUI_EVENT_CLOSE GUIDelete() ExitLoop Case $msg = $doImage Image() Case $msg = $restartbtn GUIDelete() ExitLoop EndSelect WEnd
-
Make label for each item in Array from WMI
Maikey81 replied to Maikey81's topic in AutoIt General Help and Support
That's something to remember. I shall take a look at it. One other question. How can I make a button disabled, until a value is selected in 2 comboboxes? I have this and it works, but when moving the mouse de button flickers: While 1 $msg = GUIGetMsg() If GUICtrlRead($sList) = "" Then GUICtrlSetState($doImage, $GUI_DISABLE) ElseIf GUICtrlRead($dList) = "" Then GUICtrlSetState($doImage, $GUI_DISABLE) Else GUICtrlSetState($doImage, $GUI_ENABLE) EndIf Select Case $msg = $GUI_EVENT_CLOSE GUIDelete() ExitLoop Case $msg = $doImage Image() Case $msg = $restartbtn GUIDelete() ExitLoop EndSelect WEnd -
Make label for each item in Array from WMI
Maikey81 replied to Maikey81's topic in AutoIt General Help and Support
Hi Hannes, I realized it myself. But even when I used $Labels[26], it gave an error. But I managed to get it to work. And I must say, a lot less script and easier to understand . #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Global $ip = "localhost" $objWMIService = ObjGet("winmgmts:{impersonationLevel = impersonate}!\\" & $ip & "\root\cimv2") GUICreate("TEST", 400, 300, -1, -1, $WS_CAPTION) $colItems = $objWMIService.ExecQuery("SELECT Name, VolumeName FROM Win32_LogicalDisk", "WQL", 0x30) If IsObj($colItems) Then $label = "" For $objItem In $colItems $Label = $Label & $objItem.Name & " -> " & $objItem.VolumeName & @CRLF Next EndIf GUICtrlCreateLabel($Label, 10, 20) GUISetState(@SW_SHOW) While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop EndSelect WEnd Now it won't create a label for each item, but one label with all items.