-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathunpack_Distributives_config.ahk
More file actions
53 lines (44 loc) · 1.47 KB
/
unpack_Distributives_config.ahk
File metadata and controls
53 lines (44 loc) · 1.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
;by LogicDaemon <www.logicdaemon.ru>
;This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License <https://creativecommons.org/licenses/by-sa/4.0/legalcode.ru>.
#NoEnv
FileEncoding UTF-8
#include <find7zexe>
EnvGet LocalAppData,LOCALAPPDATA
EnvGet SystemRoot,SystemRoot
backupWorkingDir := A_WorkingDir
unpackDir = %A_ScriptDir%\Distributives\config_unpacked
SetWorkingDir %A_ScriptDir%\Distributives\config
Loop Files, *.7z, R
RunPooled(exe7z " x -y -aoa -o""" unpackDir ".tmp\" A_LoopFileFullPath """ -- """ A_LoopFileLongPath """", {options: "Hide"})
RunPooled("", {drain: true})
SetWorkingDir %backupWorkingDir%
FileRemoveDir %unpackDir%, 1
FileMoveDir %unpackDir%.tmp, %unpackDir%, R
ExitApp
RunPooled(ByRef command_line, ByRef runOptions := "") {
static procCountLimit := 0, running := {}
If (runOptions.drain) {
procCountLimit := 0
} Else If (procCountLimit == 0) {
EnvGet procCountLimit, NUMBER_OF_PROCESSORS
procCountLimit--
}
Loop
{
processes := ProcessList()
For ppid in running {
If (!processes.HasKey(ppid))
running.Delete(ppid)
}
If (running.Count() <= procCountLimit) {
break
} Else {
Sleep 300
}
}
If (command_line) {
Run %command_line%, % runOptions.dir, % runOptions.options, ppid
running[ppid] := command_line
}
}
#include <ProcessList>