steveR Posted March 18, 2005 Posted March 18, 2005 (edited) I tried going through your code, I'm not sure if this is what you are looking for, but maybe it will give you ideas #include <array.au3> $VmApl = "da=397 ga=398 ca=399 fa=400 ta=401 ua=402 -officepro tbd=120" $array = StringRegExp($VmApl, "(\w+)=(\d+)", 2) _arrayDisplay($array, "$VmApl") Msgbox(0, "", _getValue_RoutDev( "RouteDev")) Msgbox(0, "", _getValue_TrunkDev( "TrunkDev")) Func _getValue_RoutDev($Label_RoutDev) $sOut = $array[0] & " = " & $array[1] Return $sOut EndFunc Func _getValue_TrunkDev($Label_TrunkDev) $sOut = $array[2] & " = " & $array[3] Return $sOut EndFunc If you need the -officepro data too, then make the regexp "(\w+)=(\d+)|(-\w+)" Edited March 18, 2005 by steveR AutoIt3 online docs Use it... Know it... Live it...MSDN libraryglobal Help and SupportWindows: Just another pane in the glass.
Markir Posted March 18, 2005 Author Posted March 18, 2005 @SteveR:Thank you for helping, but there is an error, if I run the program$array = StringRegExp($VmApl, "(\w+)=(\d+)", 2) $array = ^ ERROR
MHz Posted March 18, 2005 Posted March 18, 2005 (edited) @MarkirStringRegExp is not a public released function. It was withdrawn from 3.1, for not being finalized of bugs.A beta has been released, to sample, in the developers forum, which contains this function.Edit: If you want the beta files, get it from this thread. Edited March 18, 2005 by MHz
SlimShady Posted March 18, 2005 Posted March 18, 2005 (edited) This is the correct way:$array = StringRegExp("(\w+)=(\d+)", 2)Edit:I forgot the syntax. The above is incorrect.and Mhz is right. Edited March 18, 2005 by SlimShady
steveR Posted March 18, 2005 Posted March 18, 2005 Hmmm, sorry markir. i forgot to say i was using the beta. Other than that, it seems to work AutoIt3 online docs Use it... Know it... Live it...MSDN libraryglobal Help and SupportWindows: Just another pane in the glass.
Markir Posted March 18, 2005 Author Posted March 18, 2005 Okay I have download the Beta Version and now it functioned. But I have one question about your code: Now it displayed for example "PlayDEv=792" but I need "PlayDev 792,793,794,795"
steveR Posted March 18, 2005 Posted March 18, 2005 (edited) Each element of the array returned from the regexp contains part of that string. Show me the code you have so far and I'll see if i can figure it out Edited March 18, 2005 by steveR AutoIt3 online docs Use it... Know it... Live it...MSDN libraryglobal Help and SupportWindows: Just another pane in the glass.
Markir Posted March 18, 2005 Author Posted March 18, 2005 (edited) This is my codé: expandcollapse popup#include <array.au3> $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") $array = StringRegExp($VmApl, "(\w+)=(\d+)", 2) _arrayDisplay($array, "$VmApl") Msgbox(0, "", _getValue_RoutDev( "RouteDev")) Msgbox(0, "", _getValue_TrunkDev( "TrunkDev")) ExitLoop EndIf WEnd Func _getValue_RoutDev($Label_RoutDev) $sOut = $array[0] & " = " & $array[1] Return $sOut EndFunc Func _getValue_TrunkDev($Label_TrunkDev) $sOut = $array[2] & " = " & $array[3] Return $sOut EndFunc Edited March 18, 2005 by Markir
steveR Posted March 18, 2005 Posted March 18, 2005 Okay I have download the Beta Version and now it functioned. But I have one question about your code:Now it displayed for example "PlayDEv=792" but I need "PlayDev 792,793,794,795"<{POST_SNAPBACK}>I don't understand where the numbers are coming from. Show me the PlayDev registry string and then show me exactly how you need it to look in the MsgBox AutoIt3 online docs Use it... Know it... Live it...MSDN libraryglobal Help and SupportWindows: Just another pane in the glass.
Markir Posted March 18, 2005 Author Posted March 18, 2005 This is the registry input:RoutDev=TrunkDev=9601-9630PlayDev=792,793,794,795PickTimeout=15PickHome=20And for example, I need PlayDev=792,793,794,795I hope you understand what I mean
steveR Posted March 18, 2005 Posted March 18, 2005 Like this? #include <array.au3> $VmApl = "RoutDev= TrunkDev=9601-9630 PlayDev=792,793,794,795 PickTimeout=15 PickHome=20" $array = StringRegExp($VmApl, "(\d+,?)", 2) ;_arrayDisplay($array, "$VmApl") Msgbox(0, "", _getValue_RoutDev( "RouteDev")) ;Msgbox(0, "", _getValue_TrunkDev( "TrunkDev")) Func _getValue_RoutDev($Label_RoutDev) $sOut = "PlayDev=" & $array[2] &"," & $array[3] & "," & $array[4] & "," & $array[5] Return $sOut EndFunc ;Func _getValue_TrunkDev($Label_TrunkDev) ; ; $sOut = $array[2] & " = " & $array[3] ; Return $sOut ; ;EndFunc AutoIt3 online docs Use it... Know it... Live it...MSDN libraryglobal Help and SupportWindows: Just another pane in the glass.
steveR Posted March 18, 2005 Posted March 18, 2005 I think I understand what you need, i will try to work on it AutoIt3 online docs Use it... Know it... Live it...MSDN libraryglobal Help and SupportWindows: Just another pane in the glass.
steveR Posted March 18, 2005 Posted March 18, 2005 (edited) If this isn't what you need, maybe you can take some screenshots of regedit so i can see exactly what it looks like. I made a test key in my registry so i could figure it out. Just replace the keys with yours #include <array.au3> $enum = 1 While 1 $subKey = RegEnumVal("HKEY_CURRENT_USER\test",$enum) If @error Then ExitLoop $val = RegRead("HKEY_CURRENT_USER\test", $subKey) If @error Then ExitLoop _showMsg() $enum = $enum + 1 wEnd func _showMsg() msgBox(4096, "Test", $subKey & "=" & $val) endFunc this is a snap of my regedit: Edited March 18, 2005 by steveR AutoIt3 online docs Use it... Know it... Live it...MSDN libraryglobal Help and SupportWindows: Just another pane in the glass.
Markir Posted March 19, 2005 Author Posted March 19, 2005 Thank you for your helping this is the screenshot, there you can see everything you need for helping me...
Markir Posted March 19, 2005 Author Posted March 19, 2005 Your code on top functioned..... Thank youe for your first class help
Markir Posted March 19, 2005 Author Posted March 19, 2005 @SteveR: There is one more problem.... :-( See at the screenshot, if there is a value for RoutDev, for example 400-403, then the information for PlayDev are not the right one.... Any idea?
steveR Posted March 19, 2005 Posted March 19, 2005 (edited) I didnt use regexp because i think there was a bug and it made autoit crash but hope you can use this: #include <array.au3> $VmApl = "RoutDev=400-403 TrunkDev=9601-9630 PlayDev=792,793,794,795 PickTimeout=15 PickHome=20" $array = stringSplit($VmApl, " ", 0) for $e = 1 to ($array[0]) msgBox(0, "Display element " & $e, $array[$e] ) next Edited March 19, 2005 by steveR AutoIt3 online docs Use it... Know it... Live it...MSDN libraryglobal Help and SupportWindows: Just another pane in the glass.
Markir Posted March 20, 2005 Author Posted March 20, 2005 I understand what you mean with crashing autoit, but your version display me all informations in one msgbox, but i need five mesgboxes, for every line one
Developers Jos Posted March 20, 2005 Developers Posted March 20, 2005 I understand what you mean with crashing autoit, but your version display me all informations in one msgbox, but i need five mesgboxes, for every line one<{POST_SNAPBACK}>i get 5 messageboxes with the last posted script.... 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.
Markir Posted March 20, 2005 Author Posted March 20, 2005 (edited) Oh sorry thanks for controling Edit: But it doesn't work with the regkey??? Here is the code: #include <array.au3> $VmApl = Regread("HKLM\SOFTWARE\PP-COM\MRS\VmAPL\01", "ParamBlock") ;$VmApl = "RoutDev=400-403 TrunkDev=9601-9630 PlayDev=792,793,794,795 PickTimeout=15 PickHome=20" $array = stringSplit($VmApl, " ", 0) for $e = 1 to ($array[0]) msgBox(0, "Display element " & $e, $array[$e] ) next Edited March 20, 2005 by Markir
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