Help with script for Winrar

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
ndiaz
Posts: 73
Joined: 10 Jan 2017, 17:05
Contact:

Help with script for Winrar

16 Apr 2019, 12:52

I'm trying to create a script that will allow me to skip Winrar's initial windows and unzip my files directly, so, in other words, as soon as I double click on a zipped file, when WinRar opens, it will trigger the Extract to a specified folder option, and then will say OK to the window that opens to confirm the path.

This is my attempt, but it's performing the Down and Enter actions everywhere, not just in WinRar. What am I doing wrong?

Code: Select all

#IfWinActive ahk_exe WinRAR.exe
#Persistent

SetTimer, UnZip, 1000
return

UnZip:
IfWinActive, ahk_exe WinRAR.exe
Send !c
Sleep 100
Send {Down}{Enter}
Sleep 100
Send {Enter}
return
gregster
Posts: 9111
Joined: 30 Sep 2013, 06:48

Re: Help with script for Winrar

16 Apr 2019, 13:03

You will have to use code blocks with { }, if you want to execute more than one line conditionally, something like:

Code: Select all

UnZip:
IfWinActive, ahk_exe WinRAR.exe
{
	Send !c
	Sleep 100
	Send {Down}{Enter}
	Sleep 100
	Send {Enter}
}
return
Btw, the directive #IfWinActive ahk_exe WinRAR.exe only affects hotkeys and hotstrings - that means, in this script snippet it won't do anything.
ndiaz
Posts: 73
Joined: 10 Jan 2017, 17:05
Contact:

Re: Help with script for Winrar

16 Apr 2019, 16:41

Thank you so much! This was incredibly helpful as it both solved my problem and helped me learn a couple of new things.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: No registered users and 382 guests