How do I edit a drop down list displaying too many options? Topic is solved

Get help with using AutoHotkey and its commands and hotkeys
Posts: 96
Joined: 20 Aug 2017, 09:11

How do I edit a drop down list displaying too many options?

14 Feb 2018, 12:54

I have the following code in a Main.ahk file:

Code: Select all

#SingleInstance Force
SetWorkingDir %A_WorkingDir%

	Includelist0 = 0
	InclIdx = 0 ; for handling include files
	splitpath, A_Scriptfullpath, ohname, ohdir, ohext, ohnameNE, ohdrv
HelpText := ""	
	oldTrim := A_AutoTrim
	AutoTrim, On
	HlpSrcFile = %ohname%
	{	fileReadline, thisline, %HlpSrcFile%, %A_Index%
		If ErrorLevel
		; ignore single line comments
		firstch := SubStr(thisline,1,1)
		If (firstch = ";")
		; Ignore IfInString test lines
		IfInString, thisline, IfInString
		; process rem comments
		;IfInString, thisline, %beginBlockComment%
		IfInString, thisline, /*
		{	InComment = 1	
		;IfInString, thisline, %endBlockComment%
		IfInString, thisline, */
		{	InComment = 0
		; handle a line within a block comment
		If (InComment = 1)
		; process hotkey command
		; line as hotkey def there are two forms of a hotkey assignment. one uses the 
		; label Hotkey the other uses the double colon in the key assignment.
		tempstr = %thisline% ;<-- to cause autotrim to activate
		firstword := SubStr(tempstr,1,6)
		;If (firstword = "Hotkey")
		;	HelpText .= tempstr "`n"
		;	Continue
		; double colon hotkey or hotstring
		IfInString, thisline, ::
			HelpText .= thisline "`n", %HlpDestFile%
		; process single line comment statement
		IfInString, thisline, `;
		; handle #include files this is so you can identify
		; hotkeys from additional files
		IfInString, thisline, #IncludeAgain		;<-- ignore multiple includes of the same file
		IfInString, thisline, #Include
		{	InclIdx++ ;<-- count the include file
			IncludeList0 := IncIdx
			inclstr := (SubStr(thisline, 10))
			IncludeList%InclIdx% = %inclstr%
			HelpText .= thisline %a_Index%`n, %HlpDestFile%
	AutoTrim := oldtrim
	; walk backwards through the include files 
	If (InclIdx > 0)
	{	inclstr := IncludeList%InclIdx%
		Splitpath, InclStr,ohname,,,ohnameNE
		HelpText .= Hotkeys included in %ohname%`r`n`r`n, %HlpDestFile%
		Goto A20130124125417

	StringReplace, HelpText, HelpText, Send,, All
	StringReplace, HelpText, HelpText, !,ALT + `r, All
	StringReplace, HelpText, HelpText, #,Windows Key + `r, All
	StringReplace, HelpText, HelpText, ^,CTRL + `r , All
	StringReplace, HelpText, HelpText, {Enter}, `n , All
	StringReplace, HelpText, HelpText, {Tab 3}, `n , All	
	StringReplace, HelpText, HelpText, :, `r`r - , All
	IfInString, HelpText, :
		StringReplace, HelpText, DeleteLine, :, `r`r - , All
Gui, DeleteHotKeys: Show, w330 h140, Delete HotKeys

GameIndex := 0
loop, read, test hotkey.ahk
Game%A_Index% := A_LoopReadLine
Game0 = %A_Index%
    List .= Game%A_Index%  . "|" 
Gui, DeleteHotKeys: Add, DropDownList, x16 y31 w300 vDeleteKey Choose1, %List%
Gui, DeleteHotKeys: Add, Text, x108 y6 w202 h23 +0x200, Select a HotKey to delete:
Gui, DeleteHotKeys: Add, Button, w63 x136 y58 gChoose, Delete
Gui, DeleteHotKeys: Show,,Delete HotKey
Gui, DeleteHotKeys: Submit, Nohide
MsgBox, 36, Continue?, Are you sure you want to delete the selected HotKey? `r`r%DeleteKey%
	IfMsgBox No
	;FileRead(ReadToDelete, Keyboard.ahk)
Sleep 10	

SetWorkingdir, %OldWorkingDir%

; Only need the below to show
!a::Send Active Directory Account Unlock - CHI_CO
!d::Send Active Directory Password Reset - CHI_CO
!m::Send Millennium Account Unlock - CHI_CO

The drop down box that is displayed, is showing every single line of code within my Main.ahk script. I need only the lines after the ; to display. The lines after the ; change text and it may be 3-20 lines. How do I edit my Drop Down Box correctly?
Posts: 506
Joined: 27 Apr 2014, 21:08
Location: Germany

Re: How do I edit a drop down list displaying too many options?  Topic is solved

14 Feb 2018, 16:07

You could add a specific string just above the hotkeys in a comment. In case that the hotkeys are for sure at the end of the file.
With loop/regex/instr you could detect the line and start searching/reading from there.

Return to “Ask For Help”

Who is online

Users browsing this forum: Bing [Bot], Rohwedder, swagfag and 211 guests