Valuater Posted January 5, 2009 Share Posted January 5, 2009 I am reading the Registry and this just looks messy... any thoughts?????? expandcollapse popupGlobal $tCount ; This works _RegHandler( 1, "HKCU", "C:\Program Files\Autoitv3\Examples\Test.txt") ; This does not work - a folder _RegHandler( 3, "HKCU", @ProgramFilesDir & "\Autoitv3test\") ; with and without the last "\" ;Some look like these ; "C:\Program Files\Autoitv3\Examples\Test.txt",1 ; "C:\Program Files\Autoitv3\Examples\Test.txt"|23.. or letters ; I guess i dont need these Func _RegHandler($iLevel, $iKey, $iReg) If StringInStr($iReg, @HomeDrive) And StringLeft($iReg, 1) = StringLeft(@HomeDrive, 1) And Not FileExists($iReg) Then ; GUICtrlSetData($STATUS, $iReg); I use this ;If Not StringInStr($iReg, @CR) And Not StringInStr($iReg, "system32") Then ;MsgBox(0,0,StringLen(StringTrimLeft($iReg, StringInStr($iReg, ".")))) If StringLen(StringTrimLeft($iReg, StringInStr($iReg, "."))) == 3 Then $iReg = FileGetLongName($iReg); doesnt work because it not exist $tCount += 1 MsgBox(4096, $iLevel & "-" & $tCount, $iKey & " " & @CRLF & $iReg, 25) EndIf ;EndIf If StringInStr(FileGetAttrib($iReg), "D") Then ; doesnt work because it not exist $tCount += 1 MsgBox(4096, $iLevel & "-" & $tCount, $iKey & " " & @CRLF & $iReg, 25) EndIf EndIf EndFunc ;==>_RegHandler thx 8) Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted January 5, 2009 Moderators Share Posted January 5, 2009 Found it difficult to understand what you actually wanted. StringRegExpReplace($s_str, "(?i)(.*?)([a-z]:(?:.*?\\)+(.*?\.\w+)*)", "\2")? Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Valuater Posted January 5, 2009 Author Share Posted January 5, 2009 Found it difficult to understand what you actually wanted. StringRegExpReplace($s_str, "(?i)(.*?)([a-z]:(?:.*?\\)+(.*?\.\w+)*)", "\2")? How can I explain when I don't even know... I'm just a bit tired, but I just narrowed down what i had and will be posting the whole prog soon Thanks Ron 8) Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted January 5, 2009 Moderators Share Posted January 5, 2009 (edited) How can I explain when I don't even know... I'm just a bit tired, but I just narrowed down what i had and will be posting the whole prog soon Thanks Ron 8)From your comments (in the code), and what I could make out the others, it looked like you were trying to narrow down the file from the registry return string... my other expression was wrong, this may even need some work... but it looked like it did what you would need to verify:$s_str = '"C:\Program Files\Autoitv3\Examples\Test.txt",1' $s_strip = StringRegExpReplace($s_str, "(?i)(.*?)([a-z]:(?:.*?\\)+(.*?\.\w+)*)(.*?)*\z", "\2") ConsoleWrite($s_str & @CRLF & "Becomes..." & @CRLF & $s_strip & @CRLF) Edited January 5, 2009 by SmOke_N Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Valuater Posted January 5, 2009 Author Share Posted January 5, 2009 From your comments (in the code), and what I could make out the others, it looked like you were trying to narrow down the file from the registry return string... my other expression was wrong, this may even need some work... but it looked like it did what you would need to verify:$s_str = '"C:\Program Files\Autoitv3\Examples\Test.txt",1' $s_strip = StringRegExpReplace($s_str, "(?i)(.*?)([a-z]:(?:.*?\\)+(.*?\.\w+)*)(.*?)*\z", "\2") ConsoleWrite($s_str & @CRLF & "Becomes..." & @CRLF & $s_strip & @CRLF) That might help, I will have to check it out. thanks..!! 8) Link to comment Share on other sites More sharing options...
Valuater Posted January 5, 2009 Author Share Posted January 5, 2009 That cleared more than 95% of the problem files... I do have one ( on my computer) that ends up like this C:\Program Files\Autoitv3\Examples\"Test.txt I know I could string() fix, but if you can add that it would be great My biggest concern is "other" users, because it's just a scanner right now 8) Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted January 5, 2009 Moderators Share Posted January 5, 2009 That cleared more than 95% of the problem files... I do have one ( on my computer) that ends up like thisC:\Program Files\Autoitv3\Examples\"Test.txtI know I could string() fix, but if you can add that it would be greatMy biggest concern is "other" users, because it's just a scanner right now8)You should probably just wrap it in another expression to remove non-standard file characters. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Valuater Posted January 5, 2009 Author Share Posted January 5, 2009 Thanks for the help... appreciated 8) 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