autoitNOW Posted July 2, 2004 Posted July 2, 2004 (edited) Hi, I want to add the "value data" argument to RegRead and not just the "value name". The help example only shows "value name". What also seems weird is that you can put "value data" in arguments for RegWrite. How do you get RegRead to do a if "value data" exist type of argument? Help example- RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion", "ProgramFilesDir") But want for RegRead to do- ("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion", "ProgramFilesDir");value name, "C:\Program Files" ;value data RegRead ( "keyname", "valuename" ) RegRead reads back the value data, but I want to check if the a certain value data exists. would like to see RegRead ("keyname", "valuename", "valuedata") or something that could do If Regkey exits... Thanks in advance Edited July 2, 2004 by autoitNOW An ADVOCATE for AutoIT
emmanuel Posted July 2, 2004 Posted July 2, 2004 (edited) it does what you want it to do... I guess the helpfile's a little confusing to you? I can understand, but look at the example there again:$var = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion", "ProgramFilesDir") MsgBox(4096, "Program files are in:", $var)but, right in the parameters table, it explains what it means by valuename, that it's the value to read...The more I think about it, the more it does seem a bit poorly worded, how could it be said better?RegRead ( "keyname" , "valuename" )keyname = the registry key to readvaluename = the value name to read data from.would that slight change make it better? In regedit they're called value name and value data, so I think it'd be best to stick with those names, even if it's a little confusing?I don't know... it didn't mess me up when I went to use it, but I can see how the wording could be better... Edited July 2, 2004 by emmanuel "I'm not even supposed to be here today!" -Dante (Hicks)
autoitNOW Posted July 2, 2004 Author Posted July 2, 2004 (edited) Yeah, I phrased that wrong. I wanted something more like to check if this regkey value data exist "C:\Program Files" than do... whatever.... As oppose to reading back to me what the reg value data is in a message box or giving me an error message that no value data exist. For instance I might want to do X if the regkey value data is "C:\Program Files", but I want to do something else if the regkey value data is "X:\Program Files" Thanks... Edited July 2, 2004 by autoitNOW An ADVOCATE for AutoIT
autoitNOW Posted July 2, 2004 Author Posted July 2, 2004 (edited) emmanuel said: The more I think about it, the more it does seem a bit poorly worded, how could it be said better?RegRead ( "keyname" , "valuename" )keyname = the registry key to readvaluename = the value name to read data from.would that slight change make it better? In regedit they're called value name and value data, so I think it'd be best to stick with those names, even if it's a little confusing?I don't know... it didn't mess me up when I went to use it, but I can see how the wording could be better...keyname = the registry key to readvaluename = the value name that the value data will be read fromReturn ValueSuccess: Returns the requested valuedata...Failure: Returns numeric 1 and sets the @error flag: 1 if unable to open requested key -1 if unable to open requested value -2 if value type not supported Edited July 2, 2004 by autoitNOW An ADVOCATE for AutoIT
emmanuel Posted July 2, 2004 Posted July 2, 2004 autoitNOW said: Yeah, I phrased that wrong. I wanted something more like to check if this regkey value data exist "C:\Program Files" than do... whatever.... As oppose to reading back to me what the reg value data is in a message box or giving me an error message that no value data exist. For instance I might want to do X if the regkey value data is "C:\Program Files", but I want to do something else if the regkey value data is "X:\Program Files" Thanks...so do a little if then statement? $var = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion", "ProgramFilesDir") if $var = "c:\program files" then ;do something elseif $var = "x:\program files" then ;do something else elseif $var = 1 then ;do something else entirely endif something like that? at that point, a Select ... Case ... EndSelect might make more sense, just depends on how many options you're shooting for... also might want to capture the @error return to supply propper error handling.. "I'm not even supposed to be here today!" -Dante (Hicks)
autoitNOW Posted July 2, 2004 Author Posted July 2, 2004 Yeah, that will defintely work. Thanks again... I also think that would be really great to put in the AutoIt help file as an example for noobs that face the "If regkey exist" type issue. An ADVOCATE for AutoIT
emmanuel Posted July 2, 2004 Posted July 2, 2004 it's really just a case of your not knowing how the language works. to be blunt. if you'd read the Language Referance section of the helpfile you would have understood that you can check any value with if ... then ... elseif ... else. it's got nothing to do with checking if registry keys are or aern't there. "I'm not even supposed to be here today!" -Dante (Hicks)
autoitNOW Posted July 2, 2004 Author Posted July 2, 2004 (edited) My point was how to use AutoIt to check for regkey valuedata and to solve a problem. Hey, there are people that are new to Autoit and programming. Forgive me, if I do not know all the Autoit commands. I'm studying... But something that is obvious to you, may not be to a newbie or somebody that does not do this all the time, which is why people ask questions. I'm sure you asked a question or 2 or more... If you noticed there are a number of questions being asked. Well... thanks anyway, your help was greatly appreciated. Edited July 2, 2004 by autoitNOW An ADVOCATE for AutoIT
emmanuel Posted July 2, 2004 Posted July 2, 2004 it wasn't meant to be an insult, just a suggestion. "I'm not even supposed to be here today!" -Dante (Hicks)
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now