boniakowski Posted June 24, 2014 Share Posted June 24, 2014 Hi, i need your help, i have a simple problem to resolve but my mind it´s stucked. my serach in all the autoit forum don´t have any good result. well this is my problem: i have a computername random, the name its taked from the mac address of the lan board and always keep the first 6 digits but of course change someones at the last, but i don´t know how to make for autocomplete the last digits of the string to compare with the name taked from the actual computer name. this is an example of my script. $Nombre=RegRead("HKLM64\SYSTEM\ControlSet001\Control\ComputerName\ActiveComputerName", "ComputerName") $Nombrenuevo=RegRead("HKLM64\SYSTEM\ControlSet001\Control\ComputerName\ComputerName", "ComputerName") ;THE RESULT OF $NOMBRE IS: abcdef123456 if $Nombre="abcdef######";here must autocomplete the rest of string from abcdef because ###### change the last 6 digits random, but always keep the first 6 digits (abcdef) then MsgBox(0,"",$Nombre & "Is correct" Else MsgBox(0,"",$Nombre & "Is wrong, you need modify this" EndIf any sugestion it welcome. thank you for your help. Christian. Link to comment Share on other sites More sharing options...
Moderators Solution JLogan3o13 Posted June 24, 2014 Moderators Solution Share Posted June 24, 2014 If it is random each time, you can't hard code it. What about checking just the first (static) part of the string? If StringLeft($Nombre, 6) = "abcdef" Then ; Else ; EndIf "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
jchd Posted June 24, 2014 Share Posted June 24, 2014 StringLeft seems to be your friend with this. Argh, faster keyboard won. This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe hereRegExp tutorial: enough to get startedPCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta. SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt) Link to comment Share on other sites More sharing options...
boniakowski Posted June 24, 2014 Author Share Posted June 24, 2014 If it is random each time, you can't hard code it. What about checking just the first (static) part of the string? If StringLeft($Nombre, 6) = "abcdef" Then ; Else ; EndIf Thank you very much JLogan3o13, sometimes its so simple, but my mind was stucked. i look for strininstr, and some more, but never see down. thanks too jchd with your assistance. I appreciate the help I always get on this site, many thanks to all... 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