INI Clickable GUI Text from INI

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Trigg
Posts: 97
Joined: 07 Apr 2017, 19:43

INI Clickable GUI Text from INI

27 Aug 2017, 09:10

So I am trying to make the text in an INI clickable and access invoice numbers on a program we use using COMObj. I have the COMObj part done for the most part, but I am in a stump when trying to come up with a way to get a value of the key and its invoice in a section that is clicked.

INI example:
[Company, LLC]
2017FL023173=UPC-L109~Withdrawn by claimant 08/21/2017
2017FL023288=UPC-P109~Settlement agreed 08/22/2017
2016FL032456=UPC-N109~Settlement agreed 08/25/2017

1. Count INI keys. (Done)

Code: Select all

IniRead, Adjuster, Gui, Azure

Loop, Parse, Adjuster, `n, `r

	If RegExMatch( A_LoopField, "\[.*?]", key )

		data .= ( data ? n " keys" : "" ) "`n" key " has "

		, n := 0

	Else 

		If InStr( A_LoopField, "=" )

			n++

data .= n			; https://autohotkey.com/board/topic/53751-how-to-count-keys-in-a-section-of-an-ini-file/

MsgBox, %data%
2. Loop them individually in GUI then make them clickable. (Unfinished)

Code: Select all

Loop %data%
	Gui, Add, Text, vAdjusterT%A_Index% gShow, %Adjuster%
Gui, Show
Return
3. After clicking, get value of the invoice number (UPC-L109) that is clicked. I used GuiControlGet, but it won't work. Am I using it right? (Unfinished)

Code: Select all

GuiControlGet, AdjusterT%A_Index%,, Text
MsgBox AdjusterT%A_Index%
UPC-L109, UPC-P109, and UPC-N109 are the invoice numbers. I know I need to use RegExReplace to get the invoice numbers, but I don't know how to use RegEx very well. I tried using SubStr and put a "~" after the invoice to make it easier, but did not work as hoped.

Code: Select all

IniRead, Adjuster, Gui, Azure
Adjuster2 := SubStr(Adjuster, InStr(Adjuster, "=") + 1)
MsgBox % SubStr(Adjuster2, InStr(Adjuster2, "~") - 1)
4. Use COMObj for IE to go to the specific invoice number. (Unfinished)
(Done)
BoBo
Posts: 6564
Joined: 13 May 2014, 17:15

Re: INI Clickable GUI Text from INI

27 Aug 2017, 10:05

Clickable content? Have you had a look at Gui, Add, ListViev, ... already??

Code: Select all

invNo := StrSplit("UPC-L109~Withdrawn by claimant 08/21/2017","~")
MsgBox % invNo[1]
Use Gui, Submit, ... to access the content of all variables of your Gui in one go.
Check out IniRead, OutputVarSectionNames, ... and IniRead, OutputVarSection, ... as well!
Trigg
Posts: 97
Joined: 07 Apr 2017, 19:43

Re: INI Clickable GUI Text from INI

27 Aug 2017, 20:53

BoBo wrote:Clickable content? Have you had a look at Gui, Add, ListViev, ... already??

Code: Select all

invNo := StrSplit("UPC-L109~Withdrawn by claimant 08/21/2017","~")
MsgBox % invNo[1]
Use Gui, Submit, ... to access the content of all variables of your Gui in one go.
Check out IniRead, OutputVarSectionNames, ... and IniRead, OutputVarSection, ... as well!

Thank you for your help!! ListView is awesome, this is perfect. And thank you for the StrSplit line; I should've thought about doing split instead of substring.
Trigg
Posts: 97
Joined: 07 Apr 2017, 19:43

Re: INI Clickable GUI Text from INI

28 Aug 2017, 15:28

BoBo wrote:Clickable content? Have you had a look at Gui, Add, ListViev, ... already??

Code: Select all

invNo := StrSplit("UPC-L109~Withdrawn by claimant 08/21/2017","~")
MsgBox % invNo[1]
Use Gui, Submit, ... to access the content of all variables of your Gui in one go.
Check out IniRead, OutputVarSectionNames, ... and IniRead, OutputVarSection, ... as well!
OK. So this is what I have done so far. Question about LV_Modify, upon double clicking a company to get the claim number, how do I get every column to not be duplicated with all of the claim numbers (keys) displayed in rows?

Example INI:
ClaimNo=Invoice~CloseReason Date
2017TX012345=2JD500~Settlement agreed 08/28/2017

Code: Select all

ReopenedClaims:
IniRead, AdjusterIni, W:\Claims\ClaimsOperationsAutomation\Scripts\User & Claim Info\Reopened_Claims.ini
Gui, +AlwaysOnTop
Gui, Font, S8 cBlack Normal, Arial Black

Gui, Add, ListView, gReopenBox vAdjusterT w400 h250, Company|Claim
Loop, Parse, AdjusterIni, `n, `r
    	LV_Add("", A_LoopField)
LV_ModifyCol()
LV_ModifyCol(2, "integer")
Gui, Show,, Res Pend Claims
Exit

ReopenGuiclose:
Gui, Destroy
Exit

ReopenBox:
Gui, Submit, NoHide
	if A_GuiEvent = DoubleClick
		{
		LV_GetText(RowText, A_EventInfo)
		IniRead, AdjusterIni, Gui.ini, %RowText%
		Loop, Parse, AdjusterIni, `n, `r
   			LV_Modify(RowText,"", A_LoopField)
		}

Exit
BoBo
Posts: 6564
Joined: 13 May 2014, 17:15

Re: INI Clickable GUI Text from INI

28 Aug 2017, 15:44

LV_Modify(RowNumber [, Options, NewCol1, NewCol2, ...]) :?:
Trigg
Posts: 97
Joined: 07 Apr 2017, 19:43

Re: INI Clickable GUI Text from INI

29 Aug 2017, 10:58

BoBo wrote:LV_Modify(RowNumber [, Options, NewCol1, NewCol2, ...]) :?:
Awesome! It works now.

How do I get the 2nd column to reset when I double click on another company?

Edit: I figured it out!

Code: Select all

ReopenedClaims:
IniRead, AdjusterIni,  GUI.ini
Gui, Reopen:+AlwaysOnTop +LastFound
Gui, Reopen:Default
Gui, Reopen:Font, S8 cBlack Normal, Arial Black
Gui, Reopen:Add, ListView, gReopenBox Grid vAdjusterT w500 h200, Company|Claim
Loop, Parse, AdjusterIni, `n, `r
    	LV_Add("", A_LoopField, Claim)
LV_ModifyCol()
LV_ModifyCol(1, "Sort CaseLocale")
LV_ModifyCol(1, "Auto")
LV_ModifyCol(2, "AutoHdr")
LV_ModifyCol(2, "Left")
Gui, Reopen:Add, Button, x30 y215 w200 h50 gOpenClaim, Open claim!
Gui, Reopen:Add, Button, x285 y215 w200 h50 gDeleteClaim, Delete claim!
Gui, Reopen:Show, %gui_position% w520 h280, Reserves Pending Authority
Exit

ReopenGuiclose:
Gui, Destroy
Exit

OpenClaim:
ClaimNo := StrSplit(LV_GetSelectedText("2"),"=")
MsgBox % ClaimNo[1]
WinWait, Personal inbox - Google Chrome, 
IfWinNotActive, Personal inbox - Google Chrome, , WinActivate, Personal inbox - Google Chrome, 
WinWaitActive, Personal inbox - Google Chrome, 

Image = SearchBar
ImageClick(Nothing, Image)
Sleep, 50
SendInput, % ClaimNo[1]
Sleep, 50
Image = Search
ImageClick(Nothing, Image)
Exit

DeleteClaim:
ClaimNo := StrSplit(LV_GetSelectedText("2"),"=")
MsgBox % ClaimNo[1]
IniDelete, GUI.ini, %RowText%, % ClaimNo[1]
MsgBox % RowText " " ClaimNo[1] " deleted!"
Exit

ReopenBox:
Gui, Submit, NoHide
	if A_GuiEvent = DoubleClick
		{
		LV_Modify(ActiveRow,"Col2",Content)		; works :)
		LV_GetText(RowText, A_EventInfo)
		IniRead, ClaimNo, GUI.ini, %RowText%
		Loop, Parse, ClaimNo, `n, `r
			LV_Modify(A_Index,"", , A_Loopfield)
		LV_ModifyCol(2, "Auto" "Left" "Uni")
		}
Exit


GuiReopenEscape:
GuiReopenClose:
Gui, Reopen:Destroy
Exit



LV_GetSelectedText(FromColumns="", ColumnsDelimiter="`t", RowsDelimiter= "`n") { ; by Learning one https://autohotkey.com/board/topic/61750-lv-getselectedtext/
if FromColumns = ; than get text from all columns
{
Loop, % LV_GetCount("Column") ; total number of columns in LV
FromColumns .= A_Index "|"
}
if (SubStr(FromColumns,0) = "|")
StringTrimRight, FromColumns, FromColumns, 1
Loop
{
RowNumber := LV_GetNext(RowNumber)
if !RowNumber
break
Loop, parse, FromColumns, |
{
LV_GetText(FieldText, RowNumber, A_LoopField)
Selected .= FieldText ColumnsDelimiter
}
if (SubStr(Selected,0) = ColumnsDelimiter)
StringTrimRight, Selected, Selected, 1
Selected .= RowsDelimiter
}
if (SubStr(Selected,0) = RowsDelimiter)
StringTrimRight, Selected, Selected, 1
return Selected
}

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Google [Bot] and 211 guests