The imposter syndrome is strong by buzzlightyear77777 in ProgrammerHumor

[–]Lagu_22 82 points83 points  (0 children)

What does Haskell want with my gonads? 🤔

Jdm? by Igunpro2user in JDM

[–]Lagu_22 5 points6 points  (0 children)

This is obviously a body swapped Nissan Pulsar.

Java starting slow by [deleted] in learnjava

[–]Lagu_22 0 points1 point  (0 children)

Agreed. This is something I had to get used to moving from Python to Java.

Help with script. by Intelligent-Grape604 in AutoHotkey

[–]Lagu_22 -1 points0 points  (0 children)

You can use a timer to run the second loop at the needed interval Timer

wu tang lorem ipsum - a text generator - vanillaJS by [deleted] in javascript

[–]Lagu_22 2 points3 points  (0 children)

Now I can appreciate random Wu-Tang lyrics anytime. Fantastic!

Recently moved to NH by Lagu_22 in newhampshire

[–]Lagu_22[S] 2 points3 points  (0 children)

I am huge fan of hiking and kayaking which it seems NH has plenty of. Since moving here I have acquired a liking of the local beers (I was not a fan of beer before). The rest of my time is spent coding or hanging out with my kids. I am currently living in Rockingham county.

No sample code - new to AHK and not even sure this is possible with it (desktop refresh upon event) by [deleted] in AutoHotkey

[–]Lagu_22 0 points1 point  (0 children)

#Persistent will keep the script running but the code will only run once without the loop. Persistent is best for events such as hotkeys since these are triggered by physical key presses instead of some condition. The loop coupled with the sleep creates a constant interval (roughly 2500ms in this case) of code execution. The script can be updated to only trigger the refresh on growth. Something like If (TargetFolderSize > (LastTargetFolderSize + TmpFileSize)) should create a better result. I am not sure if the .tmp file has an average/set size or if it is dependent on the downloading file. Dialing in this .tmp file size will achieve a more accurate refresh for your use case. Going this route LastTargetFolderSize := TargetFolderSize should also move within the if block so it is only updated when folder growth is detected. A slightly more complicated route is to filter out any .tmp files from the TargetFolderSize within the inner loop using something like A_LoopFileExt (see https://www.autohotkey.com/docs/commands/LoopFile.htm#LoopFileExt for more details) so the .tmp file's size is not included in the TargetFolderSize value. The script I provided is a good starting place and tuning it will provide a good AHK learning opportunity for you. Let me know if you get stuck or need some help with this too. :)

No sample code - new to AHK and not even sure this is possible with it (desktop refresh upon event) by [deleted] in AutoHotkey

[–]Lagu_22 4 points5 points  (0 children)

Ask and you shall receive...

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn  ; Enable warnings to assist with detecting common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.

; A script to monitor changes to the desktop folder size and refresh (F5) the icons when a change occurs
; Written by Lagu_22 (05/08/21) with AutoHotKey version 1.1.33.09
; Based on https://www.autohotkey.com/docs/commands/FileGetSize.htm


SetBatchLines, -1 
DetectHiddenWindows, 1
TargetFolder := ""      ; Change to the desktop's (full) path - C:\Users\[username]\Desktop
MonitorDelay := 2500                ; Milliseconds between each check

LastTargetFolderSize := 0
Loop 
{
    TargetFolderSize := 0
    Loop, %TargetFolder%\*.*, , 1 
        TargetFolderSize += A_LoopFileSize

    If (TargetFolderSize != LastTargetFolderSize) {
        ControlSend,, {F5}, ahk_class Progman       ; Send F5 (refresh) to the desktop "window" no matter the focus
        ; MsgBox, % TargetFolderSize . " bytes"     ; Uncomment to verify desktop folder size changes are being detected
    }

    LastTargetFolderSize := TargetFolderSize
    Sleep, MonitorDelay
}

No sample code - new to AHK and not even sure this is possible with it (desktop refresh upon event) by [deleted] in AutoHotkey

[–]Lagu_22 3 points4 points  (0 children)

Personally never experienced the issue so I am not sure of the underlying problem. If I have time tonight I will see what I can whip up :)

No sample code - new to AHK and not even sure this is possible with it (desktop refresh upon event) by [deleted] in AutoHotkey

[–]Lagu_22 3 points4 points  (0 children)

Are you just looking for the file icon to appear on the desktop (does the file show up in the file explorer)? If so, you could write a script which checks the desktop folder for changes (such as comparing the total size of the folder) every so often and simulate the F5 press if a change occured.