Sign in to follow this  
Followers 0
AppTux

PowerPasswordGenerator

9 posts in this topic

I made this because I always forgot passwords and I don't want to make a new password again, and again and so on.

So I made PowerPasswordGenerator, with a random generator and a algorithm made by myself :P

WARNING:Use this on your own risk, I'm not responsible for any accounts hacked by hackers :) If you want to use this, just modify the algorithm(not too much work I think :) )

With the algorithm can you make passwords using a username. Then are there several calculations and there you are: a password.

With the random function can you 'randomly' make passwords.

All the passwords are in the same form: 2 letters, a special character ! # = -, 2 digits, again a special character ! # = -, and again 2 letters.

A password can look like this(made with random) : ng-79#qa.

I think they're safe enough, but if you have more recommendations let me know!! :D

If you have questions, ask them and I'll try to answer them!

Code:

#include <WindowsConstants.au3>
#include <GuiConstantsEx.au3>
#include <GUIEdit.au3>
#include <StaticConstants.au3>

Global $hMSG, $PROGRESS, $PROGRESSBACK, $PROGRESSCHUNK, $LASTINPUT = "Username", $TOOSHORT = 0, $BUT_LOCATION = @ScriptDir &"\Data\"

;---GUI Design---;
$MGUI = GUICreate("PowerPassWordGenerator", 530, 350, -1, -1, $WS_POPUP)
GUISetBkColor(0xFFFFFF, $MGUI)
$TIMG = GUICtrlCreatePic(@ScriptDir & "\Data\ppg-window-topleft.bmp", 0, 0, 444, 75, -1, $GUI_WS_EX_PARENTDRAG)
$TMMG = GUICtrlCreatePic(@ScriptDir & "\Data\ppg-window-topmiddle.bmp", 444, 18, 70, 57, -1, $GUI_WS_EX_PARENTDRAG)
$TRMG = GUICtrlCreatePic(@ScriptDir & "\Data\ppg-window-topright.bmp", 514, 0, 16, 75, -1, $GUI_WS_EX_PARENTDRAG)
$BIMG = GUICtrlCreatePic(@ScriptDir & "\Data\ppg-window-bottom.bmp", 0, 75, 529, 275, $GUI_DISABLE)
$CIMG = GUICtrlCreatePic(@ScriptDir & "\Data\ppg-close-normal.bmp", 470, 1, 44, 18)
$MIMG = GUICtrlCreatePic(@ScriptDir & "\Data\ppg-min-normal.bmp", 444, 1, 26, 18)
;---==>End of GUI design---;
$STATUS = GUICtrlCreateLabel("", 10, 329, 350, 20, $SS_NOTIFY)
GUICtrlSetBkColor($STATUS, $GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetFont($STATUS, 9, "", "", "Segoe UI")
$RCRN = _WinAPI_CreateRoundRectRgn(0, 0, 530, 350, 2, 2)
_WinAPI_SetWindowRgn($MGUI, $RCRN)
;---Left Content---;
$ALGOHEADER = GUICtrlCreateLabel("Generate password using algorithm:", 20, 90, 240, 22)
GUICtrlSetColor($ALGOHEADER, 0x477e5e)
GUICtrlSetFont($ALGOHEADER, 11, "", "", "Segoe UI")
$ALGOINPUT = GUICtrlCreateInput("Username", 20, 120, 200, 22)
$GBUT1 = GUICtrlCreatePic(@ScriptDir & "\Data\ppg-button-normal.bmp", 20, 145, 150, 25)
$GLAB1 = GUICtrlCreateLabel("Generate password", 20, 145, 150, 25, $SS_NOTIFY & $SS_CENTER)
$G1ST = GUICtrlCreatePic(@ScriptDir & "\Data\ppg-message-good.bmp", 170, 145, 25, 25)
$G1SLAB = GUICtrlCreateLabel("", 195, 145, 40, 25, $SS_NOTIFY & $SS_CENTER)
GUICtrlSetColor($G1SLAB, 0x8f0808)
$RANDHEADER = GUICtrlCreateLabel("Generate random password:", 20, 170, 240, 22)
GUICtrlSetColor($RANDHEADER, 0x477e5e)
$GBUT2 = GUICtrlCreatePic(@ScriptDir & "\Data\ppg-button-normal.bmp", 20, 195, 150, 25)
$GLAB2 = GUICtrlCreateLabel("Generate password", 20, 195, 150, 25, $SS_NOTIFY & $SS_CENTER)
GUICtrlSetFont($GLAB2, 9, "", "", "Segoe UI")
GUICtrlSetBkColor($GLAB2, $GUI_BKCOLOR_TRANSPARENT)
For $i = $ALGOINPUT To $GLAB2
    GUICtrlSetFont($i, 9, "", "", "Segoe UI")
    GUICtrlSetBkColor($i, $GUI_BKCOLOR_TRANSPARENT)
Next
GUICtrlSetFont($RANDHEADER, 11, "", "", "Segoe UI")
;---==>End of Left Content---;
;---Right Content---;
$RHEADER = GUICtrlCreateLabel("Press a 'generate password' button", 330, 90, 190, 50)
GUICtrlSetColor($RHEADER, 0x477e5e)
GUICtrlSetFont($RHEADER, 11, "", "", "Segoe UI")
$LABRESULT = GUICtrlCreateLabel("Result: ", 330, 130, 200, 20)
$GBUT3 = GUICtrlCreatePic(@ScriptDir & "\Data\ppg-button-normal.bmp", 330, 270, 150, 25)
$GLAB3 = GUICtrlCreateLabel("Reset", 330, 270, 150, 25, $SS_NOTIFY & $SS_CENTER)
$PROGRESSBACK = GUICtrlCreatePic(@ScriptDir & "\Data\ppg-progress-back.bmp", 330, 300, 190, 20)
$PROGRESSCHUNK = GUICtrlCreatePic(@ScriptDir & "\Data\ppg-progress-chunk.bmp", 331, 301, 1, 18)
$PROGRESSPERCENT = GUICtrlCreateLabel("0%", 330, 300, 190, 20, $SS_NOTIFY & $SS_CENTER)
For $i = $LABRESULT To $PROGRESSPERCENT
    GUICtrlSetBkColor($i, $GUI_BKCOLOR_TRANSPARENT)
    GUICtrlSetFont($i, 9, "", "", "Segoe UI")
Next
;--==>End of Right Content---;
GUISetState()

While 1
    $USERNAME = GUICtrlRead($ALGOINPUT)
    $LEN = StringLen($USERNAME)
    If $USERNAME <> $LASTINPUT Then
        If $LEN < 5 Then
            If $TOOSHORT = 0 Then
                GUICtrlSetImage($G1ST, @ScriptDir & "\Data\ppg-message-wrong.bmp")
                GUICtrlSetData($G1SLAB, "Too short")
                GUICtrlSetData($STATUS, "Too short username")
                GUICtrlSetColor($G1SLAB, 0x8f0808)
                $TOOSHORT = 1
            EndIf
        Else
            If $TOOSHORT = 1 Then
                GUICtrlSetImage($G1ST, @ScriptDir & "\Data\ppg-message-good.bmp")
                GUICtrlSetData($G1SLAB, "")
                GUICtrlSetData($STATUS, "")
                GUICtrlSetColor($G1SLAB, 0x17a800)
                $TOOSHORT = 0
            EndIf
        EndIf
        $LASTINPUT = $USERNAME
    EndIf
    Switch GUIGetMsg($MGUI)
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
    $hMSG = GUIGetCursorInfo($MGUI)
    If $hMSG[4] = $GLAB1 Then
        _HoverBut($GBUT1, $GLAB1, "_AlgoNew", "button")
    ElseIf $hMSG[4] = $GLAB2 Then
        _HoverBut($GBUT2, $GLAB2, "_RandomPassWord", "button")
    ElseIf $hMSG[4] = $GLAB3 Then
        _HoverBut($GBUT3, $GLAB3, "_Reset", "button")
    ElseIf $hMSG[4] = $CIMG Then
        _HoverBut($CIMG, $CIMG, "_Exit", "close")
    ElseIf $hMSG[4] = $MIMG Then
        _HoverBut($MIMG, $MIMG, "_Minimalise", "min")
    EndIf
WEnd

Func _Exit()
    Exit
EndFunc   ;==>_Exit

Func _Minimalise()
    GUISetState(2)
EndFunc   ;==>_Minimalise

Func _Reset()
    GUICtrlSetData($LABRESULT, "Result: ")
    _SetProgress(0)
    GUICtrlSetData($ALGOINPUT, "Username")
    GUICtrlSetData($STATUS, "")
EndFunc   ;==>_Reset

Func _SetProgress($PERCENT)
    GUICtrlSetData($PROGRESSPERCENT, $PERCENT & "%")
    If $PERCENT = 0 Then $PERCENT = 1
    GUICtrlSetPos($PROGRESSCHUNK, 331, 301, $PERCENT * 1.88, 18)
    Sleep(20);For cool down CPU usage and let the animation see.
EndFunc   ;==>_SetProgress

Func _HoverBut($bID, $lID, $FuncID, $ImageID)
    GUICtrlSetImage($bID, $BUT_LOCATION&"ppg-" & $ImageID & "-hover.bmp")
    While $hMSG[4] = $lID
        $hMSG = GUIGetCursorInfo($MGUI)
        $MSG = GUIGetMsg()
        Sleep(20);Be nice to your CPU!!
        If $MSG = $bID Then
            If $hMSG[2] = 1 Then
                GUICtrlSetImage($bID, $BUT_LOCATION&"ppg-" & $ImageID & "-press.bmp")
                $hMSG = GUIGetCursorInfo($MGUI)
                While $hMSG[2] = 1
                    $hMSG = GUIGetCursorInfo($MGUI)
                    Sleep(20);Be nice to you CPU!!
                    If $hMSG[4] <> $lID Then
                        $El = 1
                        ExitLoop
                    Else
                        $El = 0
                    EndIf
                WEnd
                If $El = 0 Then
                    GUICtrlSetImage($bID, $BUT_LOCATION&"ppg-" & $ImageID & "-hover.bmp")
                    Execute($FuncID & "()")
                ElseIf $El = 1 Then
                    ExitLoop
                EndIf
            EndIf
        EndIf
    WEnd
    GUICtrlSetImage($bID, $BUT_LOCATION&"ppg-" & $ImageID & "-normal.bmp")
EndFunc   ;==>_HoverBut

Func _RandomPassWord()
    GUISetCursor(15, 0, $MGUI)
    GUICtrlSetCursor($GLAB2, 15)
    $PROGRESS = 0
    Local $SPCHAR[4] = ["!", "=", "#", "-"]
    $STR_NEWPASS = Chr(Random(97, 122, 0))
    $PROGRESS += 12.5
    _SetProgress($PROGRESS)
    $STR_NEWPASS = $STR_NEWPASS & Chr(Random(97, 122, 0))
    $PROGRESS += 12.5
    _SetProgress($PROGRESS)
    $1CHAR = Random(0, 3, 1)
    $1CHAR2 = $SPCHAR[$1CHAR]
    $PROGRESS += 12.5
    _SetProgress($PROGRESS)
    $STR_NEWPASS = $STR_NEWPASS & $1CHAR2
    $STR_NEWPASS = $STR_NEWPASS & Random(10, 99, 1)
    $PROGRESS += 12.5
    _SetProgress($PROGRESS)
    $CHAR = Random(0, 3, 1)
    If $1CHAR == $CHAR Then $CHAR = 3 - $CHAR
    $CHAR = $SPCHAR[$CHAR]
    $STR_NEWPASS = $STR_NEWPASS & $CHAR
    $PROGRESS += 12.5
    _SetProgress($PROGRESS)
    $STR_NEWPASS = $STR_NEWPASS & Chr(Random(97, 122, 0))
    $PROGRESS += 12.5
    _SetProgress($PROGRESS)
    $STR_NEWPASS = $STR_NEWPASS & Chr(Random(97, 122, 0))
    $PROGRESS += 12.5
    _SetProgress($PROGRESS)
    $PROGRESS += 12.5
    _SetProgress($PROGRESS)
    GUICtrlSetData($LABRESULT, "Result: " & $STR_NEWPASS)
    ClipPut($STR_NEWPASS)
    GUICtrlSetData($STATUS, "The password " & $STR_NEWPASS & " is copied to clipboard.")
    GUICtrlSetCursor($GLAB2, 2)
    GUISetCursor(2, 1, $MGUI)
EndFunc   ;==>_RandomPassWord

Func _AlgoNew()
    $USERNAME = GUICtrlRead($ALGOINPUT)
    $PROGRESS = 0
    $LENGTH = StringLen($USERNAME)
    If $LENGTH >= 5 Then
        Local $USCH[$LENGTH + 1], $PWD[9], $SPCHAR[4] = ["!", "=", "-", "#"]
        $USCH = StringSplit($USERNAME, "")
        For $i = 1 To $LENGTH
            $USCH[$i] = Asc($USCH[$i])
        Next
        ;---Character 1---;
        $PWD[1] = Round($LENGTH * 0.11 / 0.01, 0)
        $PROGRESS += 12.5
        _SetProgress($PROGRESS)
        $PWD[2] = Round(($LENGTH * 0.22 / 0.02) / ($USCH[1] / 20), 0)
        $PROGRESS += 12.5
        _SetProgress($PROGRESS)
        For $i = 1 To 2
            If $PWD[$i] < 97 Then
                Do
                    $PWD[$i] += 26
                Until $PWD[$i] >= 97
            ElseIf $PWD[$i] > 122 Then
                Do
                    $PWD[$i] -= 26
                Until $PWD[$i] <= 122
            EndIf
        Next
        $PWD[3] = Round(($USCH[1] + $USCH[2] + $USCH[$LENGTH - 1] + $USCH[$LENGTH - 2]) / 4 * ($LENGTH / 0.77), 0)
        If $PWD[3] > 4 Then
            Do
                $PWD[3] -= 4
            Until $PWD[3] <= 3
        EndIf
        $SPCHR1 = $PWD[3]
        $PWD[3] = $SPCHAR[$PWD[3]]
        $PROGRESS += 12.5
        _SetProgress($PROGRESS)
        $PWD[4] = Round(($USCH[3] + $USCH[4] + $USCH[5] + $USCH[$LENGTH - 2] + $USCH[$LENGTH - 3]) / 5 * $LENGTH / 2)
        If $PWD[4] > 100 Then
            If $PWD[4] > 1000 Then
                $PWD[4] = Round($PWD[4] / 100, 0)
            Else
                $PWD[4] = Round($PWD[4] / 10, 0)
            EndIf
        EndIf
        $PROGRESS += 12.5
        _SetProgress($PROGRESS)
        $PWD[5] = Round(($USCH[$LENGTH - 1] + $USCH[$LENGTH - 2] + $USCH[$LENGTH - 3] + $USCH[$LENGTH - 4] + $USCH[$LENGTH - 5]) / 5 * $LENGTH * 0.99 / 0.5, 0)
        If $PWD[5] > 4 Then
            Do
                $PWD[5] -= 4
            Until $PWD[5] <= 3
        EndIf
        If $SPCHR1 = $PWD[5] Then $PWD[5] = 3 - $PWD[5]
        $PWD[5] = $SPCHAR[$PWD[5]]
        $PROGRESS += 12.5
        _SetProgress($PROGRESS)
        $PWD[6] = Round($LENGTH * 0.22 / 0.09, 0)
        $PROGRESS += 12.5
        _SetProgress($PROGRESS)
        $PWD[7] = Round(($LENGTH * 0.99 / 0.02) / ($USCH[4] / $USCH[3] + $USCH[$LENGTH - 3]), 0)
        $PROGRESS += 12.5
        _SetProgress($PROGRESS)
        For $i = 6 To 7
            If $PWD[$i] < 97 Then
                Do
                    $PWD[$i] += 26
                Until $PWD[$i] >= 97
            ElseIf $PWD[$i] > 122 Then
                Do
                    $PWD[$i] -= 26
                Until $PWD[$i] <= 122
            EndIf
        Next
        $PROGRESS += 12.5
        _SetProgress($PROGRESS)
        $PWD[8] = Chr($PWD[1]) & Chr($PWD[2]) & $PWD[3] & $PWD[4] & $PWD[5] & Chr($PWD[6]) & Chr($PWD[7])
        ClipPut($PWD[8])
        GUICtrlSetData($STATUS, "The password " & $PWD[8] & " is copied to clipboard")
        GUICtrlSetData($LABRESULT, "Resultaat: " & $PWD[8])
    Else
        _SetProgress(0)
        GUICtrlSetData($STATUS, "Your username is too short!")
    EndIf
EndFunc   ;==>_AlgoNew

Resources: PPG.zip

N.B. : Modify the calculations in the _AlgoNew() function for your own algorithm.


PowerSlide2UnlockiPhone look-a-like program you can use to lock your pc, you can't access your desktop again until the password is entered and the slider slided to the right. (really proud of it)-- After a time AutoIt and Windows, I switched to Mac. Don't expect me to answer anymore.

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Whoa, 42 downloads, 124 views and still no comments? :)

Please anyone who wants to reply? :)

Edited by AppTux

PowerSlide2UnlockiPhone look-a-like program you can use to lock your pc, you can't access your desktop again until the password is entered and the slider slided to the right. (really proud of it)-- After a time AutoIt and Windows, I switched to Mac. Don't expect me to answer anymore.

Share this post


Link to post
Share on other sites

Thanks!

It's a very good job!

I'm also looking for a way to calculate how strong the password generated is. Anybody have some example?

Share this post


Link to post
Share on other sites

There are many sites out there that you can use to assess how strong a password might be. They're all just a guess as to how strong the actual password really is though. If you use the password P@ssw0rd1 in a lot of these sites, they'll tell you that it's a strong/very strong password, although that passphrase is probably in most dictionary attacks. I did a search on the words "password strength analyzer" to find quite a few.


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Password "strength" is mostly achieved by padding due to the amount of time it would take to brute force it.

For example, P^$sw0r& would be exponentially less effective than Password000000000000000000000. Still you should use a more complex "base phrase/string". This example just to illustrates the padding.

edit: I guess my point is password length, not complexity is what will protect you more.

Edited by spudw2k

Share this post


Link to post
Share on other sites

spudw2k's comment about length is true, but complexity is also important. One can't expect 12345678910111213 to do much good if a brute force algorithm attempts the easy complex combinations before stepping into iterating through combinations.

If anyone has seen the source code for Keepass please let me know what you think. I haven't found the time to dig into that application to view the algorithm in use. It looks quite impressive and feels accurate for its interpretation of password strength.

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

I can almost guarantee no brute forcer will arbitrarily attempt padded combination as that alone would exponentially increase the attack. Most if not all are designed to attempt incremental guesses.

Edited by spudw2k

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_OutFile=GenPass.exe
#AutoIt3Wrapper_icon=GenPass.ico
#AutoIt3Wrapper_Compression=4
#AutoIt3Wrapper_UseAnsi=y
#AutoIt3Wrapper_Res_Comment=-
#AutoIt3Wrapper_Res_Description=GenPass.exe
#AutoIt3Wrapper_Res_Fileversion=0.1.0.0
#AutoIt3Wrapper_Res_Fileversion_AutoIncrement=n
#AutoIt3Wrapper_Res_LegalCopyright=AZJIO
#AutoIt3Wrapper_Res_Language=1049
#AutoIt3Wrapper_Run_AU3Check=n
://////=__=.
://////=__=..
://////=__=
://////=__=
://////=__=
#AutoIt3Wrapper_Run_Obfuscator=y
#Obfuscator_Parameters=/sf /sv /om /cs=0 /cn=0
#AutoIt3Wrapper_Run_After=del /f /q "%scriptdir%%scriptfile%_Obfuscated.au3"
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****

; AZJIO 14.11.2011 (AutoIt3_v3.3.6.1)

#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <String.au3>

; En
$LngEnPs='Enter the password'
$LngTitle='Password generator'
$LngOut='Result'
$LngCopy='Copy'
$LngLm='Limit the number of characters'

$UserIntLang=DllCall('kernel32.dll', 'int', 'GetUserDefaultUILanguage')
If Not @error Then $UserIntLang=Hex($UserIntLang[0],4)

; Ru
; если русская локализация, то русский язык
If $UserIntLang = 0419 Then
$LngEnPs='Введите пароль'
$LngTitle='Генератор пароля по ключевой фразе'
$LngOut='Результат'
$LngCopy='Копировать'
$LngLm='Лимит количества символов'
; $Lng=''
EndIf

#NoTrayIcon

$smb='0123456789qwertyuiopasdfghjklzxcvbnm' ; ~`#$& символы участвующие в пароле /// characters involved in the password
Global $aSmb=StringSplit($smb, '')

$Gui = GUICreate($LngTitle, 450, 90, -1, -1, -1, $WS_EX_ACCEPTFILES)

$key = GUICtrlCreateInput($LngEnPs, 10, 5, 430, 22)
GUICtrlSetFont(-1, -1, -1, 2)
$out = GUICtrlCreateInput($LngOut, 10, 30, 430, 22)
GUICtrlSetFont(-1, -1, -1, 2)

$copy = GUICtrlCreateButton($LngCopy, 360, 60, 80, 24)

; $StatusBar=GUICtrlCreateLabel('StatusBar', 5, 90-20, 150, 17)
GUISetState ()
GUIRegisterMsg(0x0111, "WM_COMMAND")
While 1
$msg = GUIGetMsg()
Switch $msg
Case $copy
ClipPut(GUICtrlRead($out, 1))
Case -3
Exit
EndSwitch
WEnd

Func WM_COMMAND($hWnd, $imsg, $iwParam, $ilParam)
Local $nNotifyCode, $nID, $key0
$nNotifyCode = BitShift($iwParam, 16)
$nID = BitAND($iwParam, 0xFFFF)
Switch $nID
Case $key
Switch $nNotifyCode
Case $EN_CHANGE
$key0 = GUICtrlRead($key, 1)
; GUICtrlSetData($StatusBar, $key0)
Switch $key0
Case $LngEnPs
; GUICtrlSetData($nID, '')
; GUICtrlSetFont($nID, -1, -1, 0)
GUICtrlSetFont($nID, -1, -1, 2)
GUICtrlSetData($out, $LngOut)
GUICtrlSetFont($out, -1, -1, 2)
Case ''
GUICtrlSetData($nID, $LngEnPs)
GUICtrlSetFont($nID, -1, -1, 2)
GUICtrlSetData($out, $LngOut)
GUICtrlSetFont($out, -1, -1, 2)
Case Else
If StringLeft($key0, 14)=$LngEnPs Then
$key0=StringTrimLeft($key0, 14)
GUICtrlSetData($key, $key0)
EndIf
GUICtrlSetFont($nID, -1, -1, 0)
GUICtrlSetFont($out, -1, -1, 0)
If StringLen($key0)>64 Then
GUICtrlSetData($out, $LngLm)
Return $GUI_RUNDEFMSG
EndIf
; GUICtrlSetData($out, _StringEncrypt(1, $key0, $key0, 1))
$tmp = _HexToDec(_StringEncrypt(1, $key0, $key0, 1))
$posE = StringInStr($tmp, 'e')
If $posE Then $tmp /= 10^(Number(StringTrimLeft($tmp, $posE+1))-14)
; GUICtrlSetData($StatusBar, $tmp)
$tmpTXT = _Num_to_Txt($tmp)
$tmp = _Upper($tmpTXT, $tmp)
; $tmp=StringRegExpReplace(_Num_to_Txt($tmp), '^(.*?)(a{2,})$', '1')
GUICtrlSetData($out, $tmp)
; If StringInStr($tmp, '+') Then
; GUICtrlSetData($out, $tmp)
; Else
;~ GUICtrlSetData($out, $tmp)
; GUICtrlSetData($out, _Num_to_Txt($tmp))
; EndIf
EndSwitch
EndSwitch
EndSwitch
Return $GUI_RUNDEFMSG
EndFunc ;==>WM_COMMAND

Func _Upper($tmpTXT, $tmp)
$a=StringSplit($tmpTXT, '')
$n=StringSplit($tmp, '')
$am=Int($a[0]/2)
$k=0
For $i = 1 to $n[0]
If $n[$i]<=$a[0] Then
$a[$n[$i]]=StringUpper($a[$n[$i]])
$k=+1
EndIf
If $k >= $am Then ExitLoop
Next
$tmpTXT=''
For $i = 1 to $a[0]
$tmpTXT&=$a[$i]
Next
Return $tmpTXT
EndFunc

Func _Num_to_Txt($num)
Local $text='', $ost
While 1
$ost=Mod($num, $aSmb[0])
$num=($num-$ost)/$aSmb[0]
$text=$aSmb[$ost+1]&$text
If $num=0 Then ExitLoop
WEnd
Return $text
EndFunc

Func _HexToDec($H)
Local $out = 0, $i, $aH = StringSplit(StringUpper($H), '')
For $i = 1 to $aH[0]
Switch $aH[$i]
Case 'A'
$aH[$i] = 10
Case 'B'
$aH[$i] = 11
Case 'C'
$aH[$i] = 12
Case 'D'
$aH[$i] = 13
Case 'E'
$aH[$i] = 14
Case 'F'
$aH[$i] = 15
EndSwitch
$out += $aH[$i] * 16 ^ ($aH[0] - $i)
Next
Return $out
EndFunc

Edited by AZJIO

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