You could try
get the queryregistry "HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBC.INI\ODBC Data Sources"
If the key doesn't exist "the result" will contain "no key"
I don't have any odbc stuff set up so don't have a way to check this here but it should get you close.
Thank you - that is good to know and it works to pull the value of a specific key.
But I described the requirement poorly. What I really need is the listing of key names. For instance, when I click on ODBC\ODBC.ini\ODBC Data Sources in the registry tree, the right pane displays the listing of DSN names. In my case the value of each is SQL Server, and I can retrieve that value by using your suggested approach, but I don't really need the key value, just the name. I would want to populate a list with multiple values such as:
DW1
Lawson_Prod
Kronos_Test
So I'm not sure how to touch those values, and now it seems like I would need some kind of loop to bring them all back.
Thanks again - relative LC newbie here, but my project is coming along nicely except for the DSN issue.
Try listregistry("HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBC.INI\ODBC Data Sources")
I'm not at a Windows computer at the moment, but it has a chance of working. The ListRegistry function was introduced as an experimental feature in LC 4.5. It's still listed as "experimental", so there are no guarantees.
If Marks idea doesn't work you could use shell instead.
The following code will grab a whole branch of the registry and put it into the msg box (only tested on win 7) Since I don't have any odbc datasources my example just grabs anything below ODBCINST.INI (rather than ODBC.INI so that I actually get results back)
Once you get the path pointed to the right place you should be able to parse the returned info for what you need.
put "REG QUERY" && quote & "HKLM\SOFTWARE\ODBC\ODBCINST.INI" & quote && "/s" into tShell
put shell(tShell)
mwieder wrote:Try listregistry("HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBC.INI\ODBC Data Sources")
I'm not at a Windows computer at the moment, but it has a chance of working. The ListRegistry function was introduced as an experimental feature in LC 4.5. It's still listed as "experimental", so there are no guarantees.
I couldn't get Mark's code to return the data I need (although it did work fine for other registry keys), but the shell approach worked fine. Now I have several entries like: