an easy v1->2 conversion, and a hard one

Get help with using AutoHotkey (v2 or newer) and its commands and hotkeys
ClioCJS
Posts: 2
Joined: 07 Jun 2023, 20:27
Contact:

an easy v1->2 conversion, and a hard one

Post by ClioCJS » 07 Jun 2023, 20:35

hi, I'm new here

Very simple question followed by complex problem

I found a script called "Windows-a.ahk" saved on my hadrrive in 2019 before i ever started using autokey:

Code: Select all

Send({Lwin down}a{Lwin up})
Now that i'm using autokey finally in 2023, i'm runnig v2 and this script gives error.

What is this little trinket i found on my hardrive?



now for a harder question... i found a 2nd autohotkey script i downloaded in 2019 that apparently is a valid solution to an actual problem i have with displaying lyrics the way i want to when throwing parties - https://www.youtube.com/watch?v=Oja2M9X_I2U for an example

as milkdrop messages wthin winamp (which are in an INI file that has a hardcoded value). i believe this copied the lyric from evillyrics (which reads LRC files for songs, and places the lyrics in where it thinks is the milkdrop messages file but 10 yrs have passed and winamp doesn't install in that same place anymore and i've moved it to a custom folder anyway) - so this copies the file over

I'D REALLY LOVE TO GET THIS WORKING IN V2 OMGGGGGGG i wish i'd not lost track of what i was doing in 2019 but i had a surgery situation then.

In a perfect world, the script would be also updated to check if the file has been modified in the last hour, and if it hasn't reduce its check interval from 4 seconds to 30 seconds, just to save resource.

Code: Select all

while 1=1
{
Sleep, 4
Loop, %USERPROFILE%\AppData\Roaming\Winamp\Plugins\milk_msg.ini
{
    copy_it = n
    IfNotExist, %USERPROFILE%\AppData\Roaming\Winamp\Plugins\milk2_msg.ini  ; Always copy if target file doesn't yet exist.
        copy_it = y
    else
    {
        FileGetTime, time, %USERPROFILE%\AppData\Roaming\Winamp\Plugins\milk2_msg.ini
        EnvSub, time, %A_LoopFileTimeModified%, seconds  ; Subtract the source file's time from the destination's.
        if time < 0  ; Source file is newer than destination file.
            copy_it = y
    }
    if copy_it = y
    {
        FileCopy, %USERPROFILE%\AppData\Roaming\Winamp\Plugins\milk_msg.ini, c:\util2\Winamp\Plugins\milk2_msg.ini, 1   ; Copy with overwrite=yes
        ControlSend, , {f7}00, MilkDrop 2
    }

}

Should i convert these scripts, or should i just also run autohotkey 1 for them? and autohotkey 2 for new ones?

User avatar
boiler
Posts: 16931
Joined: 21 Dec 2014, 02:44

Re: an easy v1->2 conversion, and a hard one

Post by boiler » 07 Jun 2023, 21:43

Your first script is not valid v1 or v2 code.

Fixed for v1:

Code: Select all

Send, {Lwin down}a{Lwin up}

Fixed for v2:

Code: Select all

Send "{Lwin down}a{Lwin up}"
; or:
Send("{Lwin down}a{Lwin up}")

Running v1 for existing scripts and v2 for new ones is a valid approach, especially since you can have both installed simultaneously.

ClioCJS
Posts: 2
Joined: 07 Jun 2023, 20:27
Contact:

Re: an easy v1->2 conversion, and a hard one

Post by ClioCJS » 08 Jun 2023, 14:04

Thank you! Now any idea what it does? It's called windows-a.ahk and it's just become a curious puzzle. I'm going to update my files, thank you!!

User avatar
boiler
Posts: 16931
Joined: 21 Dec 2014, 02:44

Re: an easy v1->2 conversion, and a hard one

Post by boiler » 08 Jun 2023, 14:11

ClioCJS wrote: Now any idea what it does? It's called windows-a.ahk and it's just become a curious puzzle.
It sends the key combination Win+A, and it sends it immediately to whichever window happens to be active when you run the script, such as the File Explorer window you double-click on the file from. It seems to be a pretty worthless script as it currently stands.

Post Reply

Return to “Ask for Help (v2)”