Friday, January 9, 2015

Tool for work

PDF ดึงข้อความออกจาก PDF (Last 4.00)

       PDFTOTEXT    http://www.foolabs.com/xpdf/download.html

PDF CROP ตัดขนาด PDF (Last 0.02)

      PDFSCISSORS https://sites.google.com/site/pdfscissors/

PDFTK Server แยก PDF (Last 2.02)

      PDFTK https://www.pdflabs.com/tools/pdftk-server/


AUTOHOTKEY

      AHK http://ahkscript.org/download/
     *StdoutToVar_CreateProcess* function run in x64

example

SetTitleMatchMode, 2
SetTitleMatchMode, slow
; history
; 1 add QR for Kanban
; 2 fix reprint make QR skid error
; 3 add plantcode in QR
Gui, +Resize
Gui, Add, Button, default, TMT Kanban
Gui, Add, Button, default, TPCAP Kanban
Gui, Add, Button, default, Nissan Kanban
Gui, Add, Button, default, Seperate PDF
Gui, Add, Button, default, Recut
Gui, Show
return

ButtonRecut:
{
WinWait, PDF Scissors,
IfWinNotActive, PDF Scissors, , WinActivate, PDF Scissors,
WinWaitActive, PDF Scissors,
ResizeWin(1024,768)
tmtcut()
}
return
ButtonNissanKanban:
{
loop
{
sleep, 1000
WinGetTitle, Title, A
Needle=Reader
StringGetPos, pos, Title, %Needle%
;msgbox %pos% %Title% %Needle%
if pos+0>=0
break
}
WinWait,%Title%,
IfWinNotActive, %Title%, , WinActivate, %Title%,
WinWaitActive, %Title%,
send, !{F4}
sleep ,2000
WinWait, PDF Scissors
IfWinNotActive, PDF Scissors, , WinActivate, PDF Scissors,
WinWaitActive, PDF Scissors,
send, !{F4}
sleep, 2000
}
return

ButtonTMTKanban:
FileSelectFile, file,,, Select a PDF file:, PDF (*.pdf)
if file =
{
msgbox "non select file"
    return
}
else
{
pdftotext(file)
;msgbox "p1"
typecut:=pdfplantcheck(file,"AMCACOOAADD11")
pause
;msgbox %typecut%
pdfextract(file,"-----------------------------------------","PDS")
; msgbox "p2"
;pdfextract(file,"2UGHU","KB") 'scp vm
if typecut=1
{
pdfextract(file,"QUANTITY/PACK ORDER NO.","KB")
}
else
{
pdfextract(file,"After Sort","KB")
}
; msgbox "p3"
;pdfextract(file,"12BBBBBBBBBB2)BBBBBBBBBB.","SK") 'scp vm
pdfextract(file,"SUPPLIER PICK UP ROUTE","SK")
; msgbox "p4"
opencut(rename(file,"_KB.pdf"),typecut)
;msgbox "p5"
deletefile:=rename(file,".txt")
;msgbox "p6"
FileDelete, %deletefile%
;msgbox "p7"
tempfile:=rename(file,"_KB_scissored.pdf")
pdftotext(tempfile)
pdfextract(rename(file,"_KB_scissored.pdf"),"","R")
deletefile:=rename(file,"_KB_scissored.txt")
FileDelete, %deletefile%
msgbox COMPLETED
ExitApp
}
return
ButtonSeperatePDF:
FileSelectFile, file,,, Select a PDF file:, PDF (*.pdf)
if file =
{
msgbox "non select file"
    return
}
else
{
StringMid,name,file,1,strlen(file)-4
commandx=pdftk.exe A="%file%" dump_data
;msgbox %commandx%
sOutput:= StdoutToVar_CreateProcess(commandx)
Needle=NumberOfPages
StringGetPos, pos, sOutput, %Needle%
StringMid,sOutput,sOutput,pos+15,10
sOutput:=trim(sOutput)
msgbox %sOutput%
sOutput+=0
half_output:=Ceil(sOutput/2)
msgbox %half_output%
commandx=pdftk.exe A="%file%" cat A1-%half_output% output "%name%_1.pdf"
msgbox %commandx%
runwait %commandx%
half_output:=half_output+1
commandx=pdftk.exe A="%file%" cat A%half_output%-%sOutput% output "%name%_2.pdf"
msgbox %commandx%
runwait %commandx%
}
return
GuiClose:
ExitApp

pdftotext(file)
{
StringMid,name,file,1,strlen(file)-4
prog2run =%file%
;prog2run =%1% ;from command line argument
commandx=pdftotext.exe "%prog2run%" "%name%.txt"
;commandx=pdftotext.exe "13-11-2012_PDS&KB GW_x_scissored.pdf" 2.txt
;msgbox %commandx%
runwait %commandx%
}

pdfplantcheck(file,needle2)
{
StringMid,name,file,1,strlen(file)-4
pdstextname=%name%_skid_label.txt
pdstextkb=%name%_qr_kb.txt
if FileExist(pdstextname)
filedelete,%pdstextname%
if FileExist(pdstextkb)
filedelete,%pdstextkb%
PDS_L=
PDS_ID=
PDS_ID_P=
mark_t=
mark_e=
mark2_t=
mark2_partno=
mark2_qkb=
mark2_plancode=
mark2_totalqty=
mark3=
count2=0
ArrayCount = 0
Loop, Read,%name%.txt    ; This loop retrieves each line from the file, one at a time.
{
line1=
line2=
ArrayCount += 1  ; Keep track of how many items are in the array.
Array%ArrayCount% := A_LoopReadLine  ; Store this line in the next array element.
Needle=
StringGetPos, pos1, A_LoopReadLine, %Needle%
StringMid, line1, A_LoopReadLine, pos1+2, 999
StringGetPos, pos4, A_LoopReadLine, %Needle2% ;check D1
if instr(line1,"AMCACOOAA")
{
PDS_L:=strlen(line1)
if (PDS_L=31) ;Reprint
{
PDS_ID:=substr(line1,2,2)substr(line1,7,1)substr(line1,9,1)substr(line1,11,1)substr(line1,12,1)substr(line1,14,1)substr(line1,16,1)substr(line1,18,1)substr(line1,20,2)substr(line1,23,1)substr(line1,25,1)substr(line1,27,1)substr(line1,29,1)
mark2_t:=1
mark2_partno:=ArrayCount+22 ;partno
mark2_plancode:=ArrayCount+24 ;plantcode
mark2_qkb:=ArrayCount+30 ;qty
;msgbox "t1" %line1% `nLine %PDS_ID%
}
else
{
if (PDS_L=30) ;P1 ,S1 ,C2 , T8 ,B2
{
PDS_ID:=substr(line1,2,2)substr(line1,7,1)substr(line1,9,1)substr(line1,11,1)substr(line1,12,1)substr(line1,14,1)substr(line1,16,1)substr(line1,18,1)substr(line1,20,2)substr(line1,23,1)substr(line1,24,1)substr(line1,26,1)substr(line1,28,1)
mark2_t:=1
mark2_partno:=ArrayCount+22 ;partno
mark2_plancode:=ArrayCount+24 ;plantcode
mark2_qkb:=ArrayCount+30 ;qty
;msgbox "R1" %line1% `nLine %PDS_ID%
}
else
{
if (strlen(line1)=28) ;D1 ,G2 ,XA , XB
{
PDS_ID:=substr(line1,2,2)" "substr(line1,8,1)substr(line1,10,1)substr(line1,11,1)substr(line1,13,1)substr(line1,15,1)substr(line1,17,1)substr(line1,19,3)substr(line1,22,1)substr(line1,24,1)substr(line1,26,1)
mark2_t:=1
mark2_partno:=ArrayCount+22 ;partno
mark2_plancode:=ArrayCount+24 ;plantcode
mark2_qkb:=ArrayCount+30 ;qty
;msgbox "t2" %line1% `nLine %PDS_ID%
}
else{ ;BN,Z1 29
;*1G1GMAMCACOOAAZZ11AA0000033*
;*1B1MB AMCACOOAABBNNA2889955*
if instr(line1,"ZZ11")
{
PDS_ID:=substr(line1,2,2)" "substr(line1,8,1)substr(line1,10,1)substr(line1,11,1)substr(line1,12,1)substr(line1,14,1)substr(line1,16,1)substr(line1,18,1)substr(line1,20,1)substr(line1,22,1)substr(line1,24,1)substr(line1,26,1)substr(line1,28,1)
}else{
PDS_ID:=substr(line1,2,2)substr(line1,7,1)substr(line1,9,1)substr(line1,11,1)substr(line1,12,1)substr(line1,14,1)substr(line1,16,1)substr(line1,18,1)substr(line1,20,3)substr(line1,24,1)substr(line1,26,1)substr(line1,28,1)
}
mark2_t:=1
mark2_partno:=ArrayCount+22 ;partno
mark2_plancode:=ArrayCount+24 ;plantcode
mark2_qkb:=ArrayCount+30 ;qty
;msgbox "t3" %line1% `nLine %PDS_ID%
}
}
;msgbox %PDS_ID% %line1% %PDS_L%
}
}
if instr(line1,"BB22") ;B2
{
mark2_t:=1
mark2_partno:=ArrayCount+22 ;partno
mark2_plancode:=ArrayCount+24 ;plantcode
mark2_qkb:=ArrayCount+28 ;qty
;msgbox "t4" %line1% `nLine %PDS_ID%
}
if instr(line1,"TT88") ;T8
{
mark2_t:=1
mark2_partno:=ArrayCount+14 ;partno
mark2_plancode:=ArrayCount+24 ;plantcode
mark2_qkb:=ArrayCount+22 ;qty
;msgbox "t4" %line1% `nLine %PDS_ID%
}

if instr(line1,"TOTAL")
{
mark_t:=1
mark_e:=ArrayCount+2
}
if (mark_t=1) && (ArrayCount=mark_e)
{
;msgbox %line1%
if (line1+0<>0)
{
FileAppend, %PDS_ID%|%line1%`n, %pdstextname%
}
mark_t:=0
}
if (mark2_t=1) && (ArrayCount=mark2_partno)
{
if (line1+0<>0)
{
StringReplace, line1, line1, CB3,, 1
StringReplace, line1, line1, CB2,, 1
StringReplace, line1, line1, CB1,, 1
StringReplace, line1, line1, -,, 1
StringReplace, line1, line1, %a_space%%a_space%,%a_space%, 1
StringReplace, line1, line1, %a_space%, |, 1
StringSplit, array_partno, line1, |
}
}
if (mark2_t=1) && (ArrayCount=mark2_plancode)
{
if (line1+0<>0)
{
StringReplace, line1, line1, %a_space%, |, 1
StringSplit, array_plantcode, line1, |
}
}
if (mark2_t=1) && (ArrayCount=mark2_qkb)
{
if (line1+0<>0)
{
StringReplace, line1, line1, %a_space%, |, 1
StringSplit, array_qty, line1, |
}
if mark2_totalqty>0
mark2_t:=1
else{
Loop, %array_qty0%
{
partno:= array_partno%a_index%
plantcode:= array_plantcode%a_index%
qty:= array_qty%a_index%
FileAppend, %PDS_ID%|%partno%|%plantcode%|%qty%`n, %pdstextkb%
}
mark2_qkb:=0
mark2_t:=0
}
}
if instr(line1,"ZZ11")||instr(line1,"DD11") ; flowlackless
{
count2:=count2+1
mark2_qkb:=ArrayCount+26  ;kb
mark2_totalqty:=ArrayCount+34 ;total qty

}
if (mark2_t=1) && (ArrayCount=mark2_totalqty)
if (line1+0<>0)
{
StringReplace, line1, line1, %a_space%, |, 1
StringSplit, array_tt, line1,|
z:=0
Loop, %array_qty0%
{
y:=a_index+z
partno:= array_partno%y%
qty:= array_qty%a_index%
plantcode:= array_plantcode%y%
tt:= array_tt%y%
if mark3<>1
{
a:=SubStr(qty, 1, 1)
b:=SubStr(qty, 0, 1)
if (a+0)*(b+0)=tt {
FileAppend, %PDS_ID%|%partno%|%plantcode%|%b%`n, %pdstextkb%
;msgbox "test2"
}
else{
old_qty:=qty
z:=z-1
mark3:=1
;msgbox %qty%,%tt%,%a%,%b%
}
}
else
{
if (old_qty+0)*(qty+0)=tt
FileAppend, %PDS_ID%|%partno%|%plantcode%|%qty%`n, %pdstextkb%
else
msgbox "ERROR" %tt%,%qty%,%old_qty%,%a%,%b% %PDS_ID%|%partno%|%plantcode%|%a_index%
mark3:=
}
;msgbox %tt%,%qty%,%old_qty%,%a%,%b% %PDS_ID%|%z%|%a_index%
}
mark2_totalqty:=0
}
}

;msgbox b-%blank% c-%count% p-%page% s-%skid% c2-%count2% p2-%page2%
if instr("Z1,D1",substr(PDS_ID,9,2)) ;if count2=0
count:=2
else
count:=1
return count
}
pdfextract(file,Needle2,rename)
{
StringMid,name,file,1,strlen(file)-4
count=0
page=0
skid=
count2=0
ArrayCount = 0
checkpage=0
Loop, Read,%name%.txt    ; This loop retrieves each line from the file, one at a time.
{
line1=
line2=
ArrayCount += 1  ; Keep track of how many items are in the array.
Array%ArrayCount% := A_LoopReadLine  ; Store this line in the next array element.
Needle=
StringGetPos, pos1, A_LoopReadLine, %Needle%
StringMid, line1, A_LoopReadLine, pos1+2, 999
StringGetPos, pos2, line1, %Needle%
StringMid, line2, line1, pos2+2, 999
StringGetPos, pos3, line2, %Needle%
StringGetPos, pos4, A_LoopReadLine, %Needle2%

if Needle2=TOTAL
{
Needle3=CONTINUE
StringGetPos, pos5, A_LoopReadLine, %Needle3%
}
if pos4+0>=0||pos5+0>=0
if checkpage=0
{
page2:=page+1
skid=%skid%|%page2%
count2:=count2+1
checkpage=1
}
if pos1+0>=0
{
checkpage=0
page:=page+1
}
if pos2+0>=0
{
checkpage=0
page:=page+1
count:=count+1
blank=%blank%|%page%
}
if pos3+0>=0
{
checkpage=0
page:=page+1
count:=count+1
blank=%blank%|%page%
}
}
;msgbox %blank% %count% %page% %skid% %count2% %page2%
if Needle2=
{
StringMid, blank, blank, 2, 999999
StringSplit, blankArray, blank, |
stringx3=
L:=1
H:=1
blankpage=
loop, %blankArray0%
{
blankpage:=blankArray%a_index%
;msgbox %L% %H% %blankpage% /%stringx% /%blank% %count% %page%
if H+0 {
H:=blankpage-1
if L+0=H+0
{
stringx3=%stringx3% A%L%
}
else{
stringx3=%stringx3% A%L%-%H%
}
H:=H+2
L:=H
}
if H+0=blankpage+0
{
H:=H+1
L:=H
}
;msgbox %L% %H% %blankpage% /%stringx% /%blank% %count% %page%
}
;msgbox %L% %H% %blankpage% /%stringx% /%blank% %count% %page%
if H+0 stringx3=%stringx3% A%H%-%page%
commandx=pdftk.exe A="%file%" cat %stringx3% output "%name%_r.pdf"
;msgbox %commandx%
runwait %commandx%
}
else
{
StringMid, skid, skid, 2, 999999
StringSplit, skidArray, skid, |
stringx=
stringx2=
L:=1
H:=1
L2:=1
H2:=1
skidpage=
loop, %skidArray0%
{
skidpage:=skidArray%a_index%
;remain
if H+0 {
H:=skidpage-1
if L+0=H+0
{
stringx=%stringx% A%L%
}
else{
stringx=%stringx% A%L%-%H%
}
H:=H+2
L:=H
}
if H+0=skidpage+0
{
H:=H+1
L:=H
}
;move
if L2+0=1 && skidpage+0>1
{

L2:=skidpage
H2:=L2
}
else
{
if H2+1=skidpage+0
{
H2:=H2+1
}
else
{
if L2+0=H2+0
stringx2=%stringx2% A%L2%
else
stringx2=%stringx2% A%L2%-%H2%
L2:=skidpage
H2:=L2
}
}
;msgbox %skidpage% %L2% %H2% %stringx2%
}
if L2+0=H2+0
stringx2=%stringx2% A%L2%
else
stringx2=%stringx2% A%L2%-%H2%
;msgbox %stringx% /%blank% %count% %page% /%stringx2%
commandx=pdftk.exe A="%file%" cat %stringx2% output "%name%_%rename%.pdf"
;msgbox %commandx%
runwait %commandx%
;commandx=pdftk.exe A="%file%" cat %stringx% output "%name%_%rename%_n.pdf"
;msgbox %commandx%
;runwait %commandx%
}
}

ResizeWin(Width = 0,Height = 0) ; resize and center
{

 WinGetPos,X,Y,W,H,A
  If %Width% = 0
Width := W
  If %Height% = 0
Height := H
  ;WinMove,A,,%X%,%Y%,%Width%,%Height%
  x:=(A_ScreenWidth-Width)/2
  Y:=(A_ScreenHeight-Height)/2
  WinMove,A,,%X%,%Y%,%Width%,%Height%
  ;msgbox  %W% %H% ,%X%,%Y%
}
opencut(file,type) ;1 normal, 2 for d1
{
run pdfscissors.jar
WinWait, PDF Scissors,
IfWinNotActive, PDF Scissors, , WinActivate, PDF Scissors,
WinWaitActive, PDF Scissors,
WinGet, c_max,MinMax, A
if c_max = 1
WinRestore,PDF Scissors
ResizeWin(1024,768)
send, ^o
sleep, 1000
WinWait, Open pdf,
IfWinNotActive, Open pdf, , WinActivate, Open pdf,
WinWaitActive, Open pdf,
;MouseClick, left,  77,  187
send, {tab 2}{space}
sleep, 1000
send, {tab}{space}
sleep, 1000
send, {tab}
sleep, 1000
send, {space}
;PixelGetColor, color, 19,  219 ; ACCEPT
;if color <> FFFFFF
; MouseClick, left,  19,  219
sleep, 1000
MouseClick, left,  472,  61
sleep, 2000
WinWait, Open,
IfWinNotActive, Open, , WinActivate, Open,
WinWaitActive, Open,
send, %file%
sleep, 5000
send, {tab 2}
sleep, 2000
send, {space}
sleep, 4000
MouseClick, left,  391,  285
sleep, 1000
IfWinNotActive, Open pdf
{
WinWaitClose, Open pdf,
}
sleep, 2000
Loop ; prepare
{
;PixelGetColor, color, 158,  12 ; color
;if color <> 294585
IfWinActive, Stack creation
{
WinWaitClose, Stack creation,
}

WinWait, PDF Scissors,
IfWinNotActive, PDF Scissors, , WinActivate, PDF Scissors,
WinWaitActive, PDF Scissors,
break
}
Sleep, 5000
if type=1
tmtcut()
if type=2
tmtd1cut()

send, ^s
sleep, 2000
WinWait, Save,
IfWinNotActive, Save, , WinActivate, Save,
WinWaitActive, Save,
sleep, 4000
;MouseClick, left,  534,  348
send,{Enter}
sleep, 1000
WinWaitActive , Confirm overwrite  , ,2
IfWinActive , Confirm overwrite
send,{Enter}
/*
loop
{
sleep, 1000
WinGetTitle, Title, A
Needle=Reader
StringGetPos, pos, Title, %Needle%
;msgbox %pos% %Title% %Needle%
if pos+0>=0
break
}
WinWait,%Title%,
IfWinNotActive, %Title%, , WinActivate, %Title%,
WinWaitActive, %Title%,
send, !{F4}
sleep ,20000
WinWait, PDF Scissors
IfWinNotActive, PDF Scissors, , WinActivate, PDF Scissors,
WinWaitActive, PDF Scissors,
send, !{F4}
sleep, 20000
*/
msgbox Wait for close
}
tmtcut()
{
MouseClick, left,  1013,  110, 3 ;move to top

MouseClick, left,  91,  70
;MouseClickDrag, L,  627,  135,1180,  390 ;large display
;MouseClickDrag, L,  287,  108,840,  363 ;scp vm
MouseClickDrag, L,  302,  106,826,  347 ; Paper mistake A4 to letter
;click box
;MouseClick, left,  95,  79 ;large display
MouseClick, left,  91,  70
;click box
;MouseClickDrag, L,  627,  410,1180,  664 ;large display
;MouseClickDrag, L,  287,  383,840,  637 ;scp vm
MouseClickDrag, L,  302,  365,826,  606 ; Paper mistake A4 to letter
;click box
;MouseClick, left,  95,  79 ;large display
MouseClick, left,  91,  70
MouseClick, left,  1008,  689
;MouseClickDrag, L,  627,  684,1180,  939 ;large display
;MouseClickDrag, L,  287,  452,840,  707 ;scp vm
MouseClickDrag, L,  302,  465,826,  706 ; Paper mistake A4 to letter
}
tmtd1cut()
{
MouseClick, left,  1013,  110, 3 ;move to top

MouseClick, left,  91,  70
;MouseClickDrag, L,  627,  135,1180,  390 ;large display
;MouseClickDrag, L,  287,  108,840,  363 ;scp vm
MouseClickDrag, L,  302,  106,826,  347 ; Paper mistake A4 to letter
;click box
;MouseClick, left,  95,  79 ;large display
MouseClick, left,  91,  70
;click box
;MouseClickDrag, L,  627,  410,1180,  664 ;large display
;MouseClickDrag, L,  287,  383,840,  637 ;scp vm
MouseClickDrag, L,  302,  365,826,  606 ; Paper mistake A4 to letter
;click box
;MouseClick, left,  95,  79 ;large display
MouseClick, left,  91,  70
MouseClick, left,  1008,  689
;MouseClickDrag, L,  627,  684,1180,  939 ;large display
;MouseClickDrag, L,  287,  452,840,  707 ;scp vm
MouseClickDrag, L,  302,  465,826,  706 ; Paper mistake A4 to letter
}
rename(in,text)
{
StringMid,in,in,1,strlen(in)-4
out=%in%%text%
return out
}

StdoutToVar_CreateProcess(sCmd, bStream="", sDir="", sInput="")
{
bStream=   ; not implemented
sDir=   ; not implemented
sInput= ; not implemented
 
DllCall("CreatePipe", "Ptr*", hStdInRd , "Ptr*", hStdInWr , "Uint", 0, "Uint", 0)
DllCall("CreatePipe", "Ptr*", hStdOutRd, "Ptr*", hStdOutWr, "Uint", 0, "Uint", 0)
DllCall("SetHandleInformation", "Ptr", hStdInRd , "Uint", 1, "Uint", 1)
DllCall("SetHandleInformation", "Ptr", hStdOutWr, "Uint", 1, "Uint", 1)

; Fill a StartupInfo structure
if A_PtrSize = 4 ; We're on a 32-bit system.
{
VarSetCapacity(pi, 16, 0)
sisize := VarSetCapacity(si, 68, 0)
NumPut(sisize, si,  0, "UInt")
NumPut(0x100, si, 44, "UInt")
NumPut(hStdInRd , si, 56, "Ptr") ; stdin
NumPut(hStdOutWr, si, 60, "Ptr") ; stdout
NumPut(hStdOutWr, si, 64, "Ptr") ; stderr
}
else if A_PtrSize = 8 ; We're on a 64-bit system.
{
VarSetCapacity(pi, 24, 0)
sisize := VarSetCapacity(si, 96, 0)
NumPut(sisize, si,  0, "UInt")
NumPut(0x100, si, 60, "UInt")
NumPut(hStdInRd , si, 80, "Ptr") ; stdin
NumPut(hStdOutWr, si, 88, "Ptr") ; stdout
NumPut(hStdOutWr, si, 96, "Ptr") ; stderr
}

DllCall("CreateProcess", "Uint", 0 ; Application Name
,  "Ptr", &sCmd    ; Command Line
   , "Uint", 0 ; Process Attributes
   , "Uint", 0 ; Thread Attributes
,  "Int", True ; Inherit Handles
   , "Uint", 0x08000000 ; Creation Flags (0x08000000 = Suppress console window)
   , "Uint", 0 ; Environment
   , "Uint", 0 ; Current Directory
,  "Ptr", &si   ; Startup Info
,  "Ptr", &pi) ; Process Information

DllCall("CloseHandle", "Ptr", NumGet(pi, 0))
DllCall("CloseHandle", "Ptr", NumGet(pi, A_PtrSize))
DllCall("CloseHandle", "Ptr", hStdOutWr)
DllCall("CloseHandle", "Ptr", hStdInRd)
DllCall("CloseHandle", "Ptr", hStdInWr)

VarSetCapacity(sTemp, 4095)
nSize := 0
loop
{
result := DllCall("Kernel32.dll\ReadFile", "Uint", hStdOutRd, "Ptr", &sTemp, "Uint", 4095, "UintP", nSize, "Uint", 0)
if (result = "0")
break
else
sOutput := sOutput . StrGet(&sTemp, nSize, "CP850")
}

DllCall("CloseHandle", "Ptr", hStdOutRd)
return, sOutput
}


F12::Reload
Pause::Pause
;Press ESC to cancel this scipt
#q::ExitApp
ExitApp