Jump to content

NassauSky

Active Members
  • Posts

    327
  • Joined

  • Last visited

Recent Profile Visitors

1,201 profile views

NassauSky's Achievements

  1. Is there any chance someone can point me where to download: WV2Interfaces.au3 Oh boy nevermind I found it in the zip file of this project. Sheesh my mind melts near the holidays
  2. That poor cat has no more skin left 🤣 Thanks @UEZ and @Nine ! Now I have 2 solutions that are looking real good. Though @UEZ had what I thought I was looking for but at first glance I think you get some extra points @Nine since my clock might use that transparent button. But we won't count your chickens before they hatch.
  3. Hi all, First I want to thank @UEZ for the below demo code to create a clock in an old topic which has a nice transparent background for the GUI and the BG of the label. How can I add an opaque button and keep the GUI and Time background transparent. Actually it's extra points if I can set the transparency of the button while keeping it clickable. For example: Global $hButton = GUICtrlCreateButton("Test", $iW - 30, 10, 30, 20) GUICtrlSetBkColor($hButton, 0x000000) ; Set opaque background color GUICtrlSetColor($hButton, 0x00FF00) ; Set text color When I add it, it doesn't show up. #include <WinAPISysWin.au3> #include <WinAPIConstants.au3> #include <GDIPlus.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Global Const $SC_DRAGMOVE = 0xF012 Global $iW = 300, $iH = 100, $hHBitmap Global $hGUI = GUICreate("Parent", $iW, $iH, -1, -1, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_TOPMOST)) GUISetState(@SW_SHOW, $hGUI) _GDIPlus_Startup() Global $hBrush = _GDIPlus_BrushCreateSolid(0xD80000A0) Global $hFormat = _GDIPlus_StringFormatCreate() Global $hFamily = _GDIPlus_FontFamilyCreate("Impact") Global $hFont = _GDIPlus_FontCreate($hFamily, 60) Global $tLayout = _GDIPlus_RectFCreate(0, 0, $iW, $iH) _GDIPlus_StringFormatSetAlign($hFormat, 0) Global $hImage = _GDIPlus_BitmapCreateFromScan0($iW, $iH) Global $hGfx = _GDIPlus_ImageGetGraphicsContext($hImage) _GDIPlus_GraphicsSetTextRenderingHint($hGfx, 4) _GDIPlus_GraphicsSetSmoothingMode($hGfx, 4) GUIRegisterMsg($WM_LBUTTONDOWN, "_WM_LBUTTONDOWN") _ShowTime() AdlibRegister("_ShowTime", 1000) Do Until GUIGetMsg() = $GUI_EVENT_CLOSE AdlibUnRegister("_ShowTime") _WinAPI_DeleteObject($hHBitmap) _GDIPlus_FontDispose($hFont) _GDIPlus_FontFamilyDispose($hFamily) _GDIPlus_StringFormatDispose($hFormat) _GDIPlus_BrushDispose($hBrush) _GDIPlus_GraphicsDispose($hGfx) _GDIPlus_ImageDispose($hImage) _GDIPlus_Shutdown() GUIDelete() Func _ShowTime() _GDIPlus_GraphicsClear($hGfx, 0x00000000) _GDIPlus_GraphicsDrawStringEx($hGfx, @HOUR & ":" & @MIN & ":" & @SEC, $hFont, $tLayout, $hFormat, $hBrush) $hHBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage) _WinAPI_BitmapDisplayTransparentInGUI($hHBitmap, $hGUI) _WinAPI_DeleteObject($hHBitmap) EndFunc Func _WinAPI_BitmapDisplayTransparentInGUI(ByRef $hHBitmap, ByRef $hGUI, $iOpacity = 0xFF, $bReleaseGDI = True) If Not BitAND(GUIGetStyle($hGUI)[1], $WS_EX_LAYERED) = $WS_EX_LAYERED Then Return SetError(1, 0, 0) Local $tDim = DllStructCreate($tagBITMAP) If Not _WinAPI_GetObject($hHBitmap, DllStructGetSize($tDim), DllStructGetPtr($tDim)) Then Return SetError(2, 0, 0) Local $tSize = DllStructCreate($tagSIZE), $tSource = DllStructCreate($tagPOINT), $tBlend = DllStructCreate($tagBLENDFUNCTION) Local Const $hScrDC = _WinAPI_GetDC(0), $hMemDC = _WinAPI_CreateCompatibleDC($hScrDC), $hOld = _WinAPI_SelectObject($hMemDC, $hHBitmap) $tSize.X = $tDim.bmWidth $tSize.Y = $tDim.bmHeight $tBlend.Alpha = $iOpacity $tBlend.Format = 1 _WinAPI_UpdateLayeredWindow($hGUI, $hScrDC, 0, DllStructGetPtr($tSize), $hMemDC, DllStructGetPtr($tSource), 0, DllStructGetPtr($tBlend), $ULW_ALPHA) _WinAPI_ReleaseDC(0, $hScrDC) _WinAPI_SelectObject($hMemDC, $hOld) _WinAPI_DeleteDC($hMemDC) If $bReleaseGDI Then _WinAPI_DeleteObject($hHBitmap) Return True EndFunc Func _WM_LBUTTONDOWN($hWnd, $iMsg, $wParam, $lParam) Switch $hWnd Case $hGUI _SendMessage($hWnd, $WM_SYSCOMMAND, $SC_DRAGMOVE, 0) EndSwitch EndFunc ;==>_WM_LBUTTONDOWN Func WM_NCHITTEST($hWnd, $iMsg, $iwParam, $ilParam) If ($iMsg = $WM_NCHITTEST) Then Return $HTCAPTION EndFunc
  4. Thanks @AndrewG I want to leave double clicking to running the au3. So far I have 5 options: 1) Using shift F10 which is counter intuitive and slows my continuous use of the editing. 2) Bring back the old legacy Win10 menu by modifying a windows registry key 3) Right clicking, choosing "Open with" then "Choose another app" next finding Scite.exe in the x86 programs folder then "Just once" then in the future you will see the edit option from now on in "Open with" 4) I'm still looking into the reputation of shell.exe (https://nilesoft.org/docs) which uses a simple addition to a tiny configuration file: item(title='Autoit Edit' cmd='C:\Program Files (x86)\AutoIt3\SciTE\SciTE.exe' args='"@sel.path"' image=image.res('C:\Program Files (x86)\AutoIt3\SciTE\SciTE.exe')) 5) The best option is if I can write the source code in autoit (since exe's from unknown developers could be shady) Thanks though!
  5. Has anyone seen or posted any code to move or copy "Edit Script" from the Windows 11 "Show More Options" context menu into the main Windows 11 context menu. I edit scripts so often and it would be nice to at least see that included. For now I'm using Shift+RightClick which is not terrible but it would be nice to have that individual item added there without restoring the full menu. 😕
  6. @ioa747 aha got it. OK with that being said, it still runs into an issue that the end user needs autoit installed on their PC's (or at least an extra component) Run('"' & @AutoItExe & '" "' & @ScriptFullPath & '" --ArrayDisplayEx "' & $sTitle & '" ' & $iTimeout) and I've been deploying without that requirement. Good to see the option though! Thanks!
  7. @ioa747 you're function is haunting me. 😁 It opens up an _ArrayDisplay titled "Ordinary Array Display" which doesn't auto close after 3 seconds but if I manually close the _ArrayDisplay it now opens a new _ArrayDisplay titled "3second Array Display" without me hitting the ArrayDisplay Timeout button 😮 After it has a mind of it's own from those last 2 times it auto opened _ArrayDisplay dialogs, it then functions normally after that 😁
  8. @argumentum very interesting. OK so I didn't see it that way as far as modifying the original UDF ArrayDisplayInternals.au3 until you clarified it. So OK now that's another option but then if I'm going that far I'd add another button on the _Array_Display for "Hold" in cases that I'm inspecting the array for a bit longer. If I opt for that option, I'll have to share my new UDF with my other endpoints and make sure I update it if there are any more updates to the Autoit core code down the road. Thanks again!
  9. Thanks @argumentum Ok I don't see a way yet of doing it using @jugador method since _ArrayDisplay is a synchronous blocking function but for now I might use @pixelsearch method as shown below but there's still a global variable $g_sTitle I'll just accept for now: #include <GUIConstantsEx.au3> #include <Array.au3> Example() Func Example() Local $hGUI = GUICreate("Example", 400, 400) Local $idOK = GUICtrlCreateButton("ArrayDisplay Timeout", 250, 370, 115, 25) GUISetState(@SW_SHOW, $hGUI) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $idOK AdlibRegister("_CloseArrayDisplay", 2500) ; Check every 500 ms Local $aArray[5] = [1, 2, 3, 4, 5] Global $g_sTitle = "Array Display" _ArrayDisplay($aArray, $g_sTitle) ; Display the array EndSwitch WEnd GUIDelete($hGUI) AdlibUnRegister("_CloseArrayDisplay") ; Stop checking when the main loop ends EndFunc Func _CloseArrayDisplay() If WinExists($g_sTitle) Then AdlibUnRegister("_CloseArrayDisplay") WinClose($g_sTitle) EndIf EndFunc
  10. 2 years later... Just playing with this a little now. If I have time I'll look for another solution. @Nine I like that idea but it seems the first problem I found is it has to be run on a PC that has Autoit installed. I'd have to have the end-user install (or pre-package) the @AutoItExe package to use the specified Run() command 🙂 I like the left field/right field brain storming.
  11. Thanks @Danp2 What's strange about that is I had the following in my code which I thought locked the port number _WD_Option('Driver', $chromedriverLocation) _WD_Option('Port', 9515) _WD_Option('DriverParams', '--verbose --log-path="' & $RequiredFolder & 'chrome.log"') _WD_Option('DriverDetect', False) ; To ignore another instance of Chrome After replacing it with: _WD_Option('DriverParams', '--port=9515 --verbose --log-path="' & @ScriptDir & '\chrome.log"') It worked. Now I have to make that modification to all my scripts 😕 Thanks again!!
  12. @Danp2 Is anyone else having problems when Chrome auto updated recently. My pc auto updated this morning and I'm now at: Version 128.0.6613.120 (Official Build) (64-bit) and that that version isn't available on https://googlechromelabs.github.io/chrome-for-testing/#beta but just 129.x beta and tried that with the following result where Chrome still doesn't open: -*** Started Func SetupChrome ! $ShowDebugConsole is true so setting $_WD_Debug = $_WD_DEBUG_Full _WD_Option ==> Success [0] : Parameters: Option=Driver Value=C:\Autoit\Scripts\PurchaseOrderFiller\Required\chromedriver.exe _WD_Option ==> Success [0] : Parameters: Option=Port Value=9515 _WD_Option ==> Success [0] : Parameters: Option=DriverParams Value=--verbose --log-path="C:\Autoit\Scripts\PurchaseOrderFiller\Required\chrome.log" _WD_Option ==> Success [0] : Parameters: Option=DriverDetect Value=False Setting $sDesiredCapabilities to: { "capabilities": { "alwaysMatch": { "unhandledPromptBehavior": "ignore", "goog:chromeOptions": { "w3c": true, "excludeSwitches": [ "enable-automation" ], "useAutomationExtension": false, "prefs": { "credentials_enable_service": false, "profile": { "password_manager_enabled": false } }, "args": [ "window-position=0,5","window-size=1080,1046" ] } } }} ======================================= _WD_Option ==> Success [0] : Parameters: Option=DriverDetect Value=False _WD_GetFreePort ==> Success [0 / 9515] : Parameters: MinPort=9515 MaxPort=Default _WD_IsLatestRelease ==> Success [0] : True _WD_Startup: OS: WIN_10 X64 19045 _WD_Startup: AutoIt: 3.3.16.1 _WD_Startup: Webdriver UDF: 1.3.1 (Up to date) _WD_Startup: WinHTTP: 1.6.4.2 _WD_Startup: Driver: C:\Autoit\Scripts\PurchaseOrderFiller\Required\chromedriver.exe (64 Bit) _WD_Startup: Params: --verbose --log-path="C:\Autoit\Scripts\PurchaseOrderFiller\Required\chrome.log" _WD_Startup: Port: 9515 _WD_Startup: Command: "C:\Autoit\Scripts\PurchaseOrderFiller\Required\chromedriver.exe" --verbose --log-path="C:\Autoit\Scripts\PurchaseOrderFiller\Required\chrome.log" _WD_Startup ==> Success [0] __WD_Post: URL=HTTP://127.0.0.1:9515/session; Data={ "capabilities": { "alwaysMatch": { "unhandledPromptBehavior": "ignore", "goog:chromeOptions": { "w3c": true, "excludeSwitches": [ "enable-automation" ], "useAutomationExtension": false, "prefs": { "credentials_enable_service": false, "profile": { "password_manager_enabled": false } }, "args": [ "window-position=0,5","window-size=1080,1046" ] } } }} __WD_Post ==> Send / Recv error [6] : HTTP status = 0 ResponseText=WinHTTP request timed out before Webdriver _WD_CreateSession ==> Webdriver Exception [10] You might advice me to downgrade my Chrome which I might do. So to make it automatic in the future is there any sample Autoit code that might be able to sense the issue and downgrade chrome automatically? 😕 Thanks!
  13. Thanks @argumentum I created something like that already. I added VB runtime downloader to it and also config file setup to it since at minimum I like the following settings: Func TweakSciTE() ZipSciteConfigFiles() ; Make a zipped backup of all existing config files ; Create SciTE User Settings file Local $sBatchContent = '' & _ '#SciTE User Settings: ' & @CRLF & _ 'split.vertical=0 ' & @CRLF & _ 'save.session=0 ' & @CRLF & _ 'save.position=1 ' & @CRLF & _ 'output.horizontal.size=300 ' & @CRLF & _ 'fold=1 ' & @CRLF & _ 'fold.on.open=1 ' & @CRLF & _ 'fold.compact=0 ' & @CRLF & _ 'output.initial.hide=0 ' & @CRLF & _ 'line.margin.visible=1 ' & @CRLF & _ 'clear.before.execute=1 ' & @CRLF & _ 'backup.files=0 ' & @CRLF & _ 'indicators.under=0 ' & @CRLF & _ 'open.dialog.in.file.directory=1 ' & @CRLF & _ 'find.use.strip=0 ' & @CRLF & _ 'are.you.sure=1 ' & @CRLF & _ 'statusbar.visible=0 ' & @CRLF Local $sStartupFolder = @HomeDrive & "\Users\" & @UserName & "\" Local $sBatchFilePath = $sStartupFolder & "\SciteUser.properties" FileDelete($sBatchFilePath) If Not FileExists($sStartupFolder) Then DirCreate($sStartupFolder) FileWrite($sBatchFilePath, $sBatchContent) If FileExists($sBatchFilePath) Then SplashTextOn("", "Added & Backed up config", 600, 100) Sleep(1800) SplashOff() Else MsgBox($MB_TOPMOST + 16, "Error", "Failed to create batch script.") EndIf EndFunc
  14. I figured I'd paste the full code here since when I needed to use it again the code I provided earlier used UIA and wasn't working properly: ; https://www.autoitscript.com/forum/topic/211931-desktop-icon-caption-names-not-matching-progman-coords/?do=findComment&comment=1534232 #AutoIt3Wrapper_UseX64=y If NOT @AutoItX64 Then MsgBox(0, "Script Mode", "Running in 32-bit mode" & @CRLF & "You need to run it in Scite Full or Compile it 64bit") EndIf #include <GDIPlus.au3> #include <Array.au3> #include <WindowsConstants.au3> #include <WinAPI.au3> #include <GUIConstantsEx.au3> #include <GuiListView.au3> Opt("MustDeclareVars", 1) Global Const $SC_DRAGMOVE = 0xF012 HotKeySet("{ESC}", _Exit) _GDIPlus_Startup() Local $aCoordsOfIcons = _DisplayIconPositions() _ArrayDisplay($aCoordsOfIcons) CreateGUIwCircles($aCoordsOfIcons) Func CreateGUIwCircles($aCoords) Global $myWidth = @DesktopWidth Global $myHeight = @DesktopHeight Global $hGUI = GUICreate('', $myWidth, $myHeight, 0, 0, $WS_POPUP, $WS_EX_LAYERED) GUISetState() ;-- Setup Shape (Small Circle) Global $hBitmap = _GDIPlus_BitmapCreateFromScan0($myWidth, $myHeight) Global $hGraphic = _GDIPlus_ImageGetGraphicsContext($hBitmap) Global $hBuffer = _GDIPlus_ImageGetGraphicsContext($hBitmap) Global $hBrushShape = _GDIPlus_BrushCreateSolid(0xFFFF0000) Global $hBrushText = _GDIPlus_BrushCreateSolid(0xFF000000) Global $hPen = _GDIPlus_PenCreate(0xFFFF0000, 4) ; Red pen color ;-- Setup String Global $hFormat = _GDIPlus_StringFormatCreate() Global $hFamily = _GDIPlus_FontFamilyCreate("Calibri") Global $hFont = _GDIPlus_FontCreate($hFamily, 9, 0) _GDIPlus_GraphicsSetTextRenderingHint($hBuffer, 4) _GDIPlus_GraphicsSetSmoothingMode($hBuffer, 4) For $aa = 0 To UBound($aCoords) - 1 ;-- Add Shape _GDIPlus_GraphicsDrawEllipse($hGraphic, $aCoords[$aa][0], $aCoords[$aa][1], 75, 60, $hPen) ;-- Add String Global $tLayout = _GDIPlus_RectFCreate($aCoords[$aa][0]+7, $aCoords[$aa][1], 75, 15) ; x,y,w,h (orig w:0/h:0 for unlimited) _GDIPlus_GraphicsDrawStringEx($hGraphic, $aCoords[$aa][2], $hFont, $tLayout, $hFormat, $hBrushText) Next _GDIPlus_GraphicsDispose($hGraphic) Global $hHBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBitmap) _WinAPI_BitmapDisplayTransparentInGUI($hHBitmap, $hGUI, 255) GUIRegisterMsg($WM_LBUTTONDOWN, "_WM_LBUTTONDOWN") While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE _Exit() EndSwitch WEnd EndFunc Func _DisplayIconPositions() Local $hListView = _GetDesktopListView() If $hListView = 0 Then MsgBox(0, "Error", "Unable to get desktop ListView handle.") Exit EndIf Local $iCount = _GUICtrlListView_GetItemCount($hListView) Local $sOutput = "" Local $sName, $aPos Local $aCoords[0][3] For $i = 0 To $iCount - 1 $sName = _GUICtrlListView_GetItemText($hListView, $i) $aPos = _GUICtrlListView_GetItemPosition($hListView, $i) $sOutput &= "Icon Name: " & $sName & " - Position: (" & $aPos[0] & ", " & $aPos[1] & ")" & @CRLF _ArrayAdd($aCoords, $aPos[0] & "|" & $aPos[1] & "|" & $sName) Next Return $aCoords EndFunc Func _GetDesktopListView() Local $hDesktop = _WinGetDesktopHandle() Local $hListView = ControlGetHandle($hDesktop, "", "[CLASS:SysListView32;INSTANCE:1]") Return $hListView EndFunc Func _WinAPI_BitmapDisplayTransparentInGUI(ByRef $hHBitmap, ByRef $hGUI, $iOpacity = 0xFF, $bReleaseGDI = True) If Not BitAND(GUIGetStyle($hGUI)[1], $WS_EX_LAYERED) = $WS_EX_LAYERED Then Return SetError(1, 0, 0) Local $tDim = DllStructCreate($tagBITMAP) If Not _WinAPI_GetObject($hHBitmap, DllStructGetSize($tDim), DllStructGetPtr($tDim)) Then Return SetError(2, 0, 0) Local $tSize = DllStructCreate($tagSIZE), $tSource = DllStructCreate($tagPOINT), $tBlend = DllStructCreate($tagBLENDFUNCTION) Local Const $hScrDC = _WinAPI_GetDC(0), $hMemDC = _WinAPI_CreateCompatibleDC($hScrDC), $hOld = _WinAPI_SelectObject($hMemDC, $hHBitmap) $tSize.X = $tDim.bmWidth $tSize.Y = $tDim.bmHeight $tBlend.Alpha = $iOpacity $tBlend.Format = 1 _WinAPI_UpdateLayeredWindow($hGUI, $hScrDC, 0, DllStructGetPtr($tSize), $hMemDC, DllStructGetPtr($tSource), 0, DllStructGetPtr($tBlend), $ULW_ALPHA) _WinAPI_ReleaseDC(0, $hScrDC) _WinAPI_SelectObject($hMemDC, $hOld) _WinAPI_DeleteDC($hMemDC) If $bReleaseGDI Then _WinAPI_DeleteObject($hHBitmap) Return True EndFunc Func _WM_LBUTTONDOWN($hWnd, $iMsg, $wParam, $lParam) _SendMessage($hGUI, $WM_SYSCOMMAND, $SC_DRAGMOVE, 0) EndFunc ;==>_WM_LBUTTONDOWN Func _Exit() _GDIPlus_BitmapDispose($hBitmap) _GDIPlus_Shutdown() Exit EndFunc Func _WinGetDesktopHandle() ;---------------------------------------------------------------------------------------- ; https://www.autoitscript.com/forum/topic/119783-desktop-class-workerw/#comment-903081 ; <_WinGetDesktopHandle.au3> ; Function to get the Windows' Desktop Handle. ; Since this is no longer a simple '[CLASS:Progman]' on Aero-enabled desktops, this method uses a slightly ; more involved method to find the correct Desktop Handle. ; ; Author: Ascend4nt, credits to Valik for pointing out the Parent->Child relationship: Desktop->'SHELLDLL_DefView' ;---------------------------------------------------------------------------------------- Local $i, $hDeskWin, $hSHELLDLL_DefView, $h_Listview_Configs, $aWinList ; The traditional Windows Classname for the Desktop, not always so on newer O/S's $hDeskWin = WinGetHandle("[CLASS:Progman]") ; Parent->Child relationship: Desktop->SHELLDLL_DefView $hSHELLDLL_DefView = ControlGetHandle($hDeskWin, '', '[CLASS:SHELLDLL_DefView; INSTANCE:1]') ; No luck with finding the Desktop and/or child? If $hDeskWin = '' Or $hSHELLDLL_DefView = '' Then ; Look through a list of WorkerW windows - one will be the Desktop on Windows 7+ O/S's $aWinList = WinList("[CLASS:WorkerW]") For $i = 1 To $aWinList[0][0] $hSHELLDLL_DefView = ControlGetHandle($aWinList[$i][1], '', '[CLASS:SHELLDLL_DefView; INSTANCE:1]') If $hSHELLDLL_DefView <> '' Then $hDeskWin = $aWinList[$i][1] ExitLoop EndIf Next EndIf ; Parent->Child relationship: Desktop->SHELDLL_DefView->SysListView32 $h_Listview_Configs = ControlGetHandle($hSHELLDLL_DefView, '', '[CLASS:SysListView32; INSTANCE:1]') If $h_Listview_Configs = '' Then Return SetError(-1, 0, '') Return SetExtended($h_Listview_Configs, $hDeskWin) EndFunc ;==>_WinGetDesktopHandle
  15. I'm working with autoit on multiple PC's over time and one script (maybe more moving forward) is dependent on knowing if it's running from Scite Full vs Scite Lite. Does anyone have any sample code or tricks to determine if it's Full or Lite? Thanks!
×
×
  • Create New...