Markir Posted February 21, 2005 Share Posted February 21, 2005 Hello everybody,I have a question of the string function. I have read in the AutoItHelp, but I think I don't find the right function for me.I use the following Code:$regstring = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\PP-COM\MRS\IsdnApl\Protocols\01", "ParamBlock") $var = StringMid($regstring,4,4) MsgBox(0, "String Test", $var)In this Registrykey is the following text:da=397 ga=398 ca=399 fa=400 ta=401 ua=402 -officepro tbd=120I want to read the "397", "398",...., "402", but the lenght of the number can be variable, for example the text could be "8000", "8001",...,"8005".Can somebody give me a tip? Link to comment Share on other sites More sharing options...
Josbe Posted February 21, 2005 Share Posted February 21, 2005 Here a small tip(proof), you could try another ways too: $sVar = "da=397 ga=398555 ca=399 fa=400 ta=401 ua=402 -officepro tbd=120" Msgbox(0, "", _getValue( "ua" )) Func _getValue( $sLabel ) $sOut = StringTrimLeft( $sVar, StringInStr($sVar, $sLabel & "=")) $sOut = StringMid($sOut, StringInStr($sOut, "=")+1, (StringInStr($sOut, " ") - StringInStr($sOut, "="))) Return $sOut EndFunc AUTOIT > AutoIt docs / Beta folder - AutoIt latest beta Link to comment Share on other sites More sharing options...
Markir Posted February 21, 2005 Author Share Posted February 21, 2005 Thank you this code give me the right function, I need. Link to comment Share on other sites More sharing options...
Markir Posted February 24, 2005 Author Share Posted February 24, 2005 Hello Josbe, I have one more question about the String Function: How can I get a string till a ","? I have a variable which is "Administrator,xxxx" and I want to get the word before the ",". Link to comment Share on other sites More sharing options...
MHz Posted February 24, 2005 Share Posted February 24, 2005 $result = StringSplit('Administrator,xxxx', ',') $result is an array. $result[1] should equal Administrator. $result[2] should equal xxxx Link to comment Share on other sites More sharing options...
Markir Posted February 24, 2005 Author Share Posted February 24, 2005 Thanks I have got the first value! Link to comment Share on other sites More sharing options...
Markir Posted March 5, 2005 Author Share Posted March 5, 2005 I have one question for the following script: It does work so far, but if the registry key don't have values "FA", "TA" or "UA" the script writes the values of "DA", "GA" and "CA", but this isn't right for the function... What can I do ? expandcollapse popup#Region PhoneMail Abfrage $PM_Protocol = 1 While 1 $key = RegEnumKey("HKLM\SOFTWARE\PP-COM\MRS\IsdnApl\Protocols",$PM_Protocol) If @error Then ExitLoop $str = RegRead("HKLM\SOFTWARE\PP-COM\MRS\IsdnApl\Protocols\" & $key,"Name") $PM_Protocol = $PM_Protocol + 1 If $str = ("PhoneMail") Then $PM_Protocol = Regread("HKLM\SOFTWARE\PP-COM\MRS\IsdnApl\Protocols\" & $key, "ParamBlock") Msgbox(0,"Test",$PM_Protocol) Msgbox(0, "", _getValue_PM_Direct_Access( "DA")) Msgbox(0, "", _getValue_PM_Direct_Access( "GA")) Msgbox(0, "", _getValue_PM_Direct_Access( "CA")) Msgbox(0, "", _getValue_PM_Direct_Access( "FA")) Msgbox(0, "", _getValue_PM_Direct_Access( "TA")) Msgbox(0, "", _getValue_PM_Direct_Access( "UA")) ExitLoop EndIf WEnd #EndRegion PhoneMail Abfrage #Region PhoneMail Einstellungen Func _getValue_PM_Direct_Access($Label_PM_Direct_Access) $sOut = StringTrimLeft($PM_Protocol, StringInStr($PM_Protocol, $Label_PM_Direct_Access & "=")) $sOut = StringMid($sOut, StringInStr($sOut, "=") + 1, (StringInStr($sOut, " ") - StringInStr($sOut, "="))) Return $sOut EndFunc ;==>_getValue_PM_Direct_Access Func _getValue_PM_Guest_Access($Label_PM_Guest_Access) $sOut = StringTrimLeft($PM_Protocol, StringInStr($PM_Protocol, $Label_PM_Guest_Access & "=")) $sOut = StringMid($sOut, StringInStr($sOut, "=") + 1, (StringInStr($sOut, " ") - StringInStr($sOut, "="))) Return $sOut EndFunc ;==>_getValue_PM_Guest_Access Func _getValue_PM_Callback_Access($Label_PM_Callback_Access) $sOut = StringTrimLeft($PM_Protocol, StringInStr($PM_Protocol, $Label_PM_Callback_Access & "=")) $sOut = StringMid($sOut, StringInStr($sOut, "=") + 1, (StringInStr($sOut, " ") - StringInStr($sOut, "="))) Return $sOut EndFunc ;==>_getValue_PM_Callback_Access Func _getValue_PM_Fax_Access($Label_PM_Fax_Access) $sOut = StringTrimLeft($PM_Protocol, StringInStr($PM_Protocol, $Label_PM_Fax_Access & "=")) $sOut = StringMid($sOut, StringInStr($sOut, "=") + 1, (StringInStr($sOut, " ") - StringInStr($sOut, "="))) Return $sOut EndFunc ;==>_getValue_PM_Fax_Access Func _getValue_PM_Transfer_Access($Label_PM_Transfer_Access) $sOut = StringTrimLeft($PM_Protocol, StringInStr($PM_Protocol, $Label_PM_Transfer_Access & "=")) $sOut = StringMid($sOut, StringInStr($sOut, "=") + 1, (StringInStr($sOut, " ") - StringInStr($sOut, "="))) Return $sOut EndFunc ;==>_getValue_PM_Transfer_Access Func _getValue_PM_Universal_Access($Label_PM_Universal_Access) $sOut = StringTrimLeft($PM_Protocol, StringInStr($PM_Protocol, $Label_PM_Universal_Access & "=")) $sOut = StringMid($sOut, StringInStr($sOut, "=") + 1, (StringInStr($sOut, " ") - StringInStr($sOut, "="))) Return $sOut EndFunc ;==>_getValue_PM_Universal_Access #EndRegion PhoneMail Einstellungen Link to comment Share on other sites More sharing options...
Markir Posted March 5, 2005 Author Share Posted March 5, 2005 Another Question: I have the following Code: expandcollapse popup$VmApl = 1 While 1 $key = RegEnumKey("HKLM\SOFTWARE\PP-COM\MRS\VmApl",$VmApl) If @error Then ExitLoop $str = RegRead("HKLM\SOFTWARE\PP-COM\MRS\VmAPL\" & $key,"ScriptName") $VmApl = $VmApl + 1 If $str = ("acd.e") Then $VmApl = Regread("HKLM\SOFTWARE\PP-COM\MRS\VmAPL\" & $key, "ParamBlock") Msgbox(0, "", _getValue_RoutDev( "RouteDev")) Msgbox(0, "", _getValue_TrunkDev( "TrunkDev")) Msgbox(0, "", _getValue_PlayDev( "PlayDev")) Msgbox(0, "", _getValue_PickTimeOut( "PickTimeOut")) Msgbox(0, "", _getValue_PickHome( "PickHome")) ExitLoop EndIf WEnd Func _getValue_RoutDev($Label_RoutDev) $sOut = StringTrimLeft($VmApl, StringInStr($VmApl, $Label_RoutDev & "=")) $sOut = StringMid($sOut, StringInStr($sOut, "=") + 1, (StringInStr($sOut, " ") - StringInStr($sOut, "="))) Return $sOut EndFunc Func _getValue_TrunkDev($Label_TrunkDev) $sOut = StringTrimLeft($VmApl, StringInStr($VmApl, $Label_TrunkDev & "=")) $sOut = StringMid($sOut, StringInStr($sOut, "=") + 1, (StringInStr($sOut, " ") - StringInStr($sOut, "="))) Return $sOut EndFunc Func _getValue_PlayDev($Label_PlayDev) $sOut = StringTrimLeft($VmApl, StringInStr($VmApl, $Label_PlayDev & "=")) $sOut = StringMid($sOut, StringInStr($sOut, "=") + 1, (StringInStr($sOut, " ") - StringInStr($sOut, "="))) Return $sOut EndFunc Func _getValue_PickTimeOut($Label_PickTineOut) $sOut = StringTrimLeft($VmApl, StringInStr($VmApl, $Label_PickTineOut & "=")) $sOut = StringMid($sOut, StringInStr($sOut, "=") + 1, (StringInStr($sOut, " ") - StringInStr($sOut, "="))) Return $sOut EndFunc Func _getValue_PickHome($Label_PickHome) $sOut = StringTrimLeft($VmApl, StringInStr($VmApl, $Label_PickHome & "=")) $sOut = StringMid($sOut, StringInStr($sOut, "=") + 1, (StringInStr($sOut, " ") - StringInStr($sOut, "="))) Return $sOut EndFunc The value of the Regkey is the following: RoutDev= TrunkDev=9601-9630 PlayDev=792,793,794,795 PickTimeout=15 PickHome=20 And I need the values after the "=" in the different msgbox. Can somebody help me, please? Link to comment Share on other sites More sharing options...
Developers Jos Posted March 5, 2005 Developers Share Posted March 5, 2005 where are these WORDS exactly located in the registry : RoutDev= TrunkDev=9601-9630 PlayDev=792,793,794,795 PickTimeout=15 PickHome=20 Under one of these ? RegEnumKey("HKLM\SOFTWARE\PP-COM\MRS\VmApl",$VmApl) RegRead("HKLM\SOFTWARE\PP-COM\MRS\VmAPL\" & $key,"ScriptName") SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Markir Posted March 5, 2005 Author Share Posted March 5, 2005 Hi, all these parameters are under this key "RegRead("HKLM\SOFTWARE\PP-COM\MRS\VmAPL\" & $key,"ScriptName")" in one row not in a block Link to comment Share on other sites More sharing options...
Markir Posted March 7, 2005 Author Share Posted March 7, 2005 @Jdeb, Do you found something in the code, to extract the keys? Link to comment Share on other sites More sharing options...
Markir Posted March 8, 2005 Author Share Posted March 8, 2005 @Jedb: Do you have some information for me? Link to comment Share on other sites More sharing options...
SumTingWong Posted March 8, 2005 Share Posted March 8, 2005 @Jedb:Do you have some information for me?<{POST_SNAPBACK}>Why don't you export the key to a file and paste content here. It would help with figuring out what you are trying to do. Link to comment Share on other sites More sharing options...
Markir Posted March 8, 2005 Author Share Posted March 8, 2005 This is the regkey:RoutDev=TrunkDev=9601-9630PlayDev=792,793,794,795PickTimeout=15PickHome=20And I want to have the values after the "="! Link to comment Share on other sites More sharing options...
Nutster Posted March 9, 2005 Share Posted March 9, 2005 This is the regkey:And I want to have the values after the "="!<{POST_SNAPBACK}>Try extracting them with the StringRegExp in the beta. For each line, do:$array = StringRegExp("(\w+)\s*=\s*(\d+)", $regstring, 1)The array will contain the name of value in element 0, and the number will be in element 1. The number will stored as a string, but it is easy enough to convert. David NuttallNuttall Computer Consulting An Aquarius born during the Age of Aquarius AutoIt allows me to re-invent the wheel so much faster. I'm off to write a wizard, a wonderful wizard of odd... Link to comment Share on other sites More sharing options...
Markir Posted March 9, 2005 Author Share Posted March 9, 2005 How can I integrated your Code to my Code? Link to comment Share on other sites More sharing options...
Markir Posted March 15, 2005 Author Share Posted March 15, 2005 Why does nobody help me, to solve my problem? Link to comment Share on other sites More sharing options...
Markir Posted March 17, 2005 Author Share Posted March 17, 2005 @Jdeb, have you any idea, how I can realise it? Link to comment Share on other sites More sharing options...
steveR Posted March 17, 2005 Share Posted March 17, 2005 Try extracting them with the StringRegExp in the beta. For each line, do:$array = StringRegExp("(\w+)\s*=\s*(\d+)", $regstring, 1)The array will contain the name of value in element 0, and the number will be in element 1. The number will stored as a string, but it is easy enough to convert.<{POST_SNAPBACK}>I think maybe it should be written like this:$array = StringRegExp($regstring, "(\w+)\s*=\s*(\d+)", 1) AutoIt3 online docs Use it... Know it... Live it...MSDN libraryglobal Help and SupportWindows: Just another pane in the glass. Link to comment Share on other sites More sharing options...
Markir Posted March 17, 2005 Author Share Posted March 17, 2005 @SteveR: Can you say it to me with the whole code??? 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