'_Title "Kick it all 2"
Width 120, 18
_ScreenMove 10, 10
Dim upper_lim, running_count, approx_count, general_count As _Integer64
'upper_lim = 268435456 ' 0.25 GB!
upper_lim = 67108864 ' 0.25/4 GB!
Q$ = Chr$(34)
Shell _Hide "echo %NUMBER_OF_PROCESSORS% > cores.txt"
'
' determine # of cores and throttle back reusing variables don't worry
'
Open "cores.txt" For Input As #1
Line Input #1, name$
Close 1
j = Val(name$)
dtw = _DesktopWidth
dth = _DesktopHeight
'
' test numbers
'j = 12
'dtw = 1920
'dth = 1080
If j <= 5 And dtw > 1920 Then kicks = 4: sizing = 200: GoTo cleanup
If j <= 8 And dtw <= 1920 Then kicks = 4: sizing = 100: GoTo cleanup
If j <= 8 And dtw > 1920 Then kicks = 9: sizing = 200: GoTo cleanup
'
' more than 8 cores now just decide sizing
'
If dtw <= 1920 Then kicks = 4: sizing = 100: GoTo cleanup
If dtw > 1920 Then kicks = 9: sizing = 200: GoTo cleanup
' clean up any prior messes
cleanup:
Print "You are running"; j; "cores with a display resolution of"; dtw; "by"; dth
Print "I will create"; kicks; "script windows"
Print sizing
ChDir "x:\"
For j = 0 To 9
name$ = "kickit" + Chr$(48 + j) + ".cmd"
If _FileExists(name$) Then Kill name$
Next j
'
' get home path
'
homepath$ = Command$(0): p = InStr(homepath$, "\"): home$ = Left$(homepath$, p): p = InStr(p + 1, homepath$, "\"): homepath$ = Left$(homepath$, p)
Shell _Hide "dir /d /s > " + homepath$ + "thelist.txt"
Open homepath$ + "thelist.txt" For Binary As #1
Do
Line Input #1, d$
p = InStr(d$, "Total Files Listed:")
Loop Until p <> 0
' get one more line (one we want)
Line Input #1, d$
Close 1
' work out the byte count total
p = InStr(d$, "(s)")
d$ = Right$(d$, Len(d$) - (p + 3))
p = InStr(d$, " bytes")
d$ = Left$(d$, p - 1)
' remove commas
Do
p = InStr(d$, ",")
If p = 0 Then Exit Do
d$ = Left$(d$, p - 1) + Right$(d$, Len(d$) - p)
Loop
approx_count = Val(d$)
If approx_count < 400 Then GoTo skip_approx
general_count = approx_count / (kicks + 1)
gdefault = (general_count / upper_lim)
gc$ = "For byte count of " + d$ + " suggest a lim total => " + Str$(gdefault) + " (1-40)"
skip_approx:
iq$ = _InputBox$("GB quarters/4", gc$, "-1")
If iq$ = "-1" Then q = gdefault: GoTo valid_input
q = Val(iq$)
If q = 0 Then System
If q < 0 Then Run
If q > 40 Then Run
valid_input:
upper_lim = upper_lim * q
ChDir "x:\"
Shell _Hide "dir *. /b > " + homepath$ + "thelist.txt"
Open homepath$ + "thelist.txt" For Binary As #1
Open homepath$ + "kickit.sort" For Output As #2
If LOF(1) = 0 Then Print "Sorry nothing to see here, put stuff on x:": End
Do Until EOF(1)
Line Input #1, f$
fp$ = "x:\" + f$ + "\"
ChDir fp$
Print fp$
Shell _Hide "dir *.png /b > " + homepath$ + "thelist2.txt"
Open homepath$ + "thelist2.txt" For Binary As #3
If LOF(3) = 0 Then Close 3: GoTo whoopsie ' does not contain png's
Do Until EOF(3)
Line Input #3, d$
Print #2, fp$ + d$
Loop
whoopsie:
Close 3
Loop
Close 1, 2, 3
ChDir "x:\"
Shell _Hide "c:\utils\cmsort.exe " + homepath$ + "kickit.sort " + homepath$ + "kickit.txt"
Cls
Open homepath$ + "kickit.txt" For Binary As #3
j = 0
Do
running_count = 0
If j < 5 Then x = 1: y = (j * sizing) + 10 Else x = 1276: y = (((j - 5) * sizing) + 10)
Open "kickit" + Chr$(48 + j) + ".cmd" For Append As #1
Print #1, "title kickit" + Chr$(48 + j) + ".cmd"
Print #1, "x:"
Print #1, "c:\utils\cmdow @ /mov" + Str$(x) + Str$(y) + " /siz 1281"; sizing
Close 1
Do
Line Input #3, f$
Open "kickit" + Chr$(48 + j) + ".cmd" For Append As #2
Print #2, "start " + Q$ + Q$ + " /high /wait /min C:\pinga\pingo.exe -quiet -pngpalette=40 -s9 " + Q$ + f$ + Q$
Close 2
Open f$ For Binary As #2
running_count = running_count + LOF(2)
Close 2
Locate 4 + j, 1
Print String$(120, " ");
Locate 4 + j, 1
Print Using "##########"; running_count;: Print , f$
If EOF(3) Then killkick j: GoTo exhausted
Loop Until running_count >= upper_lim
killkick j
j = j + 1
Loop Until j = kicks + 1
Beep: Print
Print "something wrong with the kickit.txt, did not exhaust before j count maxed out"; kicks + 1
Input "<enter> to try again."; j
Run
exhausted:
'
' clean up un exported kickit's
'
If j < kicks Then
Print
Input "One chance, run again "; Q$
If UCase$(Q$) = "Y" Then Run
End If
If j < kicks Then x = j + 1 Else End
For j = x To kicks
name$ = "kickit" + Chr$(48 + j) + ".cmd"
If _FileExists(name$) Then Kill name$
Next j
End
Sub killkick (j)
Open "kickit" + Chr$(48 + j) + ".cmd" For Append As #2
Print #2, "del " + "kickit" + Chr$(48 + j) + ".cmd"
Close 2
End Sub