AutoHotkey Community

It is currently May 26th, 2012, 9:49 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: Auto Unzipper
PostPosted: October 5th, 2008, 5:31 am 
Offline

Joined: October 5th, 2008, 5:23 am
Posts: 4
I, with much help from the AHK irc channel, finally came up with an auto unzipping tool 0.1.
Code:
^+p::
runwait, %comspec% /c 7za.exe x -y -o"C:\Documents and Settings\Owner\My Documents\Firefox Downloads\*\" "C:\Documents and Settings\Owner\My Documents\Firefox Downloads\*.zip"
FileDelete, C:\Documents and Settings\Owner\My Documents\Firefox Downloads\*.zip
runwait, %comspec% /c 7za.exe x -y -o"C:\Documents and Settings\Owner\My Documents\Firefox Downloads\*\" "C:\Documents and Settings\Owner\My Documents\Firefox Downloads\*.zip"
FileDelete, C:\Documents and Settings\Owner\My Documents\Firefox Downloads\*.rar
return

It's very rough right now and it would have to be configured to your desired hotkey and directory (also, it relies on having the 7za.exe file in the directory of your script, although you could set the ahk script to find the 7za file wherever, it can be downloaded here: http://sourceforge.net/project/downloading.php?group_id=14481&use_mirror=superb-east&filename=7za460.zip&87383293 ) but what it does is unzip all zips or rars in a directory and then delete the .zip and .rar files when it's done.
The unzipped/unrared files are in folders named after the .zip/.rar folder.
It will automatically replace files which have already been unzipped/rared to that directory.

Features I want to add (feel free to code them yourself and post them here, i'm an ahk noob and will probably never learn how to do it myself):
-The ability to ctrl-click, middle click, etc on a zip/rar file and have it do this function (unzip and delete .zip)
-The ability to ctrl-click etc on a directory and unzip every zip inside it.[/url]


Report this post
Top
 Profile  
Reply with quote  
 Post subject: Re: Auto Unzipper
PostPosted: October 5th, 2008, 6:39 am 
daturkel wrote:
I, with much help from the AHK irc channel, finally came up with an auto unzipping tool 0.1.
Code:
^+p::
runwait, %comspec% /c 7za.exe x -y -o"C:\Documents and Settings\Owner\My Documents\Firefox Downloads\*" "C:\Documents and Settings\Owner\My Documents\Firefox Downloads\*.zip"
FileDelete, C:\Documents and Settings\Owner\My Documents\Firefox Downloads\*.zip
runwait, %comspec% /c 7za.exe x -y -o"C:\Documents and Settings\Owner\My Documents\Firefox Downloads\*" "C:\Documents and Settings\Owner\My Documents\Firefox Downloads\*.zip"
FileDelete, C:\Documents and Settings\Owner\My Documents\Firefox Downloads\*.rar
return


A small error in your code, you delete the rar files before unpacking them.
Code:
; a more readabe/configurable (and less error prone) rewrite
^+p::
;these file and directory definitions could be in the autoexecute section
; or stored/retrieved from an ini file (or registry key)
  7za := "C:\Program Files\Archive Utils\7za.exe"
  7zopts := "x -y"
  outdir := "C:\Documents and Settings\Owner\My Documents\Firefox Downloads\*"
  zipfiles := "C:\Documents and Settings\Owner\My Documents\Firefox Downloads\*.zip"
  rarfiles := "C:\Documents and Settings\Owner\My Documents\Firefox Downloads\*.rar"

runwait, %comspec% /c %7za% %7zopts% -o%outdir% %zipfiles%
FileDelete, %zipfiles%
runwait, %comspec% /c %7za% %7zopts% -o%outdir% %rarfiles%
FileDelete, %rarfiles%
return


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: October 5th, 2008, 3:56 pm 
Offline

Joined: October 5th, 2008, 5:23 am
Posts: 4
that rewrite is quite nice but i still can't get command prompt to find 7za if i put it in program files because it can't get past the space between "program" and "files"
i tried using "=" rather than ":=" and but that didn't work (command prompt said that it cannot use absolute paths for this operation) and i tried putting to sets of quotes but that didn't work either. lastly, i tried putting %7za% in quotes but that returned the same error as switching to =
how do i access 7za.exe in a directory with spaces?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 5th, 2008, 4:14 pm 
daturkel wrote:
that rewrite is quite nice but i still can't get command prompt to find 7za if i put it in program files because it can't get past the space between "program" and "files"
....
how do i access 7za.exe in a directory with spaces?


Sorry about that, quotes are needed around path\filenames in the run commands. Code should be:
Code:
runwait, %comspec% /c "%7za%" %7zopts% -o"%outdir%" "%zipfiles%"
FileDelete, %zipfiles%
runwait, %comspec% /c "%7za%" %7zopts% -o"%outdir%" "%rarfiles%"
FileDelete, %rarfiles%


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: October 5th, 2008, 5:13 pm 
Offline

Joined: October 5th, 2008, 5:23 am
Posts: 4
Code:
^+o::
7za := "C:\Program Files\7-Zip\7za.exe"
7zopts := "x -y"
outdir := "C:\Documents and Settings\Owner\My Documents\Firefox Downloads\*\"
zipfiles := "C:\Documents and Settings\Owner\My Documents\Firefox Downloads\*.zip"
rarfiles:= "C:\Documents and Settings\Owner\My Documents\Firefox Downloads\*.rar"   

runwait, "%7za%" %7zopts% -o"%outdir%" "%zipfiles%"
FileDelete, %zipfiles%
runwait, "%7za%" %7zopts% -o"%outdir%" "%rarfiles%"
FileDelete, %rarfiles%
Return

thanks to skwire, k3ph, clueless and some more[/code]


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: Stigg, Yahoo [Bot] and 11 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
cron
Powered by phpBB® Forum Software © phpBB Group