I'm trying to write an autoit script to select from the dropdown list as you see in the attached picture.
I read the help page for _IEFormElementOptionSelect, but I cannot grasp how to correlate that with the source code that I'm seeing. any suggestions?
Help please: AutoIT mapping network drive in WinPE 10 does not work, but a batch file or command line does!By ModemJunki
I solved it - only had to add a sleep for 10 seconds or so to make sure the shell could see the I.P. address change.
I'm working in Windows PE environment (10.0.10586). I think I have some permissions issue related to AutoIT
I've tried with Net Share and with DriveMapAdd - neither work.
So finally I made the script output a batch file with a pause and what I found is that in WinPE, the batch file behaves differently if it's run at the command prompt or if it is spawned by AutoIT.
If spawned by AutoIT, the net use command gives error 1231 "The network location cannot be reached". I assume this is the same problem that DriveMapAdd is having.
But if I run the same batch file under the command shell in the Windows PE instance, it works.
I also made a simple test with Ping() and it always returns 1 (host is offline) but I can ping it from the command line in the same PE session.
Are there service dependencies for this to work? What is preventing AutoIT from accessing the network?
Below sample is kind of dirty but illustrates what I'm doing. Could use a lot more refinement for error checking etc.
;~ #RequireAdmin #include <Array.au3> #include <AutoItConstants.au3> _SetUpPEIP() Func _SetUpPEIP() Local $s_user = "USER" Local $s_pass = "PASS" Local $s_RMTIP = "10.1.1.4" Local $s_RMTSHR = "SHARED_FOLDER" Local $s_IPPrefix = "10.1.1." Local $s_netMask = "255.255.255.0" Local $s_StartIP = 20 Local $a_NICs Local $objWMIService = ObjGet("winmgmts:\\localhost\root\CIMV2") Local $colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_NetworkAdapter", "WQL") If IsObj($colItems) Then ; gather network card names For $objItem In $colItems If $objItem.NetConnectionStatus == "2" Or $objItem.NetConnectionStatus == "9" Then _ArrayAdd($a_NICs, $objItem.NetConnectionID) EndIf Next EndIf If IsArray($a_NICs) Then ; assign them I.P. addresses For $i = 1 To UBound($a_NICs) - 1 $s_setIP = "netsh interface IP set address name=""" & $a_NICs[$i] & """ static " & $s_IPPrefix & $i + $s_StartIP - 1 & " " & $s_netMask $s_ipRes = RunWait(@ComSpec & " /c " & $s_setIP, @ScriptDir, @SW_HIDE) ; expect 0 Sleep(100) ConsoleWrite($s_setIP & " result is: " & $s_ipRes & @CRLF) Next Sleep(10000) ; wait for the shell to catch up and enum the I.P. $sres = DriveMapAdd("Z:", "\\" & $s_RMTIP & "\" & $s_RMTSHR, $DMA_PERSISTENT, $s_user, $s_pass) ; now map a drive Else ; error! No cards found! EndIf EndFunc ;==>_SetUpPEIP
I'm attempting to cobble together a replacement for the 64bit version of BGInfo that will run within WinPE 10/64. I've located a couple useful threads:
Between the two, they get me close (see code below), but for some reason GDI+ is not working the same within WinPE as it does in Windows 10. Bottomline is that the "Text" never get's written to WallPaper.
Here is what I have thus far. Any thoughts if any of the GDI commands might not work within WinPE? Any other way to achieve the same result (system information on the wallpaper in WinPE 10)?
#include <GDIPlus.au3> #include <Date.au3> _GDIPlus_Startup() $image = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\WallPaper.bmp") $imagegraphics = _GDIPlus_ImageGetGraphicsContext($image) $w = _GDIPlus_ImageGetWidth($image) $h = _GDIPlus_ImageGetHeight($image) $whitebrush = _GDIPlus_BrushCreateSolid(0xFFFFFFFF) $fontfamily = _GDIPlus_FontFamilyCreate("Arial") $font = _GDIPlus_FontCreate($fontfamily, 16) $stringformat = _GDIPlus_StringFormatCreate() _GDIPlus_StringFormatSetAlign($stringformat, 2) $rect = _GDIPlus_RectFCreate(0, $h - $h + 100, $w - 25, $h) ;$rect = _GDIPlus_RectFCreate(100, 100, 200, 200) _GDIPlus_GraphicsDrawStringEx($imagegraphics, _Now() & @CRLF & @UserName & @CRLF & @ComputerName & @CRLF & @IPAddress1, $font, $rect, $stringformat, $whitebrush) _GDIPlus_ImageSaveToFile($image, @ScriptDir & "\NewWallPaper.bmp") _GDIPlus_ImageDispose($image) _GDIPlus_GraphicsDispose($imagegraphics) _GDIPlus_BrushDispose($whitebrush) _GDIPlus_FontFamilyDispose($fontfamily) _GDIPlus_FontDispose($font) _GDIPlus_StringFormatDispose($stringformat) _GDIPlus_Shutdown() _ChangeDesktopWallpaper(@ScriptDir & "\NewWallPaper.bmp", 2) Func _ChangeDesktopWallpaper($bmp, $style = 0) ;=============================================================================== ; ; Function Name: _ChangeDesktopWallPaper ; Description: Update WallPaper Settings ; Usage: _ChangeDesktopWallPaper(@WindowsDir & '\' & 'zapotec.bmp',1) ; Parameter(s): $bmp - Full Path to BitMap File (*.bmp) ; [$style] - 0 = Centered, 1 = Tiled, 2 = Stretched ; Requirement(s): None. ; Return Value(s): On Success - Returns 0 ; On Failure - -1 ; Author(s): FlyingBoz ; Thanks: Larry - DllCall Example - Tested and Working under XPHome and W2K Pro ; Excalibur - Reawakening my interest in Getting This done. ; ;=============================================================================== If Not FileExists($bmp) Then Return -1 ;The $SPI* values could be defined elsewhere via #include - if you conflict, ; remove these, or add if Not IsDeclared "SPI_SETDESKWALLPAPER" Logic Local $SPI_SETDESKWALLPAPER = 20 Local $SPIF_UPDATEINIFILE = 1 Local $SPIF_SENDCHANGE = 2 Local $REG_DESKTOP = "HKEY_CURRENT_USER\Control Panel\Desktop" If $style = 1 Then RegWrite($REG_DESKTOP, "TileWallPaper", "REG_SZ", 1) RegWrite($REG_DESKTOP, "WallpaperStyle", "REG_SZ", 0) Else RegWrite($REG_DESKTOP, "TileWallPaper", "REG_SZ", 0) RegWrite($REG_DESKTOP, "WallpaperStyle", "REG_SZ", $style) EndIf DllCall("user32.dll", "int", "SystemParametersInfo", _ "int", $SPI_SETDESKWALLPAPER, _ "int", 0, _ "str", $bmp, _ "int", BitOR($SPIF_UPDATEINIFILE, $SPIF_SENDCHANGE)) Return 0 EndFunc ;==>_ChangeDesktopWallpaper Thanks for your time,
I'm trying to read an excel spreadsheet(SWW_TestFlow, Worksheet=Controller) and creating a dropdown list from all the cell values within a specific column("G").
I would like to have the dropdown behave in such a way as to allow multiple selections and for all those selections to be written to a file.
I attached a file I started with to experiment with gui and controls etc but got totally lost.......
Can somebody help me?
I've never worked with an array or dropdown menu before and I can't seem to wrap it around my head this morning. Maybe I just need more coffee but I'm trying to populate a GUI dropdown menu with section names of a .ini file. Here is what I have for this part but I don't know where to go from here. The msgbox thing was only testing it but I kinda got stuck here.
local $aSectionnames = IniReadSectionNames(@DesktopDir & "\Scripts\BatteryConfig.ini") if Not @error Then For $i = 1 to $aSectionnames MsgBox($MB_SYSTEMMODAL, "Test", $aSectionnames[$i]) Next EndIf
Here is my very basic dropdown menu I want to populate
#include <ButtonConstants.au3> #include <ComboConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 413, 213, 192, 124) $Combo1 = GUICtrlCreateCombo("Combo1", 80, 24, 241, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL)) $Button1 = GUICtrlCreateButton("Button1", 152, 56, 75, 25) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd