Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 03/21/2024 in all areas

  1. More often than not, garbage collection (GC) is not instantaneous, and calling Delete/Dispose/Close functions merely marks the parsed pointer as no longer needed (as if placing it in a bin beside the curb, but in theory still accessible until the garbage truck comes to empty it), to be physically removed (as in memory being freed) whenever the GC comes round to it. So although it's extremely unsafe to still reference the pointer after calling the disposal function, it's perfectly possible that it's still valid. Therefore it makes good sense to actively null it out yourself if there is any chance that any code might still reference it in the interim.
    2 points
  2. I need from from time to time to run small processes to perform task that would otherwise clog the main process. Yes, there is a number of other UDF that could have done it very well, but I felt they were an over-kill for what I wanted. Don't throw me stones, I know it's not really multi-threading, but it is as close as I could get with simple AutoIt. If someone wonders why I called it PMT, the P stands for Pretending. And I'm also not pretending it is an elaborate UDF. Just small and simple to use... Version 2024-03-24 * corrected bug when 8 parameters (max) is passed to the function Example : #AutoIt3Wrapper_Res_SaveSource=y #include "PMT-UDF.AU3" #include <Constants.au3> _PMT_Init() Local $hProc1 = _PMT_Start("Test1", Default, "Test 1") _PMT_Start("Test2") _PMT_Start("Test3", 5) Local $sResponse While Sleep(50) $sResponse = _PMT_GetResponse($hProc1) If @error Then Exit MsgBox($MB_OK, "Error", "Process has dropped") If $sResponse <> "" Then MsgBox($MB_OK, "Success", $sResponse & @CRLF) ExitLoop EndIf WEnd Func Test1($sTitle, $sMessage) Local $iResp = MsgBox($MB_OK, $sTitle, $sMessage) Return "Done with value " & $iResp EndFunc Func Test2() MsgBox($MB_OK, "2", "Test 2") EndFunc Func Test3($iTimeout) MsgBox($MB_OK, "3", "Test 3", $iTimeout) EndFunc You can pass up to 8 parameters to _PMT_Start. It is up to you to manage the right number. You cannot pass structures, maps or arrays as parameter (only bool, ptr, hWnd, int, float, string, and the keyword Default). You could use my WCD-IPC if need be to exchange large amount of data. If you want to run it compiled, you need to have add #AutoIt3Wrapper_Res_SaveSource=y at the start of your script. In the case you decide to compile your script, _PMT_Init allows you to identity where AutoIt3 is located (in the situation where AutoIt is not installed in the usual directory) to get the right includes in your "threads". Let me know if you have any question, or suggestion, I will be glad to hear them. Enjoy. PMT-UDF.au3
    1 point
  3. The Excel and Word UDFs have been part ot the AutoIt package for ages (at least 2008). Some years later Jon/the Devs decided to not add more UDFs to keep the package small and easy to maintain. So new UDFs (like the PowerPoint UDF) have to be published in the forum. Big advantage: You can fix bugs or add new functions frequently and release a new version every day.
    1 point
  4. @KaFu Don't get me wrong, I am not against an update. I am kinda neutral on this since I don't care much if a pointer is set to null after I don't need it because I am pretty sure I won't use it anymore.
    1 point
  5. That's why I install in C:\Utilities\ Hence, I did not take into consideration the need for Admin rights. I figure that the CHM building is so fast for just a page or two that, to reopen, just rebuild. Then again I'm unlikely to use it much. Nonetheless what I put together is a good hint on how to go from HTML to CHM Thanks for getting involved, asking for more
    1 point
  6. Very nice Script. Works great. I (on Win. 7) had to add #RequireAdmin because the move was failing. Otherwise, it's great. For laziness, I also added an open button to re-open the chm file if needed. Now I just need to learn html 😪
    1 point
  7. Autoplay Media Studio https://forums.indigorose.com
    1 point
  8. Ohhhh @Nine Génial!!!!! If there is an OCR way, maybe that could fix my issue, I will have to try and get the file when that error comes up again. Fortunately it's not that often
    1 point
  9. I was thinking the same as @donnyh13. But I suspect the Print Window does have readable content right ? So any window of that size with no content could be considered as error message ? Another solution would be to use OCR to read the window. Look at :
    1 point
  10. #include <TreeViewConstants.au3> #include <WindowsConstants.au3> #include <GUIConstantsEx.au3> #include <GuiTreeView.au3> #include <GuiMenu.au3> #include <GuiRichEdit.au3> Global $sPath Local $gui010 = GUICreate('Text Viewer', 600, 520) GUISetBkColor(0xE5E4E2) $SaveButton = GUICtrlCreateButton("SAVE",250,480,100,25) Local $iStyle = BitOR($TVS_EDITLABELS, $TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS) Local $hTV = _GUICtrlTreeView_Create($gui010, 10, 10, 580, 300, $iStyle, $WS_EX_CLIENTEDGE) _GUICtrlTreeView_SetTextColor($hTV, 0x000000) _GUICtrlTreeView_SetLineColor($hTV, 0xaa0000) _GUICtrlTreeView_SetBkColor($hTV, 0xEFEEEC) Local $hImage = _GUIImageList_Create(16, 16, 5, 3) _GUIImageList_AddIcon($hImage, "shell32.dll", 3) _GUICtrlTreeView_SetNormalImageList($hTV, $hImage) $edt010 = _GUICtrlRichEdit_Create($gui010, "", 10, 310, 580, 160, _ BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL)) local $FileChange = guictrlcreatedummy() local $SourcePath = @ScriptDir & "\" local $files = filefindfirstfile($SourcePath & '*.txt'), $file if $files = -1 then msgbox(0,'*** FileFindFirst ***','No files found for path = ' & $SourcePath) Exit endif while 1 $file = FileFindNextFile($files) if @error then exitloop _guictrltreeview_add($hTV,0,$file,0,0) wend GUISetState() GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY") While 1 Switch GUIGetMsg() Case $gui_event_close _GUICtrlRichEdit_Destroy($edt010) Exit case $FileChange $sPath = $sourcepath & _guictrltreeview_gettext($hTV,_guictrltreeview_getselection($hTV)) _GUICtrlRichEdit_SetText($edt010, fileread($sPath)) Case $SaveButton Local $hFile = FileOpen($sPath, 2) FileWrite($hFile, _GUICtrlRichEdit_GetText($edt010)) FileClose($hFile) MsgBox(0, '', 'The file as been saved.') EndSwitch WEnd Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam) #forceref $hWnd, $iMsg, $iwParam Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR, $hWndTreeview $hWndTreeview = $hTV If Not IsHWnd($hTV) Then $hWndTreeview = GUICtrlGetHandle($hTV) $tNMHDR = DllStructCreate($tagNMHDR, $ilParam) $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom")) $iIDFrom = DllStructGetData($tNMHDR, "IDFrom") $iCode = DllStructGetData($tNMHDR, "Code") Switch $hWndFrom Case $hWndTreeview Switch $iCode Case $NM_DBLCLK ShellExecute($SourcePath & _GUICtrlTreeView_GetText($hWndTreeview, _GUICtrlTreeView_GetSelection($hTV))) Case $TVN_SELCHANGEDW GUICtrlSendtodummy($FileChange) EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc
    1 point
  11. The other problem with this one, is that the window Size may change due to the file name XD
    1 point
  12. If you tell your kids to clean their room, you're done. If you go over and a room is not clean, would closing the door make it go away ? Same with the DLL call. If I tell it to dispose, it should obliterate it out of existence and the pointer should fail to give you anything because is supposed to be gone. Else, ... you replace the stuff with Null stuff, then ask to dispose and you clear your pointer. That way if it ( the DLL ) did not do its part as well as it should, memory leak should be less. I claim artistic freedom. This is my work of fiction. I have no idea of anything related to DLLs and whatnot. I do have kids. Edit: this may be a good read ? ( gone from MSDN ).
    1 point
  13. Hi Nine, I'm sorry I'm not 100% sure what you mean here... My application (AutoIT) runs constantly to check for possible error message on the screen and needs to deal with it when it finds one. But this error message is NOT detectable. As it has no Visible Text, not special title and the class is a general class. My AutoIT knowledge stops there - That's my only knowledge I have and that's the extent I tried - Find the window in any particular way, but I don't see a way, because as I attached I don't know how else I could find that error, because AutoIT cannot "see it"... Yeah... MAYBE not a bad idea... The only problem is if I have another error that has the same size, it could be "handled" wrongly, which is the reason why, the first time I tried with the CLASS (because it was the only thing I could think of) failed because I think the Print window uses the same CLASS and I ending up cancelling the print job from time to time (or something of the sort )
    1 point
  14. ...and done. Stashed the zip file at the same downloads post. Here is the file: htm2chm4testing_v0.0.0.3.zip if you add to the <HEAD> area of the HTML file you're working on: <link href="AutoIt.css" rel="stylesheet"> then you can see it in your browser with formatting if the CSS file is in the same folder. If you also comment out the IE and CHM expectations: <!-- if ((navigator.appName == "Microsoft Internet Explorer") && (parseInt(navigator.appVersion) >= 4)) // IE (4+) only --> <!-- if (document.URL.match(/^mk:@MSITStore:/i)) { --> then you can pretty much skip using this tool/script. But to clearly see if it all works as expected in the CHM, then use the tool.
    1 point
  15. lizhu

    Fuzzy matching of files

    Thanks for your answer
    1 point
  16. Andreik

    Slideshow UDF

    This is a basic UDF to create nice slideshows. There are a lot of customizable options so it might be useful in some projects. Here is an example: #AutoIt3Wrapper_AU3Check_Parameters=-d -w 1 -w 2 -w 4 -w 5 -w 6 -w 7 #Au3Stripper_Parameters=/sf /sv /mo /rm /rsln #include "Slideshow.au3" Global $avImage[4] = [ _ 'https://lh5.googleusercontent.com/p/AF1QipM3jIOsqrISfcKwgYLYF8-9DyAzQiUyWmB35nBj=w540-h312-n-k-no', _ 'https://lh5.googleusercontent.com/p/AF1QipMPb5fGtzZz2ZJFd20CV2trNzmxNOYLv4abJSfi=w540-h312-n-k-no', _ 'https://lh5.googleusercontent.com/p/AF1QipPLOXRwTpKbFxNNLTmiLrIJlG_H3h4VU6HShLwf=w540-h312-n-k-no', _ 'https://lh5.googleusercontent.com/p/AF1QipPNiwx1lGPxcHJzKTMRl5Cyr1SOjS05yHbif8BE=w540-h312-n-k-no' _ ] Global $asCaptions[4] = ['Pico do Fogo', 'Praia da Chave', 'Buracona - Blue Eye Cave', 'Deserto de Viana'] Global $mOptions[] $mOptions['ImageType'] = 'URL' $mOptions['Captions'] = $asCaptions $mOptions['ShowCaptions'] = True Global $sTitle = 'Cape Verde' Global $sText = 'Cape Verde or Cabo Verde, officially the Republic of Cabo Verde, is an archipelago and island country of West Africa in the central Atlantic Ocean, ' & _ 'consisting of ten volcanic islands with a combined land area of about 4,033 square kilometres (1,557 sq mi). These islands lie between 600 and 850 kilometres ' & _ '(320 and 460 nautical miles) west of Cap-Vert, the westernmost point of continental Africa. The Cape Verde islands form part of the Macaronesia ecoregion, ' & _ 'along with the Azores, the Canary Islands, Madeira, and the Savage Isles.' Global $sExtraText = "Cape Verde's official language is Portuguese. The recognized national language is Cape Verdean Creole, which is spoken by the vast " & _ "majority of the population. As of the 2021 census the most populated islands were Santiago, where the capital Praia is located (269,370), São Vicente (74,016), " & _ "Santo Antão (36,632), Fogo (33,519) and Sal (33,347). The largest cities are Praia (137,868), Mindelo (69,013), Espargos (24,500) and Assomada (21,297)." Global $sCopyright = 'Sources for pictures and data are from google.com and wikipedia.com' Global $hGUI, $cTitle, $cText, $cExtra, $cCopyright, $mSlideshow _GDIPlus_Startup() $hGUI = GUICreate('Slideshow', 870, 450) $cTitle = GUICtrlCreateLabel($sTitle, 10, 10, 300, 60) $cText = GUICtrlCreateLabel($sText, 10, 90, 300, 240) $cExtra = GUICtrlCreateLabel($sExtraText, 10, 330, 850, 80) $cCopyright = GUICtrlCreateLabel($sCopyright, 10, 420, 850, 20) $mSlideshow = _GUICtrlSlideshow_Create($hGUI, 320, 10, 540, 312, $avImage, $mOptions) GUICtrlSetFont($cTitle, 35, 600, 0, 'Segoe UI') GUICtrlSetFont($cText, 11, 500, 0, 'Segoe UI') GUICtrlSetFont($cExtra, 11, 500, 0, 'Segoe UI') GUICtrlSetFont($cCopyright, 11, 500, 2, 'Segoe UI') GUICtrlSetColor($cTitle, 0x000060) GUICtrlSetColor($cCopyright, 0x800000) GUISetState(@SW_SHOW, $hGUI) While True If _GUICtrlSlideshow_ButtonEvent($mSlideshow, $SLIDESHOW_PREV_BTN) Then _GUICtrlSlideshow_ShowSlide($mSlideshow, $BTN_EVENT_PREV) If _GUICtrlSlideshow_ButtonEvent($mSlideshow, $SLIDESHOW_NEXT_BTN) Then _GUICtrlSlideshow_ShowSlide($mSlideshow, $BTN_EVENT_NEXT) Switch GUIGetMsg() Case -3 ExitLoop EndSwitch WEnd _GUICtrlSlideshow_Delete($mSlideshow) _GDIPlus_Shutdown() There might be some hidden bugs. If you encounter any just let me know. Tip: use SlideshowEx.au3 if you don't want to preload the images Slideshow.au3SlideshowEx.au3
    1 point
  17. Okay, great. That sounds great @argumentum, I'll keep an eye out for it. I think you can use "div.codeSnippetToolBarText>a:", but that's an uneducated guess. Edit: I think "codeSnippetContainerTabSingle" will work, and modify the CSS for it to something like codeSnippetToolBarText: float:left; top:-3px; right: 8px; /* -8px; */ position:relative; background-color:#6cb5be; width:auto; padding-left:4px; padding-right:4px; border-left:2px solid #000000; border-right:2px solid #000000; border-bottom:2px solid #000000; height:20px; vertical-align:top That would be pretty cool, I'm using a program called "Precision Helper" to decmpile / recmpile the CHM files, which works pretty good, but it messes up the auto-hide function with my taskbar till I log off/on for some reason. 🤣 Sounds about right!
    1 point
  18. @water @argumentum Thanks for testing. Now we know that the code I provided is not working as expected on Win11...Makes me wonder.
    1 point
  19. Side note: I have my PC with everything changed, like, everything !. But testing if stuff works, I keep a default Win 10 and Win 11 ( in Hyper-V ), just to see how it would behave for default, out of the box windows users.
    1 point
  20. I see the same behaviour. Seems W10/11 does not keep old notifications.
    1 point
  21. Yes, it disappears in Win11. Win10 works as expected.
    1 point
  22. If someone else has Win11, it would be nice to test my code to see if they observe the same behavior as you...
    1 point
  23. Some GUIs have timeout features... Just MsgBox() off the top of my head has that option. But it's an "option", to force it on someone I don't agree with unless it's necessary for an application to continue running. At minimum there's a 5 second delay option, but max is 5 minutes unfortunately. Looks like it's time for you to write a notification pop-up logger 💪👍!
    1 point
  24. Andreik

    Slideshow UDF

    @van_renier Check out SlideshowEx.au3 in the first post. Using this version there are no preloaded images. This means ImageType property is no longer used (or available) and as a side efect $avImage can contain now a mix of local files, image URLs or raw binary data. Here is an example with 1000 slides and memory used it's around 10 MB: #AutoIt3Wrapper_AU3Check_Parameters=-d -w 1 -w 2 -w 4 -w 5 -w 6 -w 7 #Au3Stripper_Parameters=/sf /sv /mo /rm /rsln #include <SlideshowEx.au3> Global $avImage[1000], $asLabel[1000] For $Index = 0 To 999 Switch Mod($Index, 4) Case 0 $avImage[$Index] = 'https://lh5.googleusercontent.com/p/AF1QipM3jIOsqrISfcKwgYLYF8-9DyAzQiUyWmB35nBj=w540-h312-n-k-no' Case 1 $avImage[$Index] = 'https://lh5.googleusercontent.com/p/AF1QipMPb5fGtzZz2ZJFd20CV2trNzmxNOYLv4abJSfi=w540-h312-n-k-no' Case 2 $avImage[$Index] = 'https://lh5.googleusercontent.com/p/AF1QipPLOXRwTpKbFxNNLTmiLrIJlG_H3h4VU6HShLwf=w540-h312-n-k-no' Case 3 $avImage[$Index] = 'https://lh5.googleusercontent.com/p/AF1QipPNiwx1lGPxcHJzKTMRl5Cyr1SOjS05yHbif8BE=w540-h312-n-k-no' EndSwitch $asLabel[$Index] = 'Slide ' & $Index + 1 Next Global $mOptions[] $mOptions['Captions'] = $asLabel $mOptions['ShowSlides'] = False $mOptions['ShowCaptions'] = True Global $sTitle = 'Cape Verde' Global $sText = 'Cape Verde or Cabo Verde, officially the Republic of Cabo Verde, is an archipelago and island country of West Africa in the central Atlantic Ocean, ' & _ 'consisting of ten volcanic islands with a combined land area of about 4,033 square kilometres (1,557 sq mi). These islands lie between 600 and 850 kilometres ' & _ '(320 and 460 nautical miles) west of Cap-Vert, the westernmost point of continental Africa. The Cape Verde islands form part of the Macaronesia ecoregion, ' & _ 'along with the Azores, the Canary Islands, Madeira, and the Savage Isles.' Global $sExtraText = "Cape Verde's official language is Portuguese. The recognized national language is Cape Verdean Creole, which is spoken by the vast " & _ "majority of the population. As of the 2021 census the most populated islands were Santiago, where the capital Praia is located (269,370), São Vicente (74,016), " & _ "Santo Antão (36,632), Fogo (33,519) and Sal (33,347). The largest cities are Praia (137,868), Mindelo (69,013), Espargos (24,500) and Assomada (21,297)." Global $sCopyright = 'Sources for pictures and data are from google.com and wikipedia.com' Global $hGUI, $cTitle, $cText, $cExtra, $cCopyright, $mSlideshow _GDIPlus_Startup() $hGUI = GUICreate('Slideshow', 870, 450) $cTitle = GUICtrlCreateLabel($sTitle, 10, 10, 300, 60) $cText = GUICtrlCreateLabel($sText, 10, 90, 300, 240) $cExtra = GUICtrlCreateLabel($sExtraText, 10, 330, 850, 80) $cCopyright = GUICtrlCreateLabel($sCopyright, 10, 420, 850, 20) $mSlideshow = _GUICtrlSlideshow_Create($hGUI, 320, 10, 540, 312, $avImage, $mOptions) GUICtrlSetFont($cTitle, 35, 600, 0, 'Segoe UI') GUICtrlSetFont($cText, 11, 500, 0, 'Segoe UI') GUICtrlSetFont($cExtra, 11, 500, 0, 'Segoe UI') GUICtrlSetFont($cCopyright, 11, 500, 2, 'Segoe UI') GUICtrlSetColor($cTitle, 0x000060) GUICtrlSetColor($cCopyright, 0x800000) GUISetState(@SW_SHOW, $hGUI) While True If _GUICtrlSlideshow_ButtonEvent($mSlideshow, $SLIDESHOW_PREV_BTN) Then _GUICtrlSlideshow_ShowSlide($mSlideshow, $BTN_EVENT_PREV) If _GUICtrlSlideshow_ButtonEvent($mSlideshow, $SLIDESHOW_NEXT_BTN) Then _GUICtrlSlideshow_ShowSlide($mSlideshow, $BTN_EVENT_NEXT) Switch GUIGetMsg() Case -3 ExitLoop EndSwitch WEnd _GUICtrlSlideshow_Delete($mSlideshow) _GDIPlus_Shutdown()
    1 point
  25. Andreik

    Slideshow UDF

    Don't worry, your feedback it's welcome. It was early in the morning and I was so sleepy that I forgot about attachment. It should be fine now.
    1 point
×
×
  • Create New...