Repositorio de scripts de irc.terrachat.cl desde los canales #TRAFFIC y #LATINWAREZ.
⬅️ Volver;
; .mrceBook Compressor
; By Ook v1.0
;
; $1- = file
alias sb.makerar {
;rar, tar, lha, 7z, gz, xz, zip, zipx, lzx, uha
var %ext = $file($1-).ext
if (%ext == $null) {
sb.DisplayInfo [error] No ext: $1-
return 5
}
if (%sbext == $null) set %sbext .zip .zipx .rar .tar .7z .gz .xz .uha .lha .lzx .epub .nfo .nzb .par2 .sfv .md5
if ($istok(%sbext,%ext,32)) return 2
var %type = $+($chr(40),$right(%ext,-1),$chr(41)), %newfile = $+($file($1-).path,$remove($file($1-).name,%type),$chr(32),%type,.rar)
if ($dialog(sb_compress)) {
did -ra sb_compress 10 $nopath($1-)
did -ra sb_compress 11 $nopath(%newfile)
}
else echo -s file: $nopath($1-) :: $nopath(%newfile)
if ($isfile(%newfile)) {
sb.DisplayInfo Dup: %newfile
return 3
}
if (!$isfile($1-)) {
sb.DisplayInfo [error] Filename error
return 4
}
if (!$isfile(%sbrarexe)) {
sb.DisplayInfo [error] No rar.exe: %sbrarexe
return 0
}
if (!$isdir($nofile(%sblogfile))) {
sb.DisplayInfo [error] Invalid path: %sblogfile
return 0
}
if ($file($1-).size isnum 0) {
sb.DisplayInfo Empty File: $1-
return 6
}
set %sbcompressing 1
inc %sbcnt
if ($dialog(sb_compress)) did -ra sb_compress 13 %sbcnt
if (!%sbcntonly) {
sb.DisplayInfo Compressing...
run -h %sbrarexe a -m5 -ma5 -ep -df -inul -ilog $+ %sblogfile $qt(%newfile) $qt($1-)
return 1
}
return 7
}
; $1- = exe\path
alias sb.checkrunning {
var %exe = $noqt($1-)
.comopen wmi.open WbemScripting.SWbemLocator
.comclose wmi.open $com(wmi.open,ConnectServer,1,bstr,.,bstr,root\CIMV2,dispatch* wmi.locator)
set -l %properties Caption CommandLine CreationClassName CreationDate CSCreationClassName CSName Description ExecutablePath ExecutionState Handle HandleCount InstallDate KernelModeTime MaximumWorkingSetSize MinimumWorkingSetSize Name OSCreationClassName OSName OtherOperationCount OtherTransferCount PageFaults PageFileUsage ParentProcessId PeakPageFileUsage PeakVirtualSize PeakWorkingSetSize Priority PrivatePageCount ProcessId QuotaNonPagedPoolUsage QuotaPagedPoolUsage QuotaPeakNonPagedPoolUsage QuotaPeakPagedPoolUsage ReadOperationCount ReadTransferCount SessionId Status TerminationDate ThreadCount UserModeTime VirtualSize WindowsVersion WorkingSetSize WriteOperationCount WriteTransferCount
.comclose wmi.locator $com(wmi.locator,ExecQuery,1,bstr,SELECT * FROM Win32_Process WHERE ExecutablePath=" $+ $replacex(%exe,\,\\) $+ ",dispatch* wmi.properties) $com(wmi.properties,Count,3)
set -l %instances $com(wmi.properties).result
.comclose wmi.properties
:error
if ($error) {
if ($com(wmi.open)) .comclose wmi.open
if ($com(wmi.locator)) .comclose wmi.locator
if ($com(wmi.properties)) .comclose wmi.properties
}
if (%instances isnum 1-) return 1
return 0
}
alias -l sb.DisplayInfo {
if ($dialog(sb_compress)) did -ra sb_compress 20 $1-
else echo -s [Compress] $1-
}
; $1 = file num
alias sb.convertfiles {
if ($sb.checkrunning(%sbrarexe)) {
.timersbconvertfiles 1 1 sb.convertfiles $1
return
}
if (%sbcompressing) {
if ($dialog(sb_compress)) did -ra sb_compress 20 Scanning list...
set %sbcompressing 0
}
var %item = $+(item_,$1), %f = $hget(sb_files,%item)
if (%f == $null) {
sb.DisplayInfo Complete
if ($dialog(sb_compress)) {
did -r sb_compress 10,11
did -e sb_compress 1,3,6,9,12,14,15
did -b sb_compress 5
}
.timersbconvertfiles off
if ($hget(sb_files)) .hfree sb_files
return
}
var %res = $sb.makerar(%f)
if (!%res) {
sb.DisplayInfo [error] sb.makerar failed: %f
.timersbconvertfiles off
if ($hget(sb_files)) .hfree sb_files
return
}
if (%res isnum 2-) .timersbconvertfiles 1 0 sb.convertfiles $calc($1 +1)
else .timersbconvertfiles 1 1 sb.convertfiles $calc($1 +1)
return
:error
.timersbconvertfiles off
if ($hget(sb_files)) .hfree sb_files
}
dialog -l sb_compress {
title "Compress Files"
option map
size -1 -1 400 200
button "Set Rar.exe", 1, 5 10 50 12
text "Not Set!", 2, 56 10 150 12, nowrap
button "Set LogFile", 15,206 10 50 12
text "Not Set!", 16,257 10 300 12, nowrap
button "Set Path", 6, 5 25 50 12, disable
text "Not Set!", 7, 56 25 300 12, nowrap
text "Ignore Extensions", 8, 5 55 60 12
edit "", 9, 65 55 300 12
button "Build List", 3, 5 40 50 12, disable
button "Compress", 4, 56 40 50 12, disable
button "Stop", 5,109 40 50 12, disable
check "Count Only", 12,160 40 50 12
edit "0", 13,211 40 50 12, read center
check "Recurse", 14,262 40 50 12
text "no file", 10, 5 100 390 12, nowrap
text "no file", 11, 5 113 390 12, nowrap
text "info text", 20, 5 150 390 12, nowrap
text "help text", 21, 5 163 390 12, nowrap center
}
alias sb.OpenCompress {
if ($dialog(sb_compress)) dialog -v sb_compress
else dialog -m sb_compress sb_compress
}
on *:dialog:sb_compress:init:0: {
if (!$isfile(%sbrarexe)) set %sbrarexe $qt(C:\Program Files\WinRAR\rar.exe)
if (!$isdir(%sbpath)) set %sbpath $mircdir
if ((%sblogfile == $null) || (!$isdir($nofile(%sblogfile)))) set %sblogfile $mircdirCompressLog.log
if (%sbext == $null) set %sbext .zip .zipx .rar .tar .7z .gz .xz .uha .lha .lzx .epub .nfo .nzb .par2 .sfv .md5
did -a $dname 2 %sbrarexe
did -a $dname 7 %sbpath
did -a $dname 9 %sbext
did -a $dname 16 %sblogfile
if (%sbcntonly) did -c $dname 12
if (%sbrecurse) did -c $dname 14
if ($isfile(%sbrarexe)) {
did -e $dname 6
if ($isdir(%sbpath)) did -e $dname 3
}
}
on *:dialog:sb_compress:mouse:1: {
if (%sbprevdid != $did) did -ra $dname 21 Set the Rar.exe's path.
set %sbprevdid $did
}
on *:dialog:sb_compress:mouse:3: {
if (%sbprevdid != $did) did -ra $dname 21 Build an internal list of files to compress.
set %sbprevdid $did
}
on *:dialog:sb_compress:mouse:4: {
if (%sbprevdid != $did) did -ra $dname 21 Compress all files in the internal list that are not excluded.
set %sbprevdid $did
}
on *:dialog:sb_compress:mouse:5: {
if (%sbprevdid != $did) did -ra $dname 21 Stop processing the internal list.
set %sbprevdid $did
}
on *:dialog:sb_compress:mouse:6: {
if (%sbprevdid != $did) did -ra $dname 21 Set the path to the files that you want to compress.
set %sbprevdid $did
}
on *:dialog:sb_compress:mouse:8,9: {
if (%sbprevdid != $did) did -ra $dname 21 Ignore files with these extentions.
set %sbprevdid $did
}
on *:dialog:sb_compress:mouse:12,13: {
if (%sbprevdid != $did) did -ra $dname 21 Don't compress the files, just count the ones that would have been compressed.
set %sbprevdid $did
}
on *:dialog:sb_compress:mouse:14: {
if (%sbprevdid != $did) did -ra $dname 21 Recurse into subdirs.
set %sbprevdid $did
}
; set rar.exe
on *:dialog:sb_compress:sclick:1: {
var %t = $sfile(%sbrarexe,"Select the Rar.exe",Ok)
if (%t == $null) return
if (!$isfile(%t)) {
sb.DisplayInfo [error] Invalid path: %t
return
}
set %sbrarexe $qt(%t)
did -ra $dname 2 %sbrarexe
did -e $dname 3,4,6
}
; set logfile
on *:dialog:sb_compress:sclick:15: {
var %t = $sfile(%sblogfile,"Select the LogFile",Ok)
if (%t == $null) return
if (!$isdir($nofile(%t))) {
sb.DisplayInfo [error] Invalid path: %t
return
}
set %sblogfile $qt(%t)
did -ra $dname 16 %sblogfile
}
; set path
on *:dialog:sb_compress:sclick:6: {
.timersbconvertfiles off
if ($hget(sb_files)) .hfree sb_files
var %t = $sdir(%sbpath,"Select path")
if ((%t == $null) || (!$isdir(%t))) return
set %sbpath %t
did -ra $dname 7 %sbpath
did -b $dname 4
set %sbcnt 0
did -ra $dname 13 0
}
; build list
on *:dialog:sb_compress:sclick:3: {
if (!$isfile(%sbrarexe)) {
sb.DisplayInfo [error] No rar.exe: %sbrarexe
return
}
if (!$isdir(%sbpath)) {
sb.DisplayInfo [error] Invalid path: %sbpath
return
}
if (!$isdir($nofile(%sblogfile))) {
sb.DisplayInfo [error] Invalid path: %sblogfile
return
}
did -ra $dname 20 Making list...
did -b $dname 3,4,6,12,14,15
.timersbconvertfiles off
if ($hget(sb_files)) .hfree sb_files
set %sbcnt 0
did -ra $dname 13 0
if (%sbrecurse) noop $findfile(%sbpath,*.*,0,hadd -m sb_files $+(item_,$hget(sb_files,0).item) $1-)
else noop $findfile(%sbpath,*.*,0,1,hadd -m sb_files $+(item_,$hget(sb_files,0).item) $1-)
did -ra $dname 20 Finished list. $hget(sb_files,0).item Files.
did -e $dname 3,4,6,12,14,15
}
; compress list
on *:dialog:sb_compress:sclick:4: {
if (!$isfile(%sbrarexe)) {
sb.DisplayInfo [error] No rar.exe: %sbrarexe
return
}
if (!$isdir(%sbpath)) {
sb.DisplayInfo [error] Invalid path: %sbpath
return
}
if (!$isdir($nofile(%sblogfile))) {
sb.DisplayInfo [error] Invalid path: %sblogfile
return
}
if (!$hget(sb_files)) {
sb.DisplayInfo [error] No Filelist.
return
}
did -ra $dname 20 Scanning list...
did -b $dname 1,3,4,6,9,12,14,15
did -e $dname 5
set %sbcntonly $did(12).state
set %sbrecurse $did(14).state
set %sbcnt 0
did -ra $dname 13 0
.timersbconvertfiles off
if ($hget(sb_files,0).item isnum 1-) sb.convertfiles 0
}
; stop
on *:dialog:sb_compress:sclick:5: {
.timersbconvertfiles off
did -e $dname 1,3,4,6,9,12,14,15
did -b $dname 5
did -r $dname 10,11
sb.DisplayInfo Stopped.
}
on *:dialog:sb_compress:edit:9: set %sbext $did($did)
on *:dialog:sb_compress:sclick:12: set %sbcntonly $did($did).state
on *:dialog:sb_compress:sclick:14: set %sbrecurse $did($did).state
on *:dialog:sb_compress:close:0: {
.timersbconvertfiles off
if ($hget(sb_files)) .hfree sb_files
}
menu menubar,status {
Compress Books
.Open: sb.OpenCompress
.-
.Unload: .unload -rs $script
}
on *:unload: {
if ($dialog(sb_compress)) dialog -x sb_compress
.timersbconvertfiles off
if ($hget(sb_files)) .hfree sb_files
.unset %sbext %sbcntonly %sbrecurse %sbrarexe %sblogfile
sb.DisplayInfo Unloaded.
}
;
;
;
👁️ 4 vistas • 📥 0 descargas