[Lib] String-based Table Manipulation v0.28 - Scripts and Functions - AutoHotkey Community

PHOTO EMBED

Thu Dec 24 2020 06:13:29 GMT+0000 (UTC)

Saved by @Butters1143 #ahk #script

SetTitleMatchMode 2
DetectHiddenText, on
Process, priority, AutoHotkey.exe, high
Process, priority, tn525032.exe, high

SetBatchLines, 20ms
SetKeyDelay, 10ms
SetMouseDelay, 10ms
SetWinDelay, 10ms
SetControlDelay, 10ms
SetWorkingDir , %A_ScriptDir%

#NoEnv
#include DDE.ahk
#include RumbaDDE.ahk
#include Table.ahk
#singleinstance force

Apptitle = AS/400 Pull

secvarorg = 2  ;Number of seconds to wait till autoconnecting to AS400
	
GUI:
Gui, Color, 0xbbd5f4
Gui, Margin, X
Gui, Font, norm
Gui, Font, s7
Gui, Add, Button, gddecount W130, Please Wait...
Gui, Add, Button, gRunIAFEP W130, Please Wait...
Gui, Add, Button, gSetup W130, Run Rumba Setup
Gui, Add, Button, gBUTTONSTOP W130, STOP
;Gui, Add, Button, gddecount W130, count

Gui, Add, GroupBox, YM x+20 section W150 H130, AS/400 Session Select
Gui, Add, Radio, xs+10  ys+20 vRumbaA  gButtonConnect checked	, Session A
Gui, Add, Radio, xs+10  ys+40 vRumbaB  gButtonConnect 			, Session B
Gui, Add, Radio, xs+10  ys+60 vRumbaC  gButtonConnect 			, Session C
Gui, Add, Radio, xs+10  ys+80 vRumbaD  gButtonConnect 			, Session D
Gui, Add, Radio, xs+10  ys+100 vRumbaT gButtonConnect 			, Session Test

Gui, Add, Text, Ym x+70 W100,Auto-Connecting
Gui, Add, Text,  W100,( In %secvarorg% Seconds )
Gui, Add, Text,  W100,
Gui, Add, Text,  W100,
Gui, Add, Text,  W100,

Gui, Show, , %Apptitle%

loop, %secvarorg%
{
sleep,1000
secvarorg--
seccountdown := "( In " secvarorg " Seconds )"
GuiControl,, Static2 , %seccountdown%
}

If ( RumbaB > 0 || RumbaC > 0 || RumbaD > 0 || RumbaT > 0)
{
return
}

goto buttonConnect
return
;~,~`~,~`~,~`~,~`~,~`~,~`~,~`~,~`~,~`~,~`~,~`~,~`~,~`~,~`~,~`~,~`~,~`~,~`~,~`~,~`~,~`


;~,~`~,~`~,~`~,~`~,~`~,~`~,~`~,~`~,~`~,~`~,~`~,~`~,~`~,~`~,~`~,~`~,~`~,~`~,~`~,~`~,~`
ButtonStop:
DDE_Kill()
Return
;~,~`~,~`~,~`~,~`~,~`~,~`~,~`~,~`~,~`~,~`~,~`~,~`~,~`~,~`~,~`~,~`~,~`~,~`~,~`~,~`~,~`


;~,~`~,~`~,~`~,~`~,~`~,~`~,~`~,~`~,~`~,~`~,~`~,~`~,~`~,~`~,~`~,~`~,~`~,~`~,~`~,~`~,~`
buttonConnect:
Gui, Submit, nohide
Start := A_TickCount
SetTimer, ActivateWinUM, 100

if RumbaA = 1
{
Rumbawsf :="A.WSF"
}
if RumbaB = 1
{
Rumbawsf :="B.WSF"
}
if Rumba C = 1
{
Rumbawsf :="C.WSF"
}
if RumbaD = 1
{
Rumbawsf :="D.WSF"
}
if RumbaT = 1
{
Rumbawsf :="TEST.WSF"
}

DDE_Connect("Rumbawsf",Rumbawsf)
DDE_Kill()
Sleep,250
DDE_Connect("Rumbawsf",Rumbawsf)

SetTimer, ActivateWinUM, off
if DDEErrorCount > 2
{
GuiControl,, Static1 , % "Failed Connection"
GuiControl,, Static2 , % "Timeout After: "
GuiControl,, Static3 , % round(connecttimercount) " Seconds"
Return
}
Else
{
ToolTip,||||||||||||||||||||||||||||||||`n||||||||||||||||||||||||||||||||`n||||||||||||||||||||||||||||||||`n`nDDE CONNECTED to %Rumbawsf%`n`n||||||||||||||||||||||||||||||||`n||||||||||||||||||||||||||||||||`n||||||||||||||||||||||||||||||||
SetTimer, RemoveToolTip, 1000
GuiControl,, Static1 , % "Connected"
GuiControl,, Static2 , To: %Rumbawsf%
GuiControl,, Static3 , % "In: " connecttimercount " Seconds"
GuiControl,, Button1, % "Run Create List" 
GuiControl,, Button2, % "Run Delete List" 

return
}
Return

ActivateWinUM:
MouseGetPos,,, WinUMID
ToolTip,Please wait `n`nDDE Connecting to %Rumbawsf%

GuiControl,, Static1 , % "Connecting to"
GuiControl,, Static2 , % "To: " Rumbawsf
connecttimercount := SubStr("0" Floor((A_TickCount - Start) / 1000 - Floor((A_TickCount - Start) / 60000) * 60), -1, 2) "." SubStr("0" Mod(A_TickCount - Start, 1000), -1, 2)
GuiControl,, Static3 , % "For: " connecttimercount " Seconds"

if connecttimercount >= 15
{
DDE_Kill("Rumbawsf",Rumbawsf)
SetTimer, ActivateWinUM, off
ToolTip
msgbox, Make sure the appropriate Rumba Session is Open.
}
return

RemoveToolTip:
SetTimer, RemoveToolTip, Off
ToolTip
return
;~,~`~,~`~,~`~,~`~,~`~,~`~,~`~,~`~,~`~,~`~,~`~,~`~,~`~,~`~,~`~,~`~,~`~,~`~,~`~,~`~,~`


;~,~`~,~`~,~`~,~`~,~`~,~`~,~`~,~`~,~`~,~`~,~`~,~`~,~`~,~`~,~`~,~`~,~`~,~`~,~`~,~`~,~`
Setup:
Rumba := "ahk_class WdPageFrame"
winactivate, %Rumba%
winwaitactive, ahk_class WdPageFrame
IfWinNotActive, %Rumba%, , WinActivate, %Rumba%,	;activates a window if it is not already active
WinWaitActive, %Rumba%, 		
;---Options>Edit
WinMenuSelectItem, %Rumba%,, Options , Edit 										;opens a windows menu
winwait, Edit Options
;---Options>Edit>Features
Control, Check,, button1, Edit Options
sleep, 50
Control, Uncheck,, button2, Edit Options
sleep, 50
Control, Uncheck,, button3, Edit Options
sleep, 50
;---Options>Edit>Parsing
SendMessage, 0x1330, 2,, SysTabControl321, Edit Options
sleep, 50
Control, check,, button2, Edit Options
sleep, 50
WinWait, Edit Options, 
IfWinNotActive, Edit Options, , WinActivate, Edit Options, 
WinWaitActive, Edit Options, 
;---Options>Edit>Ok Button on Parsing Tab
control, check,, button13, Edit Options
;---Options>Display
WinMenuSelectItem, %Rumba%,, Options , Display
winwait, Display Options
sleep, 50
Control, Uncheck,, button8, Display Options ;Input Error Dialog
WinWait, Display Options, 
IfWinNotActive, Display Options, , WinActivate, Display Options, 
WinWaitActive, Display Options, 
;---Options>Display>Ok Button on Display Tab
control, check,, button12, Display Options
SetTitleMatchMode, fast
return
;~,~`~,~`~,~`~,~`~,~`~,~`~,~`~,~`~,~`~,~`~,~`~,~`~,~`~,~`~,~`~,~`~,~`~,~`~,~`~,~`~,~`

RunIAFEP:
WaitStringUni("IND2762")
Loop 16
{
Cashier := AutoBlockUni((8+a_index),8)
RemoveInString(Cashier,,"C N R T") 
;---
fesls := AutoBlockUni((8+a_index),47)
RemoveInString(fesls,,"C N R T")
;---
avgodr := AutoBlockUni((8+a_index),58)
RemoveInString(avgodr,,"C N R T")
;---
MonPerSgnOnHR := AutoBlockUni((8+a_index),71)
RemoveInString(MonPerSgnOnHR,,"C N R T")
;---
MPH := AutoBlockUni((8+a_index),83)
RemoveInString(MPH,,"C N R T")
;---
SgnOffPerNumTans := AutoBlockUni((8+a_index),97)
RemoveInString(SgnOffPerNumTans,,"C N R T")
;---
IPM := AutoBlockUni((8+a_index),107)
RemoveInString(IPM,,"C N R T")
;---
ScanPercent := AutoBlockUni((8+a_index),117)
RemoveInString(ScanPercent,,"C N R T")
;---
ItemsPerMemb := AutoBlockUni((8+a_index),129)
RemoveInString(ItemsPerMemb,,"C N R T")

PGOne .= cashier a_tab fesls a_tab avgodr a_tab MonPerSgnOnHR a_tab MPH a_tab SgnOffPerNumTans a_tab IPM a_tab ScanPercent a_tab ItemsPerMemb "`n"
}
SendDDEUni("@k")
Loop 16
{
InaTime := AutoBlockUni((8+a_index),42)
RemoveInString(InaTime,,"C N R T") 
;---
NumOur := AutoBlockUni((8+a_index),52)
RemoveInString(NumOur,,"C N R T")
;---
Pickups := AutoBlockUni((8+a_index),62)
RemoveInString(Pickups,,"C N R T")
;---
VoidTrans := AutoBlockUni((8+a_index),72)
RemoveInString(VoidTrans,,"C N R T")
;---
FERew := AutoBlockUni((8+a_index),84)
RemoveInString(FERew,,"C N R T")
;---
NumOfMembs := AutoBlockUni((8+a_index),96)
RemoveInString(NumOfMembs,,"C N R T")
;---
PercentKeyed := AutoBlockUni((8+a_index),105)
RemoveInString(PercentKeyed,,"C N R T")
;---
SignOffs := AutoBlockUni((8+a_index),117)
RemoveInString(SignOffs,,"C N R T")
;---
NumItems := AutoBlockUni((8+a_index),129)
RemoveInString(NumItems,,"C N R T")

PGTwo .= InaTime a_tab NumOur a_tab Pickups a_tab VoidTrans a_tab FERew a_tab NumOfMembs a_tab PercentKeyed a_tab SignOffs a_tab NumItems "`n"
Joined := Table_Append( PGOneLeft, PGOneRight,1)
}
SendDDEUni("@k")
/*Loop 16
{
InaTimePerMem := AutoBlockUni((8+a_index),42)
RemoveInString(InaTime,,"C N R T") 
;---
TendTimePerMem := AutoBlockUni((8+a_index),52)
RemoveInString(TendTimePerMem,,"C N R T")
;---
RingTimePerMem := AutoBlockUni((8+a_index),62)
RemoveInString(RingTimePerMem,,"C N R T")
;---
NonSlsTimePerMem := AutoBlockUni((8+a_index),72)
RemoveInString(NonSlsTimePerMem,,"C N R T")
;---
TotTimePerMem := AutoBlockUni((8+a_index),84)
RemoveInString(TotTimePerMem,,"C N R T")
;---
TotSgnOnTime := AutoBlockUni((8+a_index),96)
RemoveInString(TotSgnOnTime,,"C N R T")

PGThree .= InaTimePerMem a_tab TendTimePerMem a_tab RingTimePerMem a_tab NonSlsTimePerMem a_tab TotTimePerMem a_tab TotSgnOnTime "`n"
}
*/
;clipboard := PGO
msgbox % Joined
clipboard := Joined
return
;~,~`~,~`~,~`~,~`~,~`~,~`~,~`~,~`~,~`~,~`~,~`~,~`~,~`~,~`~,~`~,~`~,~`~,~`~,~`~,~`~,~`
content_copyCOPY

https://autohotkey.com/board/topic/61540-lib-string-based-table-manipulation-v028/