LxP Posted July 3, 2005 Share Posted July 3, 2005 Hi guys,I'm an old AutoIt v2.x user who has just been made aware of version 3 with GUI support and everything! It's truly amazing -- goodbye to things like Visual DialogScript and WinBatch! I can't wait to do some heavy stuff with it.Congratulations and thanks to everyone who has been involved in getting AutoIt this far.I've created a thread similar to this in the Idea Lab forum but perhaps someone can offer me a workaround in the meantime if I post here as well.I would like to be able to identify the type of information returned by a RegRead() (REG_SZ, REG_DWORD, etc.) but there appears to be no way to determine this via AutoIt. Is anyone aware of a solution to this that doesn't require the use of an external utility?Regards,Alex Peters Link to comment Share on other sites More sharing options...
Valuater Posted July 3, 2005 Share Posted July 3, 2005 go to help in autoit v3 ( normally through sciTe) type in registry under search and you will get more info on these RegWrite ( "keyname" [,"valuename", "type", value] ) RegRead ( "keyname", "valuename" ) hope that helps 8) Link to comment Share on other sites More sharing options...
LxP Posted July 3, 2005 Author Share Posted July 3, 2005 Thanks for that fast response!I don't think I've phrased myself very well. Let's assume that a RegRead() results in the string "1234" -- how do you determine whether this was REG_SZ ("1234"), REG_DWORD (dword:000004d2) or REG_BINARY (hex:12,34) data?Any of the above data samples will result in a RegRead() return of "1234" and in order to create an identical key in another location, you need to specify the data type to be used (which is unknown to the script because it's lost).Does this better explain what I'm trying to achieve?Regards,Alex Link to comment Share on other sites More sharing options...
Valuater Posted July 3, 2005 Share Posted July 3, 2005 how about this Regread("HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main", "Window Title", "REG_SZ", $I_Title_set) if error... then if $I_Title_set >="" then... **** and Regread("HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main", "Window Title", "??????", $I_Title_set) if error... then if $I_Title_set >="" then... i've used the first one and it works for me just error test if your program doesn't know if it exists hope that helps 8) Link to comment Share on other sites More sharing options...
LxP Posted July 3, 2005 Author Share Posted July 3, 2005 Regread("HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main", "Window Title", "REG_SZ", $I_Title_set)Unfortunately AutoIt says that 3 or 4 is an incorrect number of parameters. It only seems to want 2.Is this possibly some sort of not-yet-documented feature which I'm using incorrectly? The help page only lists two valid parameters: RegRead($KeyName, $ValueName).Regards,Alex Link to comment Share on other sites More sharing options...
Valuater Posted July 3, 2005 Share Posted July 3, 2005 (edited) I noticed that also went i went to look for an example to show youbut.... i found one in one of my programs and yes.... it worksit is in this program.... just search "regread"http://www.autoitscript.com/forum/index.ph...pe=post&id=3043****************** my bad ****************** regwrite does this, sorrygood luck8) Edited July 3, 2005 by Valuater Link to comment Share on other sites More sharing options...
/dev/null Posted July 3, 2005 Share Posted July 3, 2005 Unfortunately AutoIt says that 3 or 4 is an incorrect number of parameters. It only seems to want 2.That's true, there are onyl 2 parameters! @Valuater: Please post your whole script. I don't think it is an AU3 script. I get the same error with official and beta release. AND in the source code there are definitely only two parameters for RegRead !??!CheersKurt __________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf * Link to comment Share on other sites More sharing options...
LxP Posted July 3, 2005 Author Share Posted July 3, 2005 ******************Â my bad ******************regwrite does this, sorryNo problem Valuater, thanks for sticking with me this far! Just to be clear to everyone on what I'm trying to achieve here's a code segment with some missing pieces and hopefully someone can fill in the blanks.; The following code copies a specific name/value pair ; from one location in the registry to another, as ; specified by $sourceKey and $targetKey. func regDataType($key, $name) if (...) then return "REG_BINARY" if (...) then return "REG_DWORD" if (...) then return "REG_EXPAND_SZ" if (...) then return "REG_MULTI_SZ" if (...) then return "REG_SZ" endFunc local $sourceKey = "HKCU\Software\Key 1" local $targetKey = "HKCU\Software\Key 2" local $name = "ArbitraryData" local $value = regRead($sourceKey, $name) local $dataType = regDataType($sourceKey, $name) regWrite($targetKey, $name, $dataType, $value)Thanks to all for your attention!Regards,Alex Link to comment Share on other sites More sharing options...
/dev/null Posted July 3, 2005 Share Posted July 3, 2005 local $dataType = regDataType($sourceKey, $name)I just wrote such a function and submitted it to the development group. Function: RegGetValType().It might or might not appear in one of the next beta snapshots. Keep watching....CheersKurt __________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf * Link to comment Share on other sites More sharing options...
LxP Posted July 3, 2005 Author Share Posted July 3, 2005 (edited) I just wrote such a function and submitted it to the development group. Function: RegGetValType().Thanks Kurt, you're the man (I hope)! Alternatively the data type information could be returned via the @Extended macro when calling RegRead()? Then no further function would be needed:local $sourceKey = "HKCU\Software\Key 1" local $targetKey = "HKCU\Software\Key 2" local $name = "ArbitraryData" local $value = regRead($sourceKey, $name) local $extended = @extended local $dataType if ($extended = 0) then $dataType = "REG_BINARY" if ($extended = 1) then $dataType = "REG_DWORD" if ($extended = 2) then $dataType = "REG_EXPAND_SZ" if ($extended = 3) then $dataType = "REG_MULTI_SZ" if ($extended = 4) then $dataType = "REG_SZ" regWrite($targetKey, $name, $dataType, $value)Soon I'll be able to program that recursive registry key graft routine! Victory will be mine! Regards,Alex Edited July 3, 2005 by LxP Link to comment Share on other sites More sharing options...
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