Jump to content

Recommended Posts

Posted

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?

Posted (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 by Rarst
Posted

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

Posted

$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!"

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...