print out section name

Get help with using AutoHotkey and its commands and hotkeys
kalik
Posts: 5
Joined: 16 Dec 2014, 07:24

print out section name

16 Dec 2014, 07:53

Hey guys, I'm struggling with a code and need help with one particular piece of code. Below is a snippet.

Code: Select all

#Singleinstance, Force
#NoEnv

SendMode Input
SetWorkingDir %A_ScriptDir%

Gui,Add,Edit,x60 y10 w257 Multi ReadOnly -E0x200 vVC,
Gui,Add,Edit,x60 y40 w257 Multi ReadOnly -E0x200 vNM,

Gui,Add,Text,x5 y10 w55,Test Code
Gui,Add,Text,x5 y40 w55,Test Name

Gui +LastFound +AlwaysOnTop +ToolWindow
WinSet, TransColor, EEAA99
Gui,Show,x823 y353,
Return

GuiClose:
ExitApp
Return

OnClipboardChange:
IniRead, OutputNM, vulns.ini, %clipboard%, NM

GuiControl, , VC, %clipboard%
GuiControl, , NM, %OutputNM%
return
The INI I am reading looks like this:

Code: Select all

[30000301]
NM=Test key value

What I'm trying to do is change

Code: Select all

GuiControl, , VC, %clipboard%
By removing %clipboard% and just print out the Section name from the INI file, in this case 30000301. I can't use clipboard because I want to make the GuiControl part dependant on whether a specific section exist in the ini as such:

Code: Select all

if (OutputVC != "ERROR")
{
GuiControl, , VC, %OutputVC%
GuiControl, , NM, %OutputNM%
}
Any ideas on how to achieve this?
kalik
Posts: 5
Joined: 16 Dec 2014, 07:24

Re: print out section name

17 Dec 2014, 04:28

Screw that, I just added a new key with the section name in it.
just me
Posts: 7582
Joined: 02 Oct 2013, 08:51
Location: Germany

Re: print out section name

17 Dec 2014, 05:43

[AHK_L 57+]: If Key is omitted, the contents of the specified Section are retrieved excluding any comments. If Section is also omitted, OutputVar receives a list of section names where each name is separated by a linefeed character (`n).
Source
kalik
Posts: 5
Joined: 16 Dec 2014, 07:24

Re: print out section name

17 Dec 2014, 06:58

I know of this, I'd have to dump and entire, couple thousand line long document into a string, parse and trim the string to have the specific section I need. Was looking for a more elegant and easy on resources solution.

Return to “Ask For Help”

Who is online

Users browsing this forum: AHKStudent, autohotkeycool, HELLiPOD, Loop, Weshuggah and 51 guests