Posts: 795
Threads: 136
Joined: Feb 2009
Hello
sorry to seem so dumb, but if i can easily retreive a key value in registry, i can't find a way to store all values.
Ex: i have a key like this : HKEY_CURRENT_USER\Software\MySoftware which contains many datas.
I want to get all datas of that key, not a specific one.
str s
rget(s "" "Software\MySoftware" HKEY_CURRENT_USER) does not work.
Any idea?
Thanks
Posts: 12,087
Threads: 142
Joined: Dec 2002
Macro
Macro1779
ARRAY ( str ) a
sys. RegGetValues ( a "Software\gindi\qm2\settings" 0 1 )
int i
for i 0 a.len
, out F"{a[0 i]}={a[1 i]}"
Posts: 795
Threads: 136
Joined: Feb 2009
it's a normal windows key, not related to QM
And i don't want an array with key pairs, but a string variable containing all datas, like a .reg file
or exported file.
Sorry for being unclear
Posts: 12,087
Threads: 142
Joined: Dec 2002
Posts: 12,087
Threads: 142
Joined: Dec 2002
Quote: And i don't want an array with key pairs, but a string variable containing all datas, like a .reg file
or exported file.
QM does not have such function, but you can use regedit with command line to export a key to .reg. Google for regedit command line.
Posts: 12,087
Threads: 142
Joined: Dec 2002
Also can be used API functions RegSaveKey and RegRestoreKey, but the exported data is binary, and it can be imported to registry only on same Windows OS version.
Posts: 795
Threads: 136
Joined: Feb 2009
Ok, was actually looking for a way to avoid using regedit. Maybe in a future QM version wishlist.
Can QM intercept regedit output to put it in a variable instead of writing a file?
Posts: 12,087
Threads: 142
Joined: Dec 2002
No.
Run regedit with run flag 0x400 (wait for exit). Then load the output file into a str variable with getfile.
Posts: 12,087
Threads: 142
Joined: Dec 2002
Actually such QM functions exist, but they export to an XML file, not to a reg file.
You can find them in first topic of QM Extensions subforum. Also attached here.
Attached Files
Registry export import XML.qml (Size: 3.3 KB / Downloads: 493)
Posts: 795
Threads: 136
Joined: Feb 2009
Love the xml stuff, there is a xml to txt function available?
Posts: 12,087
Threads: 142
Joined: Dec 2002
XML is a text format.
If you need to store XML text to a str variable instead of file, you can easily edit the functions.
Posts: 795
Threads: 136
Joined: Feb 2009
i was thinking of a function to convert xml file to plain text file to convert it in .reg....
run "C:\Windows\regedit.exe" "/E q:\MyKey.reg ''HKEY_CURRENT_USER\Software\MyKey''" "" "" 0x400
does not work....
Posts: 12,087
Threads: 142
Joined: Dec 2002
Works on my PC. Maybe regedit is disabled on your PC.
Posts: 795
Threads: 136
Joined: Feb 2009
Nope, was a runas problem.
adding 16|0x10400 at the end of command line makes it work