Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 12/13/2024 in all areas

  1. The example: The UDFish: The back story: I put together "Win 11 - My own border color" and looking at the logs I've found that I had a handle leak. The leak got fixed but I wanted ( out of OCD ? ) to have the script report on it's status. Ok, easy enough, I'll IPC the request. But I don't wanna have it in the main loop, constantly asking "are we there yet ?, are we there yet ?, ..." . I could not find a copy'n'paste UDF, that did that I wanted to have, so I had to code it 🥲 Now you can copy'n'paste it How does it work: When WM_COPYDATA gets a message, it puts the data in a global array that gets accessed by any user function triggered by AdlibRegister() after X mSec. You can set the AdlibRegister() time with WMCDIPC_AdlibTime(). Without a parameter it will return the current value. Can set the user function with WMCDIPC_AdlibFunc()**. Without a parameter it will return the current value. The UDF has notes that will hint it's use. Hope you find it useful. Edit: This is v2.0 ( yey ! ) ** there now is a WMCDIPC_AdlibRegister(func,time) that can do that too. This version allows running all Au3Stripper arguments, so that's good. Added WMCDIPC_PrintCallback() to handle the one line of debug in the UDF. Also added a return in case the script is already busy running in Adlib, therefore unable to process the IPC request right there and then. The int return is "0xFADE" and the string has how many mSec it's been busy. Giving the user a chance to know it "FADEd away" and formulate a resend or what not. Since is a new version, added WMCDIPC_Version(), just in case of a future one. But all in all, I think that this UDF is complete and needs no other functionality for the scenario it would be used at. Edit: This is v2.1 ( wow ! ) Added in the loop. Why ?. Well, the project that I wrote this for is GUIOnEventMode=1. Having the "are we there yet ?" is much slower given that a long Sleep() is common in that option. But the example I posted is GUIOnEventMode=0. It does use GUIGetMsg() to handle messages and CPU usage so, why not have the trigger right there. So that's what I added in this version. And obviously responds much faster than scheduling an Adlib. Edit: ..and this is v2.1.1 ( child proofing ? ) I was thinking that it would be nice to tell, the new to this UDF, that a set of choices would not work ( not as extreme as in MsgBox_Extn() but, something ). Also to run ControlViewer just in case of an "oops". where you can select a script, press DEL, and process close it, if something went wrong. ( and I use it a lot ) So there: for all those that should be sleeping at 3 AM but want to code and screw up, because the brain is sleeping regardless of will.
    4 points
  2. Thanks for testing @ioa747. Since the lost of handles is very minimal, I think it is preferable to use True in _WinAPI_OpenProcess in order to catch all possible processes.
    2 points
  3. Good day, Again, my many thanks to ioa747...whom has managed to "save my bacon" on numerous occasions! As noted, here is my "code": ; Update the folder data For $i = 1 To $sNewName[0+1] ConsoleWrite($sNewName[$i] & @CRLF) ConsoleWrite($sOldName[$i] & @CRLF) FileMove($sOldName[$i], $sNewName[$i], $FC_OVERWRITE) Next ...and here is ioa747's offering: ; Update the folder data For $i = 0 to UBound($sNewName) - 1 FileMove($sOldName[$i], $sNewName[$i], $FC_OVERWRITE) ConsoleWrite("FileMove:" & $sDataFolder & $sOldName[$i + 1] & ", " & $sDataFolder & $sNewName[$i] & ".wma" & @CRLF) Next So: ; FileMove($sOldName[$i], $sNewName[$i], $FC_OVERWRITE) ; VERSUS ; FileMove($sDataFolder & $sOldName[$i + 1], $sDataFolder & $sNewName[$i] & ".wma", $FC_OVERWRITE) ...an OBVIOUS difference!! Thanks again...ioa747! Much appreciated!
    1 point
  4. Thanks @argumentum , I am quite sure I will have a deeper look into this 👌 . Best regards Sven
    1 point
  5. Or you could use WebDriver this way : #include "wd_core.au3" Local $sDesiredCapabilities = SetupChrome() _WD_Startup() Local $sSession = _WD_CreateSession($sDesiredCapabilities) _WD_Navigate($sSession, "https://google.com") _WD_Window($sSession, "MAXIMIZE") _WD_ExecuteScript($sSession, "document.body.style.zoom='0.8';") ;_WD_DeleteSession($sSession) _WD_Shutdown() Func SetupChrome() _WD_Option('Driver', 'chromedriver.exe') _WD_Option('Port', 9515) _WD_Option('DriverParams', '--port=9515 --verbose --log-path="' & @ScriptDir & '\chrome.log"') ;Return '{"capabilities": {"alwaysMatch": {"goog:chromeOptions": {"w3c": true, "excludeSwitches": ["enable-automation"]}}}}' Return '{"capabilities": {"alwaysMatch": {"goog:chromeOptions": {"w3c": true, "excludeSwitches": ["enable-automation"], "args":["--user-data-dir=C:\\Users\\' & @UserName & '\\AppData\\Local\\Google\\Chrome\\User Data\\", "--profile-directory=Default"]}}}}' EndFunc ;==>SetupChrome Important notice : you cannot have a current opened chrome session when using an existing profile. Close all Chrome windows before executing this script.
    1 point
  6. 1 point
  7. How is this different from the above? #include <Array.au3> #include <File.au3> #include <FileConstants.au3> #include <MsgBoxConstants.au3> Example() Func Example() Local $sTextFolder = "I:\Live_Rig\Scripts\Development\_FileMove\HelpFile\Data\FileListing.txt" ; Read the text file Local $sTextFileToRead = FileReadToArray($sTextFolder) ;~ ConsoleWrite("Contents of Text file..." & @CRLF) Local $sNewName = $sTextFileToRead ;~ For $i = 0 To UBound($sNewName) - 1 ;~ ConsoleWrite($sNewName[$i] & @CRLF) ;~ Next Local $sDataFolder = "I:\Live_Rig\Scripts\Development\_FileMove\HelpFile\Data\" ; Read the folder contents Local $aFileList = _FileListToArray($sDataFolder, "*.wma") Local $sOldName = $aFileList ;~ ConsoleWrite("Contents of Data folder..." & @CRLF) ;~ For $i = 1 To $sOldName[0] ;~ ConsoleWrite($sOldName[$i] & @CRLF) ;~ Next ; Update the folder data For $i = 1 To UBound($sNewName) - 1 ;~ ConsoleWrite($sNewName[$i] & @CRLF) ;~ ConsoleWrite($sOldName[$i + 1] & @CRLF) ;~ FileMove($sOldName[$i], $sNewName[$i], $FC_OVERWRITE) ConsoleWrite("FileMove:" & $sDataFolder & $sOldName[$i + 1] & ", " & $sDataFolder & $sNewName[$i] & ".wma" & @CRLF) Next EndFunc ;==>Example
    1 point
  8. Nine

    follow the typewriter effect

    I see. Well good luck with this project. Post the code when you are done in the example section. ps : I recently work on this UDF. It may be of interest for you.
    1 point
  9. [New VERSION] - 11 Dec 24 Added: New function _GUIListViewEx_EditProcessActive which returns the handle of the ListView concerned if an element is being edited. Usage scenario: prevent HotKeys from working when editing is underway. Fixed: A couple of bugs with columns: added columns were automatically sortable; dragging columns meant editing pop-up could appear in wrong place. Thanks to ValentinM for the reports. New UDF in the first post. M23
    1 point
×
×
  • Create New...