Jump to content

How auto complete String with a 6 digit Pad?


Go to solution Solved by JLogan3o13,

Recommended Posts

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

  • Moderators
  • Solution

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

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 here
RegExp tutorial: enough to get started
PCRE 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

 

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

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
 Share

  • Recently Browsing   0 members

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