Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 02/25/2023 in all areas

  1. ioa747

    GhostGui

    GhostGui - masks the window and makes it darker on this example put in the same directory GhostGui.au3 and AutoItHelp.au3 then run the _AutoItHelp.au3 press F1 to activate the help. With ALT + mouse wheel scroll you can adjust GhostGui.au3 ; https://www.autoitscript.com/forum/topic/209769-ghostgui/ ;------------------------------------------------------------------------------ ; Title...........: GhostGui.au3 ; Description.....: masks the window and makes it darker with ALT + mouse wheel scroll ; ALT key in Line 199 ;------------------------------------------------------------------------------ #AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7 #NoTrayIcon #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <Misc.au3> #include <WinAPISys.au3> #include <WinAPIConstants.au3> Global $GToolstate = 0, $GToolTimer Global $iParams $iParams = $CmdLine[0] If Not $iParams Then MsgBox(0, "* This is an example...", "This means that you have run the" & @CRLF & @CRLF _ & " --> " & @ScriptName & " <-- " & @CRLF & @CRLF _ & "without command line parameters." & @CRLF _ & "and for this reason go to test mode." & @CRLF & @CRLF _ & "First select the windows you want to act" & @CRLF _ & "and then press OK." & @CRLF _ & "Act with ALT key + WHEEL UP/DOWN") Global $iParams[4] = [3, '[ACTIVE]', 0x000000, 125] ;GhostGUI($HosthWnd, $BackColor = 0x000000, $Transparency = 125) Else $iParams = $CmdLine EndIf If _Singleton($iParams[1], 1) = 0 Then Exit ; to avoid running it multiple times! ;Mouse hook ;--------------------------------------------------------------------------- Global $mX, $mY, $mEvent Global $hDLL = DllOpen("user32.dll") Global $hHook, $hStub_KeyProc, $hmod, $tmpTrack, $WheelTrack = 0 $hStub_KeyProc = DllCallbackRegister("_KeyProc", "long", "int;wparam;lparam") $hmod = _WinAPI_GetModuleHandle(0) $hHook = _WinAPI_SetWindowsHookEx($WH_MOUSE_LL, DllCallbackGetPtr($hStub_KeyProc), $hmod) ;---------------------------------------------------------------------------------------- Global $hGhostGUI, $hWnd GhostGUI($iParams[1], $iParams[2], $iParams[3]) ;call GhostGUI($HosthWnd, $BackColor = 0x000000, $Transparency = 125) GoToExit() ;---------------------------------------------------------------------------------------- Func GoToExit() ; exit & Cleanup Cleanup() Exit EndFunc ;==>GoToExit ;---------------------------------------------------------------------------------------- Func Cleanup() ; Cleanup dll callback _WinAPI_UnhookWindowsHookEx($hHook) DllCallbackFree($hStub_KeyProc) EndFunc ;==>Cleanup ;---------------------------------------------------------------------------------------- Func ScripExit() If WinActive($hWnd) Then GoToExit() EndFunc ;==>ScripExit ;---------------------------------------------------------------------------------------- Func GhostGUI($HosthWnd, $BackColor = 0x000000, $Transparency = 125) $hWnd = WinWait($HosthWnd) $hGhostGUI = GUICreate('GhostGUI', 200, 200, -200, -200, $WS_POPUP, $WS_EX_TOOLWINDOW + $WS_EX_TRANSPARENT, $hWnd) GUISetBkColor($BackColor) WinSetTrans($hGhostGUI, '', $Transparency) $WheelTrack = $Transparency Local $HWPos0, $HWPos[4] ; [0]=X [1]=Y [2]=Width [3]=Height $GToolTimer = TimerInit() HotKeySet("{ESC}", "ScripExit") ; Display the GUI. GUISetState(@SW_SHOW, $hGhostGUI) WinActivate($hWnd) Local $gtooltiptmptxt = "press ESC to terminate." & @CRLF & "Act with ALT key + WHEEL UP/DOWN" ;******************************************* While 1 If $GToolstate = 0 Then ToolTip("Transparency " & $WheelTrack & @CRLF & $gtooltiptmptxt _ , MouseGetPos(0), MouseGetPos(1) + 32, "info", 1) If TimerDiff($GToolTimer) > 4000 Then $GToolstate = 2 $gtooltiptmptxt = "" ToolTip("") EndIf EndIf Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch If WinExists($hWnd) Then $HWPos0 = WinGetPos($hWnd) $HWPos[0] = $HWPos0[0] + 7 $HWPos[1] = $HWPos0[1] $HWPos[2] = $HWPos0[2] - 14 $HWPos[3] = $HWPos0[3] - 7 WinMove($hGhostGUI, "", $HWPos[0], $HWPos[1], $HWPos[2], $HWPos[3]) Else ExitLoop EndIf MouseAct() Sleep(100) WEnd ;******************************************* ; Delete the previous GUI and all controls. GUIDelete($hGhostGUI) EndFunc ;==>GhostGUI ;---------------------------------------------------------------------------------------- Func _KeyProc($nCode, $wParam, $lParam) ; callback function mouse hook Local $tKEYHOOKS, $X, $Y, $tmp, $Delta If $nCode < 0 Then Return _WinAPI_CallNextHookEx($hHook, $nCode, $wParam, $lParam) $tKEYHOOKS = DllStructCreate($tagKBDLLHOOKSTRUCT, $lParam) $X = DllStructGetData($tKEYHOOKS, "vkCode") $Y = DllStructGetData($tKEYHOOKS, "scanCode") Switch $wParam Case $WM_MOUSEWHEEL $Delta = BitShift(DllStructGetData($tKEYHOOKS, "flags"), 16) If $Delta > 0 Then $tmp = 'WHEEL_UP' Else $tmp = 'WHEEL_DOWN' EndIf $tmp &= ' (' & $Delta & ')' Case Else $tmp = "" $mEvent = "" $mX = $X $mY = $Y Return _WinAPI_CallNextHookEx($hHook, $nCode, $wParam, $lParam) EndSwitch $mEvent = $tmp ; Return _WinAPI_CallNextHookEx($hHook, $nCode, $wParam, $lParam) EndFunc ;==>_KeyProc ;---------------------------------------------------------------------------------------- Func GetMouseMsg() ; Mouse Msg Local $mMsg Local $sMax = 255 If $mEvent = "" Then ElseIf $mEvent = "WHEEL_UP (120)" Then ;ConsoleWrite("$mEvent = " & $mEvent & @CRLF) $mEvent = "" $mMsg = "WHEEL_UP" $WheelTrack -= 5 $GToolstate = 0 $GToolTimer = TimerInit() ElseIf $mEvent = "WHEEL_DOWN (-120)" Then ;ConsoleWrite("$mEvent = " & $mEvent & @CRLF) $mEvent = "" $mMsg = "WHEEL_DOWN" $WheelTrack += 5 $GToolstate = 0 $GToolTimer = TimerInit() Else ;nothing ConsoleWrite("$mEvent = " & $mEvent & @CRLF) $mEvent = "" $mMsg = "" EndIf If $WheelTrack > $sMax Then $WheelTrack = $sMax ElseIf $WheelTrack < 0 Then $WheelTrack = 0 EndIf Return $mMsg EndFunc ;==>GetMouseMsg ;---------------------------------------------------------------------------------------- Func MouseAct() If _IsPressed("12", $hDLL) Then ;12 ALT key While _IsPressed("12", $hDLL) ;While CTRL key GetMouseMsg() ;ConsoleWrite("- $WheelTrack=" & $WheelTrack & @CRLF) If $tmpTrack <> $WheelTrack Then WinSetTrans($hGhostGUI, '', $WheelTrack) $tmpTrack = $WheelTrack EndIf Sleep(100) WEnd EndIf EndFunc ;==>MouseAct _AutoItHelp.au3 as example ;https://www.autoitscript.com/forum/topic/209769-ghostgui/ ;------------------------------------------------------------------------------ ; Title...........: _AutoItHelp.au3 ; Description.....: Example to test the GhostGui() ;------------------------------------------------------------------------------ #AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7 #include <Misc.au3> Global $hWnd = WinWait("[TITLE:AutoIt Help; CLASS:HH Parent]") GhostGui() ;************************************************ While WinActive($hWnd) ; Loop While win exits. Sleep(100) WEnd ;************************************************ Exit ;---------------------------------------------------------------------------------------- Func GhostGui() Local $FilePath = @ScriptDir & "\GhostGui.au3" Local $Param = '"[TITLE:AutoIt Help; CLASS:HH Parent]" "0x000000" "50"' _RunScript($FilePath, $Param) EndFunc ;==>GhostGui ;---------------------------------------------------------------------------------------- Func _RunScript($FilePath, $Param = "") Run(FileGetShortName(@AutoItExe) & " " & FileGetShortName($FilePath) & " " & $Param) EndFunc ;==>_RunScript since i did i want to share it Please, leave your comments and experiences here. Thank you !
    2 points
  2. I was wandering; Is there a way to have in the help file, where this line is at <link href="css/default.css" rel="stylesheet"> a way to either load a Dark Mode or load a default.css from elsewhere if the file exists ? Alternatively, have an extra help file compiled in Dark mode that AutoIt3Help.exe would load instead of the default one if "AutoIt3Help.ini" say so ?. Or an extra command that SciTE send if is declared in SciTE ? All this in a future release, unless you can post it in the beta files. Hope you feel up to it 🤩 TIA
    1 point
  3. @TipulatoidSo it would appear to be a rights issue, where the admin user doesn't have the ability to create a file in the directory specified by "user-data-dir".
    1 point
  4. 1 point
  5. We are still working on new features
    1 point
  6. During code troubleshooting, the data display functions _ArrayDisplay(), _DebugArrayDisplay() and _WinAPI_DisplayStruct() can be useful to provide a quick visual overview of the contents of arrays and DllStructs. However, these functions each have their own built-in message loop, which will block the code in the main script. In many cases the code in the main script cannot stand to be blocked in this way and will therefore fail. That is, the troubleshooting functions themselves cause an error. And that, of course, isn't an appropriate situation. This example shows how to execute the data display functions in their own processes, to avoid blocking the code in the main script. Other Examples Unblocking a Blocked Message Handler Unblocking a Blocked Message Handler is about several data display functions that mutually block each other, and how to get around this problem. But the example is not about how to avoid the main script from being blocked. In this new example, data display functions will not block each other nor will they block the main script. The IdeaThe main issue in running a data display function in its own process is passing data to the function. The idea is to use a system global ROT object to pass data from the main script to the data display function. The two major advantages of using a ROT object are that it's a very fast data passing method and that the method preserves data types. However, a ROT object can only be used to pass COM compatible data types. An array is such a COM compatible data type (an AutoIt array is not directly COM compatible, but internally it is stored as a safearray of variants that is COM compatible). A DllStruct isn't COM compatible (nor is it processed by internal COM conversions). To pass a DllStruct, we must first convert data to binary data, which is COM compatible. Once the binary data has been passed, it must again be converted back to a DllStruct. The technique is discussed in the DllStruct section of IPC Techniques through ROT Objects. The CodeThe code is implemented as a complete UDF, NonBlockingDataDisplay.au3. The essential code for creating ROT objects is contained in IRunningObjectTable.au3. AccVars.au3 as well as Variant.au3 and SafeArray.au3 contains code to convert a DllStruct to binary data. Two functions at bottom of the new UDF handles the details of DllStruct to binary conversion. RunArrayDisplay() is the UDF function to execute _ArrayDisplay() in a standalone process: Func RunArrayDisplay( _ $sPath, _ ; Path to Includes ended with "\" $aArray, _ $iFlags = 0, _ ; 0 -> 32 bit code, 1 -> 64 bit code $sTitle = "ArrayDisplay", _ $sHeader = Default ) ; Create data transfer object (ROT-object) Local $sDataTransferObject = "DataTransferObject" & ROT_CreateGUID() ROT_RegisterObject( Default, $sDataTransferObject ) ; Default => Object = Dictionary object Local $oDataTransferObject = ObjGet( $sDataTransferObject ) ; Dictionary object ; Add data to transfer object $oDataTransferObject.Add( "$aArray", $aArray ) $oDataTransferObject.Add( "$sTitle", $sTitle ) $oDataTransferObject.Add( "$sHeader", $sHeader ) ; Run _ArrayDisplay() in another process $g_aDataDisplayProgPids[$g_iDataDisplayProgPids] = BitAND( $iFlags, 1 ) _ ? Run( @AutoItExe & " /AutoIt3ExecuteScript " & $sPath & '"RunArrayDisplay64.au3" ' & $sDataTransferObject ) _ ; 64 bit code : Run( @AutoItExe & " /AutoIt3ExecuteScript " & $sPath & '"RunArrayDisplay32.au3" ' & $sDataTransferObject ) ; 32 bit code $g_iDataDisplayProgPids += 1 EndFunc The function executes Includes\RunArrayDisplay64.au3: #AutoIt3Wrapper_UseX64=Y #include <Array.au3> RunDataDisplay() Func RunDataDisplay() ; Get data transfer object Local $sDataTransferObject = $CmdLine[1] ; Get data from transfer object Local $oDataTransferObject = ObjGet( $sDataTransferObject ) Local $aArray = $oDataTransferObject.Item( "$aArray" ) Local $sTitle = $oDataTransferObject.Item( "$sTitle" ) Local $sHeader = $oDataTransferObject.Item( "$sHeader" ) ; Show array _ArrayDisplay( $aArray, $sTitle, "", 0, Default, $sHeader ) EndFunc Examples\RunArrayDisplay64.au3 is the example that demonstrates the use of RunArrayDisplay(). Run the example in SciTE with F5. #AutoIt3Wrapper_Au3Check_Parameters=-d -w- 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7 #AutoIt3Wrapper_UseX64=Y Opt( "MustDeclareVars", 1 ) #include "..\Includes\NonBlockingDataDisplay.au3" Example() Func Example() ; Create array Local $aArray[1000][10] For $i = 0 To 1000 - 1 For $j = 0 To 9 $aArray[$i][$j] = $i & "/" & $j Next Next ; Display array RunArrayDisplay( "..\Includes\", $aArray, 1 ) ; 1 -> 64 bit code ; Modify array For $j = 0 To 9 $aArray[0][$j] = "Zero/" & $j Next ; Display array RunArrayDisplay( "..\Includes\", $aArray, 1, "ArrayDisplay 2", "C 0|C 1|C 2|C 3|C 4|C 5|C 6|C 7|C 8|C 9" ) ; The script isn't blocked While Sleep( 1000 ) ConsoleWrite( "The script isn't blocked" & @CRLF ) WEnd EndFunc ExamplesIn the Examples folder, there are three more examples. RunArrayDisplay32.au3 is a 32 bit version of RunArrayDisplay64.au3. RunDebugArrayDisplay64.au3 demonstrates the use of RunDebugArrayDisplay() in the UDF. A prerequisite for running the example is that you're using an AutoIt version that includes _DebugArrayDisplay(). The AutoIt version isn't checked in the code. RunDisplayStruct64.au3 demonstrates the use of RunDisplayStruct() in the UDF. The example is based on the example of _WinAPI_DisplayStruct() in the help file. 7z-fileThe 7z-file contains source code for UDFs and examples. You need AutoIt 3.3.12 or later. Tested on Windows 7 and Windows 10. Comments are welcome. Let me know if there are any issues. NonBlockingDataDisplay.7z
    1 point
  7. This creates a local variable named $file, so your global variable is never updated. You will either need to rename this variable or restructure your function so that it returns a value that can then be assigned to the global $file.
    1 point
  8. ..I use a dark theme called BIB3 Works in Win10 and 11 quite well. Here's a small snapshot: Am also requesting a Dark mode help file at https://www.autoitscript.com/forum/topic/209770-cssdefaultcss-in-helpfile/ I hope it takes off and we have a less painful experience in the Windows canvas 😇
    1 point
  9. argumentum

    GhostGui

    Thanks for sharing
    1 point
  10. SevenScript

    Switcher

    Wow it's trully working!! 😎 i wish someone gonna help you with whatever you need someday 💯 Have a good night going study that code xD
    1 point
  11. ioa747

    Switcher

    I changed the name so as not to be confused #include <misc.au3> Local $HotKeyActive, $SleepTime $HotKeyActive = True Enabled() ;************************************************ While 1 Sleep($SleepTime) WEnd ;************************************************ Exit ;---------------------------------------------------------------------------------------- Func start() ; While $HotKeyActive Sleep(10) If _IsPressed("90") Then ; 90 NUM LOCK key ;~ ConsoleWrite(":") Sleep(50) Send("Its") Sleep(200) Send("a simply") Sleep(200) Send("text") Sleep(150) EndIf WEnd EndFunc ;==>start ;---------------------------------------------------------------------------------------- Func Enabled() If $HotKeyActive = True Then TraySetIcon(StringLeft(@AutoItExe, StringInStr(@AutoItExe, "\", $STR_NOCASESENSEBASIC, -1) - 1) & "\Icons\MyAutoIt3_Red.ico") $HotKeyActive = False $SleepTime = 1000 Else TraySetIcon(StringLeft(@AutoItExe, StringInStr(@AutoItExe, "\", $STR_NOCASESENSEBASIC, -1) - 1) & "\Icons\MyAutoIt3_Blue.ico") $HotKeyActive = True $SleepTime = 10 start() EndIf HotKeySet("{ESC}", "Enabled") EndFunc ;==>Enabled
    1 point
  12. ioa747

    Switcher

    hmm you have right wait.. HotKeySet("{ESC}", "Enabled") come out of the if statement Func Enabled() If $Enabled = True Then TraySetIcon(StringLeft(@AutoItExe, StringInStr(@AutoItExe, "\", $STR_NOCASESENSEBASIC, -1) - 1) & "\Icons\MyAutoIt3_Red.ico") $Enabled = False $SleepTime = 1000 Else TraySetIcon(StringLeft(@AutoItExe, StringInStr(@AutoItExe, "\", $STR_NOCASESENSEBASIC, -1) - 1) & "\Icons\MyAutoIt3_Blue.ico") $Enabled = True $SleepTime = 10 start() EndIf HotKeySet("{ESC}", "Enabled") EndFunc ;==>Enabled
    1 point
  13. ioa747

    Switcher

    then make $Enabled = True which means that NumLock gives nothing and then have first press esc to activate
    1 point
  14. ioa747

    Switcher

    I just help I want with Thank you for your time gonna live with what i have i thought you were tired, and for that i say last shot I apologize if I said something I should not
    1 point
  15. ioa747

    Switcher

    last shot #include <misc.au3> Local $Enabled, $SleepTime $Enabled = True Enabled() ;************************************************ While 1 Sleep($SleepTime) WEnd ;************************************************ Exit ;---------------------------------------------------------------------------------------- Func start() ; While $Enabled Sleep(10) If _IsPressed("90") Then ; 90 NUM LOCK key ;~ ConsoleWrite(":") Sleep(50) Send("Its") Sleep(200) Send("a simply") Sleep(200) Send("text") Sleep(150) EndIf WEnd EndFunc ;==>start ;---------------------------------------------------------------------------------------- Func Enabled() If $Enabled = True Then TraySetIcon(StringLeft(@AutoItExe, StringInStr(@AutoItExe, "\", $STR_NOCASESENSEBASIC, -1) - 1) & "\Icons\MyAutoIt3_Red.ico") $Enabled = False $SleepTime = 1000 Else TraySetIcon(StringLeft(@AutoItExe, StringInStr(@AutoItExe, "\", $STR_NOCASESENSEBASIC, -1) - 1) & "\Icons\MyAutoIt3_Blue.ico") $Enabled = True $SleepTime = 10 HotKeySet("{ESC}", "Enabled") start() EndIf EndFunc ;==>Enabled
    1 point
  16. ioa747

    Switcher

    you did it? all good?
    1 point
  17. ioa747

    Switcher

    just changed the red with the blue
    1 point
  18. ioa747

    Switcher

    and it's not what we want? What i try to achive: Double click on script ESC to make $Enable = True and then NumLock = It's a simply qestion
    1 point
  19. 1 point
  20. Woah woah Has no one seen this style? $BS_DEFPUSHBUTTON
    1 point
×
×
  • Create New...