I have multiple network adapters but only one is actually connected.
I thus use @IPAddress1 in my scripts whereas @IPAddress2-4 return 0.0.0.0
But recently I've installed the VirtualBox emulator and it took over @IPAddress1 which means my real connection is now @IPAddress2.
Why is that? Is there a way to make AutoIt skip to @IPAddress2 if @IPAddress1 is used by an emulator?
In the attached screenshot it's temporarily disabled so I can revive my scripts which all already use @IPAddress1.
Update: here's the solution.
Good morning community!
I was working on a script which read the content of a .ini file to retrieve the file that has to open, and, based on the value of a second key stored in the .ini file, set the window on top, minimized or maximized...
I did something like this, but seems to not work properly...
Could anyone please tell me what I'm doing wrong?
#Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Outfile_x64=prova.exe #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <MsgBoxConstants.au3> #include <AutoItConstants.au3> ;#include <WinAPIEx.au3> #include <Array.au3> Local $sFileConfigurazione = @ScriptDir & "\configurazione_exe.ini" If(FileExists($sFileConfigurazione)) Then Local $aSezioneIni = IniReadSection($sFileConfigurazione, "CONFIGURAZIONE_EXE") If @error Then MsgBox($MB_ICONERROR, "Errore!", "Errore durante l'apertura del file: " & @CRLF & $sFileConfigurazione & @CRLF & "Errore: " & @error) Else ; Lancio dell'applicativo indicato nel file di configurazione Local $iPID = ShellExecute($aSezioneIni) Local $hWnd If($iPID <> 0) Then Local $aWinList = WinList() For $i = 1 To $aWinList If(WinGetProcess($aWinList[$i] = $iPID)) Then $hWnd = $aWinList[$i] EndIf Next Switch($aSezioneIni) Case $aSezioneIni = "MIN" ToolTip("MIN", 0, 0) WinSetState($hWnd, WinGetTitle($hWnd), @SW_MINIMIZE) Case $aSezioneIni = "MAX" ToolTip("MAX", 0, 0) WinSetState($hWnd, WinGetTitle($hWnd), @SW_MAXIMIZE) Case $aSezioneIni = "TOP" ToolTip("TOP", 0, 0) WinSetOnTop($hWnd, WinGetTitle($hWnd), $WINDOWS_ONTOP) EndSwitch EndIf EndIf EndIf And the .ini file is like this:
[CONFIGURAZIONE_EXE] PercorsoExe=Here goes the path and the .exe to execute ModalitaAperturaExe=Here goes one of the value below /* TOP Shows the windows on top */ /* MIN Shows the window minimized */ /* MAX Shows the window maximized */
I'm trying to make cursor for my program, and I need to make it on top but not active when pressed on start menu, taskbar or etc. (cursor appears behind taskbar/start menu).
Somebody could help me with this problem?
; A bit of my script #include <GUIConstants.au3> #include <WindowsConstants.au3> #include <WinAPI.au3> #include <GDIPlus.au3> #include <GuiListBox.au3> Global $Bitmap_Mouse_Pic_Dir = @ScriptDir&"\Cursor.png" Global $Bitmap_Mouse_Pic = _GetWHI($Bitmap_Mouse_Pic_Dir) Global $Bitmap_Mouse_PicSel_Dir = @ScriptDir&"\Selection.png" Global $Bitmap_Mouse_PicSel = _GetWHI($Bitmap_Mouse_PicSel_Dir) Global $Bitmap_Mouse_Opt = 255 ; ... For $i = 0 to 0 $GP_guicur[$i] = GUICreate("GP Cursor", 64, 64, $POS[$i], $POS[$i], $WS_POPUP, $WS_EX_LAYERED, $GUI) WinSetOnTop($GP_curgui[$i],"",1) SetBitmap($GP_curgui[$i], $Bitmap_Mouse_Pic, $Bitmap_Mouse_Opt) GUISetState(@SW_SHOW) Next ; ... For ; ... Sleep(1000) MouseClick("left",5,@DesktopHeight-5) ; ... Next Exit ;______________________________________________________________________; ; Original program by Ejoc ; ; Improved by Adam1213 (autoit 3.2 compatiblity + improved labels; ;______________________________________________________________________; ; $sImage = Path to your image ; Returns = Array ; $Array = Width ; $Array = Height ; $Array = handle to a HBITMAP ; when the image is no longer needed use _WinAPI_DeleteObject($Array) Func _GetWHI($sImage) Local $hImage, $aBitmap _GDIPlus_Startup() $hImage = _GDIPlus_ImageLoadFromFile($sImage) $aBitmap = _GDIPlus_ImageGetWidth($hImage) $aBitmap = _GDIPlus_ImageGetHeight($hImage) $aBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage) _GDIPlus_ImageDispose($hImage) _GDIPlus_Shutdown() Return $aBitmap EndFunc ;==>_GetWHI ; I changed this so I could shutdown gdiplus once an image has been loaded by _GetWHI() ; just pass it the array returned by _GetWHI() Func SetBitmap($hGUI, $aBitmap, $iOpacity) Local Const $AC_SRC_ALPHA = 1 Local $hScrDC, $hMemDC, $hOld, $pSize, $tSize, $pSource, $tSource, $pBlend, $tBlend $hScrDC = _WinAPI_GetDC(0) $hMemDC = _WinAPI_CreateCompatibleDC($hScrDC) $hOld = _WinAPI_SelectObject($hMemDC, $aBitmap) $tSize = DllStructCreate($tagSIZE) $pSize = DllStructGetPtr($tSize) DllStructSetData($tSize, "X", $aBitmap) DllStructSetData($tSize, "Y", $aBitmap) $tSource = DllStructCreate($tagPOINT) $pSource = DllStructGetPtr($tSource) $tBlend = DllStructCreate($tagBLENDFUNCTION) $pBlend = DllStructGetPtr($tBlend) DllStructSetData($tBlend, "Alpha", $iOpacity) DllStructSetData($tBlend, "Format", $AC_SRC_ALPHA) _WinAPI_UpdateLayeredWindow($hGUI, $hScrDC, 0, $pSize, $hMemDC, $pSource, 0, $pBlend, $ULW_ALPHA) _WinAPI_ReleaseDC(0, $hScrDC) _WinAPI_SelectObject($hMemDC, $hOld) _WinAPI_DeleteDC($hMemDC) EndFunc ;==>SetBitmap
I'd like to move a window to the top of the stack without it being active.
I think it's called z-order in programming?
I've tried these 2 options (commenting out 1 at a time obviously), but the 1st doesn't seem to do anything, and the 2nd prevents it from being moved behind the other programs even after clicking on it and then clicking on another window behind it:
Local $hWnd = WinGetHandle("[CLASS:MSPaintApp]")
_WinAPI_SetWindowPos($hWnd, $HWND_TOP, 0, 0, 0, 0, BitOR($SWP_FRAMECHANGED, $SWP_NOMOVE, $SWP_NOSIZE))
_WinAPI_SetWindowPos($hWnd, $HWND_TOPMOST, 0, 0, 0, 0, BitOR($SWP_FRAMECHANGED, $SWP_NOMOVE, $SWP_NOSIZE))
What can I do to move something to the top of the z-order while allowing it to be manually moved back in the z-order?
I am trying to change the z-ordering of controls in my GUI using GUICtrlSetState. How come this example don't work? (I want $LABEL1 to be above $LABEL2)
#include <GUIConstantsEx.au3> $GUI = GUICreate("Test", 800, 600) GUISetState() $LABEL1 = GUICtrlCreateLabel("under", 20, 20, 500, 300) GUICtrlSetBkColor(-1, 0xFF0000) $LABEL2 = GUICtrlCreateLabel("above", 40, 60, 500, 300) GUICtrlSetBkColor(-1, 0x00FF00) GUICtrlSetState($LABEL1, $GUI_ONTOP) Do Sleep(50) Until GUIGetMsg() = -3 Exit Is there another method to change the z ordering and the order controls receive clicks? I know that the controls should be created in the correct order, but I can't in the script I am doing now.
[EDIT] Solution is in post #5