DCCD Posted July 27, 2009 Share Posted July 27, 2009 Hi everyone, Key = HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run\AutorunsDisabled value = SunJavaUpdateSched Using RegRead()Return "C:\Program Files\Java\jre1.6.0_06\bin\jusched.exe" ,Thats Cool All i need "jusched.exe", i need name only not showing full path!? NB: The RegKey above is just an example, "jusched.exe" & "RegKey" maybe anything else. I dont like StringRight() function, is there something better? [u][font=Arial Black]M[/font]y Blog, AVSS Parts[/u][font=Arial Black]Else[/font][font=Arial Black]L[/font]ibya Linux Users Group Link to comment Share on other sites More sharing options...
z0mgItsJohn Posted July 27, 2009 Share Posted July 27, 2009 Here's a little function that will give you the correct value. Note : This only works if the return is a file path I.E. "C:\Program Files\Java\jre1.6.0_06\bin\jusched.exe" it will return jusched.exe. Code : Func _GetValue ($iData) $Split = StringSplit ($iData, '\') Return $Split[$Split[0]] EndFunc Hope this helps! >_< - John Latest Projects :- New & Improved TCP Chat Link to comment Share on other sites More sharing options...
DCCD Posted July 27, 2009 Author Share Posted July 27, 2009 Firstly, thank you so much I told you before, "RegKey" maybe anything Ex: Regread return "C:\Program Files\Notebook Hardware Control\nhc.exe" -quiet Your Func will return, nhc.exe" -quiet maybe other idea!, thanks again [u][font=Arial Black]M[/font]y Blog, AVSS Parts[/u][font=Arial Black]Else[/font][font=Arial Black]L[/font]ibya Linux Users Group Link to comment Share on other sites More sharing options...
Rarst Posted July 27, 2009 Share Posted July 27, 2009 (edited) My RegExp skills are bit lacking, but still. >_< This will (I hope) match anything from \ to " or \" $string='"C:\Program Files\Notebook Hardware Control\nhc.exe" -quiet' $pattern='.*\\(.+?)[\\"]' $search=StringRegExp($string,$pattern,1) If Not @error Then $search=$search[0] MsgBox(0,"",$search) EndIf I suppose it can be improved to match end of line... I am no good with end of lines and regexp. Edited July 27, 2009 by Rarst AutoIt tag at Rarst.net Link to comment Share on other sites More sharing options...
z0mgItsJohn Posted July 27, 2009 Share Posted July 27, 2009 Here's a re-write of my function this time it should do the job. Code : Func _GetValue ($iData) $IllegalChars = '\/:*?<>|"' $IllegalChars = StringSplit ($IllegalChars, '') $Split = StringSplit ($iData, '\') $Return = $Split[$Split[0]] For $A = 1 To $IllegalChars[0] $Return = StringReplace ($Return, $IllegalChars[$A],'') Next Return $Return EndFunc Hope this helps! >_< - John Latest Projects :- New & Improved TCP Chat Link to comment Share on other sites More sharing options...
GEOSoft Posted July 27, 2009 Share Posted July 27, 2009 $sVal = RegRead("SomeKey", "SomeValue") $sVal = StringRegExpReplace($sVal, "(.*\\)(.*)", "$2") George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
DCCD Posted July 28, 2009 Author Share Posted July 28, 2009 THANK YOU ALL SO MUCH, >_ [u][font=Arial Black]M[/font]y Blog, AVSS Parts[/u][font=Arial Black]Else[/font][font=Arial Black]L[/font]ibya Linux Users Group 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