ATTENTION: You are viewing a page formatted for mobile devices; to view the full web page, click HERE.

DonationCoder.com Software > Post New Requests Here

Archive each file to separate file in its own folder

<< < (2/3) > >>

Lintalist:
Yes, you can debug it - just select one file for testing purposes. Replace '/c' with '/k' and remove ',,Hide' from the end, so like this

--- ---RunWait, %comspec% /k "C:\Program Files\WinRAR\Rar.exe" a -ep -p%Password% "%OutDir%\%OutFileName%.rar" "%A_LoopField%"
Don't forget to reload the script, right click on the tray icon and Reload.

What the above does:
- /k means don't close the Command window after the RunWait is done
- ,,Hide would hide the command.

Now you can see what the command line is and what type of error message if any is displayed.

menych:
getting an error in cmd:

'C:\Program' is not recognized as an internal or external command, operable program or batch file.

Lintalist:
So it can't find rar.exe, what happens if you copy rar.exe to the folder where your autohotkey.ahk script it, and just use
--- ---RunWait, %comspec% /k rar.exe  a -ep -p%Password% "%OutDir%\%OutFileName%.rar" "%A_LoopField%"

menych:

--- ---'rar.exe' is not recognized as an internal or external command, operable program or batch file.

E:\Dropbox\@@@ CLIENTS @@@\ABC Inc.>

rar.exe is now in the same folder as the AutoHotkey.ahk, which is the My Documents folder

UPDATE: interestingly, rar.exe does not work when I call it from the My Documents folder, but it does work when I copy it to the root of c:

UPDATE2: I moved the ahk file to the root of c: and it almost WORKED!!!

It archived the first file as intended. But then it stopped there.

Lintalist:
Lets try it slightly differently by creating a batch file with all files and then run that file, that way you can test / tweak it until you have it working.  The same principle as above, but it create a batch file with one line commands and it calls rar from c:\program files\winrar\rar.exe which I've just tested and it works for me here. You can check the batch file rarselect.cmd to see if there are any mistakes in there.


--- ---#NoEnv
SetBatchLines, -1
SetWorkingDir, %A_ScriptDir%

if not A_IsAdmin
{
   Run *RunAs "%A_ScriptFullPath%"  ; Requires v1.0.92.01+
   ExitApp
}

; ----------

Password:="MyPassword"

#IfWinActive ahk_exe everything.exe
#z:: ; Winkey-z
ClipboardSave:=ClipboardAll
Clipboard:=""
; Ctrl-Shift-C = Copy full name to Clipboard
Send ^+c
Sleep 100
ZipTheseFiles:=Clipboard
Clipboard:=ClipboardSave
ClipboardSave:=""
Loop, parse, ZipTheseFiles, `n, `r
{
SplitPath, A_LoopField, OutFileName, OutDir, , OutNameNoExt
; a is just archiving, replace 'a' with 'm' if you want to delete (move) the files after creating the rar
ZipOutput .= """C:\Program Files\WinRAR\Rar.exe""" " a -ep -p" Password A_Space """" OutDir "\" OutFileName ".rar" """" A_Space """" A_LoopField """" "`n"
}
FileDelete, rarselect.cmd
FileAppend, %ZipOutput%, rarselect.cmd
RunWait %comspec% /k rarselect.cmd
ZipTheseFiles:="", ZipOutput:=""
Return

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version