Sign in to follow this  
Followers 0
Daniel W.

_UniCode UDF

12 posts in this topic

#1 ·  Posted (edited)

Hi,

i wrote this function to get a unique code of a pc.

Updated it and changed the name :D

Here is the code:

Func _UniquePCCode()
    Local $return , $first
    Local $pass = @ComputerName
    $encrypt = _Stringencrypt( 1 , $pass , $pass ) & @OSLang & @OSTYPE & @OSVersion & @OSServicePack & DriveGetSerial("C:\")
    $split = StringSplit( $encrypt , "a|b|c|d|e|f|g|h|i|j|k|l|m|n|o|p|q|r|s|t|u|v|w|x|y|z" )
    For $a = 1 to $split[0]
        For $b = 65 to 90
            If StringInStr( $split[$a] , Chr($B) ) Then
                $split[$a] = StringReplace( $split[$a] , Chr($B), $b )
            EndIf
        Next
        $first &= $split[$a]
    Next
    StringStripWS( $first , 8 )
    $split1 = StringSplit( $first , "_" )
    For $d = 1 to $split1[0]
        $return &= $split[$d]
    Next
    $return = StringMid(  $return ,  StringLen( $return ) / 2 - 3 , 8 )
    $second = Hex($return)
    $return = ""
    $split = StringSplit( $second , "a|b|c|d|e|f|g|h|i|j|k|l|m|n|o|p|q|r|s|t|u|v|w|x|y|z" )
    For $a = 1 to $split[0]
        For $b = 65 to 90
            If StringInStr( $split[$a] , Chr($B) ) Then
                $split[$a] = StringReplace( $split[$a] , Chr($B), $b )
            EndIf
        Next
        $return &= $split[$a]
    Next
    $return = StringMid(  $return ,  StringLen( $return ) / 2 - 3 , 8 )
    Return $return
EndFunc   ;==>_UniquePCCode

Note you need _stringencrypt from string.au3 for it.

Regards

Edited by Daniel W.

--------------------------------------------------------------------------------------------------------------------------------Scripts : _Encrypt UDF_UniquePCCode UDF MS like calculatorInstall programm *UPDATED* --------------------------------------------------------------------------------------------------------------------------------[quote name='Helge' post='213117' date='Jul 26 2006, 10:22 AM']Have you ever tried surfing the internet with a milk-carton ?This is similar to what you're trying to do.[/quote]

Share this post


Link to post
Share on other sites



That's a terribly mis-leading name since there already is a term "unicode" in computing.

Share this post


Link to post
Share on other sites

narg is this a problem?

I can change the name if you want but i though unicode for uniquecode is no problem...


--------------------------------------------------------------------------------------------------------------------------------Scripts : _Encrypt UDF_UniquePCCode UDF MS like calculatorInstall programm *UPDATED* --------------------------------------------------------------------------------------------------------------------------------[quote name='Helge' post='213117' date='Jul 26 2006, 10:22 AM']Have you ever tried surfing the internet with a milk-carton ?This is similar to what you're trying to do.[/quote]

Share this post


Link to post
Share on other sites

So you need me to coerce you into changing the name? The fact that the term has a previous and highly widespread (as in global) definition is not a sufficient reason to stop using the term out of context?

Share this post


Link to post
Share on other sites

I updated it and changed the name


--------------------------------------------------------------------------------------------------------------------------------Scripts : _Encrypt UDF_UniquePCCode UDF MS like calculatorInstall programm *UPDATED* --------------------------------------------------------------------------------------------------------------------------------[quote name='Helge' post='213117' date='Jul 26 2006, 10:22 AM']Have you ever tried surfing the internet with a milk-carton ?This is similar to what you're trying to do.[/quote]

Share this post


Link to post
Share on other sites

I noticed you are trimming white space " " using StringReplace(). Maybe you could try to use StringTrimWS() as it may be slightly faster.

JS


AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Share this post


Link to post
Share on other sites

Done :D Thanks for the tip


--------------------------------------------------------------------------------------------------------------------------------Scripts : _Encrypt UDF_UniquePCCode UDF MS like calculatorInstall programm *UPDATED* --------------------------------------------------------------------------------------------------------------------------------[quote name='Helge' post='213117' date='Jul 26 2006, 10:22 AM']Have you ever tried surfing the internet with a milk-carton ?This is similar to what you're trying to do.[/quote]

Share this post


Link to post
Share on other sites

Done :D Thanks for the tip

NP Glad I could offer some possible help.

I havent seen anything else yet that may help.

JS


AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

Shortened again :D

Replaced this:

Do 
           $return = StringTrimLeft( $return , 1 ) 
           If StringLen( $return ) > 8 Then 
                $return = StringTrimRight( $return , 1 ) 
           EndIf 
      Until StringLen( $return ) = 8
oÝ÷ Ùh­Øb±«­¢+Ø(ÀÌØíÉÑÕɸôMÑÉ¥¹5¥ ÀÌØíÉÑÕɸ°MÑÉ¥¹1¸ ÀÌØíÉÑÕɸ¤¼È´Ì°à¤
Edited by Daniel W.

--------------------------------------------------------------------------------------------------------------------------------Scripts : _Encrypt UDF_UniquePCCode UDF MS like calculatorInstall programm *UPDATED* --------------------------------------------------------------------------------------------------------------------------------[quote name='Helge' post='213117' date='Jul 26 2006, 10:22 AM']Have you ever tried surfing the internet with a milk-carton ?This is similar to what you're trying to do.[/quote]

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

nice work guys, I like it, this will come in handy

Edited by ReaImDown

[u][font="Century Gothic"]~я α и d γ ĵ . ċ . ѕ қ ϊ и и ε я~- My Programs -auto shutdownSleep funcdisallow programs[/font][/u]

Share this post


Link to post
Share on other sites

Hi,

shortened a little bit and made it useable even if there is no drive c:\

Func _UniquePCCode1()
    Local $return, $first
    $split = StringSplit(_StringEncrypt(1, @ComputerName, @ComputerName) & _
            @OSLang & @OSTYPE & @OSVersion & @OSServicePack & DriveGetSerial(StringLeft(@WindowsDir, 3)), _
            "a|b|c|d|e|f|g|h|i|j|k|l|m|n|o|p|q|r|s|t|u|v|w|x|y|z")
    For $a = 1 To $split[0]
        For $b = 65 To 90
            If StringInStr($split[$a], Chr($B)) Then
                $split[$a] = StringReplace($split[$a], Chr($B), $B)
            EndIf
        Next
        $first &= $split[$a]
    Next
    $split1 = StringSplit(StringStripWS($first, 8), "_")
    For $d = 1 To $split1[0]
        $return &= $split[$d]
    Next
    $split = StringSplit(Hex(StringMid($return, StringLen($return) / 2 - 3, 8)), _
            "a|b|c|d|e|f|g|h|i|j|k|l|m|n|o|p|q|r|s|t|u|v|w|x|y|z")
    $return = ''
    For $a = 1 To $split[0]
        For $b = 65 To 90
            If StringInStr($split[$a], Chr($B)) Then
                $split[$a] = StringReplace($split[$a], Chr($B), $B)
            EndIf
        Next
        $return &= $split[$a]
    Next
    Return StringMid($return, StringLen($return) / 2 - 3, 8)
EndFunc   ;==>_UniquePCCode1

So long,

Mega


Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Share this post


Link to post
Share on other sites

Hi,

shortened a little bit and made it useable even if there is no drive c:\

Func _UniquePCCode1()
    Local $return, $first
    $split = StringSplit(_StringEncrypt(1, @ComputerName, @ComputerName) & _
            @OSLang & @OSTYPE & @OSVersion & @OSServicePack & DriveGetSerial(StringLeft(@WindowsDir, 3)), _
            "a|b|c|d|e|f|g|h|i|j|k|l|m|n|o|p|q|r|s|t|u|v|w|x|y|z")
    For $a = 1 To $split[0]
        For $b = 65 To 90
            If StringInStr($split[$a], Chr($B)) Then
                $split[$a] = StringReplace($split[$a], Chr($B), $B)
            EndIf
        Next
        $first &= $split[$a]
    Next
    $split1 = StringSplit(StringStripWS($first, 8), "_")
    For $d = 1 To $split1[0]
        $return &= $split[$d]
    Next
    $split = StringSplit(Hex(StringMid($return, StringLen($return) / 2 - 3, 8)), _
            "a|b|c|d|e|f|g|h|i|j|k|l|m|n|o|p|q|r|s|t|u|v|w|x|y|z")
    $return = ''
    For $a = 1 To $split[0]
        For $b = 65 To 90
            If StringInStr($split[$a], Chr($B)) Then
                $split[$a] = StringReplace($split[$a], Chr($B), $B)
            EndIf
        Next
        $return &= $split[$a]
    Next
    Return StringMid($return, StringLen($return) / 2 - 3, 8)
EndFunc   ;==>_UniquePCCode1

So long,

Mega

even better, lol


[u][font="Century Gothic"]~я α и d γ ĵ . ċ . ѕ қ ϊ и и ε я~- My Programs -auto shutdownSleep funcdisallow programs[/font][/u]

Share this post


Link to post
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
Sign in to follow this  
Followers 0