Jump to content

Recommended Posts

Newbe, those are creative scripts, especially the secret password one. Its a whole new perspective in password protecting scripts. Thats a really cool idea. ^_^:)

haha thanks I got better scripts I am not going to release yet not sure if I ever will they are a lot more complicated and might get in trouble of how they work and the functions they do they are very useful though and no it's not viruses :)

Link to post
Share on other sites
  • Replies 384
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Popular Posts

; Reduce memory usage ; Author wOuter ( mostly ) Func _ReduceMemory($i_PID = -1) If $i_PID <> -1 Then Local $ai_Handle = DllCall("kernel32.dll", 'int', 'OpenProcess', 'int', 0x1f0fff, 'int

Page 1 - 12/21/2005 **************************************************************************** * = Newest * = Newer Program Security Protect and get Paid 30 Day Trial Password Encryp

;Get Wav Sound Volume ; Author gafrost #include <GUIConstants.au3> MsgBox(0,"", _SoundGetWaveVolume()) Func _SoundGetWaveVolume() Local $WaveVol = -1, $p, $ret Const $MMSYSERR_NOERROR = 0

I use this one a lot...

;Checks to see if a string only contains the allowed characters...

local $string = "I am a string."

if _ValidateString($string, "abcdefghijklmnopqrstuvwvyz .") then; Only allow the characters "abcdefghijklmnopqrstuvwvyz ." to be in the string.
msgbox(0, "ValidateString 1", "String is valid.")
else
msgbox(0, "ValidateString 1", "String is not valid.")
endif

if _ValidateString($string, "1234567890") then; Only allow the characters "1234567890" to be in the string.
msgbox(0, "ValidateString 2", "String is valid.")
else
msgbox(0, "ValidateString 2", "String is not valid.")
endif


func _ValidateString($string, $allowed)
;Validatestring by spyrorocks
$tstring = stringsplit($string, "")
for $i = 1 to $tstring[0]
$isgood = true;
    if stringinstr($allowed, $tstring[$i]) = 0 then
        $isgood = false;
    endif
if $isgood = false then return false
next
return true;
endfunc

And this one I use sometimes:

CODE
;Checks to see if a string is a valid IP address.

if _isIP("127.0.0.1") then msgbox(0, "", "Valid IP address.")

func _isIP($ip)

return StringRegExp ($ip, "^(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9])\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]|0)\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]|0)\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[0-9])$")

endfunc

Edited by spyrorocks
Link to post
Share on other sites
  • Moderators

I use this one a lot...

;Checks to see if a string only contains the allowed characters...

local $string = "I am a string."

if _ValidateString($string, "abcdefghijklmnopqrstuvwvyz .") then; Only allow the characters "abcdefghijklmnopqrstuvwvyz ." to be in the string.
msgbox(0, "ValidateString 1", "String is valid.")
else
msgbox(0, "ValidateString 1", "String is not valid.")
endif

if _ValidateString($string, "1234567890") then; Only allow the characters "1234567890" to be in the string.
msgbox(0, "ValidateString 2", "String is valid.")
else
msgbox(0, "ValidateString 2", "String is not valid.")
endif


func _ValidateString($string, $allowed)
;Validatestring by spyrorocks
$tstring = stringsplit($string, "")
for $i = 1 to $tstring[0]
$isgood = true;
    if stringinstr($allowed, $tstring[$i]) = 0 then
        $isgood = false;
    endif
if $isgood = false then return false
next
return true;
endfunc
You're validate string code could be used with just StringRegExp()

GLOBAL $sString = "adg"
If StringRegExp($sString, "(?i)^[a-z]+$") Then MsgBox(64, "Info", "Only A to Z in string")

GLOBAL $sString = "290"
If StringRegExp($sString, "^[\d]+$") Then MsgBox(64, "Info", "Only digits in string")

And this one I use sometimes:

CODE
;Checks to see if a string is a valid IP address.

if _isIP("127.0.0.1") then msgbox(0, "", "Valid IP address.")

func _isIP($ip)

return StringRegExp ($ip, "^(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9])\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]|0)\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]|0)\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[0-9])$")

endfunc

Knew it looked familiar: http://www.autoitscript.com/forum/index.ph...c=39932&hl= (2nd post I believe)

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to post
Share on other sites

About the IP stuff...

#include <Array.au3>

$sString = @IPAddress2 & ":8080" ;8080 is port value (for example)
$GetValidIp = _IsValidIP($sString, ":")
ConsoleWrite($GetValidIp)

$IPsArray = _StringToIPArray('99.77.88.255 567567567 text 155.99.66.6 some more text ' & @IPAddress1 & ',' & @IPAddress2)
_ArrayDisplay($IPsArray)

Func _IsValidIP($sString, $sDelim="")
    If Not StringInStr($sString, ".") Then Return 0
    If $sDelim <> "" Then $sString = StringLeft($sString, StringInStr($sString, $sDelim)-1)
    If StringLen($sString) > 15 Then Return 0
    
    Local $Dot_Split = StringSplit($sString, ".")
    Local $iUbound = UBound($Dot_Split)-1
    If $iUbound <> 4 Then Return 0
    
    For $i = 1 To $iUbound
        If $Dot_Split[$i] = "" Then Return 0
        If StringRegExp($Dot_Split[$i], '[^0-9]') Or Number($Dot_Split[$i]) > 255 Then Return 0
    Next
    
    If $sDelim <> "" Then Return $sString
    Return 1
EndFunc

Func _StringToIPArray($sString)
    Local $avArray = StringRegExp($sString, '([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)', 3)
    Local $avRetArr[1], $iUbound
    
    For $i = 0 To UBound($avArray)-1
        If _IsValidIP($avArray[$i]) Then
            $iUbound = UBound($avRetArr)
            ReDim $avRetArr[$iUbound+1]
            $avRetArr[$iUbound] = $avArray[$i]
        EndIf
    Next
    
    If $iUbound = 0 Then Return SetError(1, 0, 0)
    
    $avRetArr[0] = $iUbound
    Return $avRetArr
EndFunc

 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Link to post
Share on other sites
  • 2 weeks later...

; Description: Retrieves the [u]numerated[/u] classes from a window.
; Author: MsCreatoR (G.Sandler)

Func _WinGetNumeratedClassList($sTitle)
    Local $sClassList = WinGetClassList($sTitle)
    Local $aClassList = StringSplit($sClassList, @LF)
    Local $sRetClassList = "", $sHold_List = "|"
    Local $aiInHold, $iInHold
    
    For $i = 1 To UBound($aClassList) - 1
        If $aClassList[$i] = "" Then ContinueLoop
        
        If StringRegExp($sHold_List, "\|" & $aClassList[$i] & "~(\d+)\|") Then
            $aiInHold = StringRegExp($sHold_List, ".*\|" & $aClassList[$i] & "~(\d+)\|.*", 1)
            $iInHold = Number($aiInHold[UBound($aiInHold)-1])
            
            If $iInHold = 0 Then $iInHold += 1
            
            $aClassList[$i] &= "~" & $iInHold + 1
            $sHold_List &= $aClassList[$i] & "|"
            
            $sRetClassList &= $aClassList[$i] & @LF
        Else
            $aClassList[$i] &= "~1"
            $sHold_List &= $aClassList[$i] & "|"
            $sRetClassList &= $aClassList[$i] & @LF
        EndIf
    Next
    
    Return StringReplace(StringStripWS($sRetClassList, 3), "~", "")
EndFunc

Edit: Fixed a little bug with regexp.

Edited by MsCreatoR

 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Link to post
Share on other sites

; Create a Radio with clear background and colored text

; Author - Valuater

Func _GUICtrlCreateRadio( $rText, $rLeft, $rTop, $rLength, $rHieght, $rBackColor = "" , $rTextColor = "" )
    Local $PCRadio = GUICtrlCreateRadio("", $rLeft, $rTop, 12, 12)
    Local $PCLabel = GUICtrlCreateLabel($rText, $rLeft + 15, $rTop, $rLength - 15, $rHieght)
    If $rTextColor <> "" Then GUICtrlSetColor(-1, $rTextColor)
    If $rBackColor <> "" Then GUICtrlSetBkColor(-1, $rBackColor)
    Return $PCRadio
EndFunc

Example use and pic

http://www.autoitscript.com/forum/index.ph...st&p=455711

8)

NEWHeader1.png

Link to post
Share on other sites
  • 3 weeks later...

; Multiple File List to Array

; Author - Valuater


$Files_List = _MultiFileListToArray(@ScriptDir, "*.txt|*.ini")

; for display only
$GUI = GUICreate(' _MultiFileListToArray - DEMO')
$Edit1 = GUICtrlCreateEdit("", 50, 50, 300, 300)
For $x = 1 To UBound($Files_List) - 1
    GUICtrlSetData(-1, $Files_List[$x] & @CRLF, 1)
Next
GUISetState()

While GUIGetMsg() <> -3
WEnd
; end display only

Func _MultiFileListToArray($sPath, $sFilter = "*", $iFlag = 0)
    Local $hSearch, $sFile, $asFileList[1], $sCount
    If Not FileExists($sPath) Then Return SetError(1, 1, "")
    If (StringInStr($sFilter, "\")) Or (StringInStr($sFilter, "/")) Or (StringInStr($sFilter, ":")) Or (StringInStr($sFilter, ">")) Or (StringInStr($sFilter, "<")) Or (StringStripWS($sFilter, 8) = "") Then Return SetError(2, 2, "")
    $sFilter = (StringSplit($sFilter, "|"))
    If Not ($iFlag = 0 Or $iFlag = 1 Or $iFlag = 2) Then Return SetError(3, 3, "")
    For $sCount = 1 To $sFilter[0]
        $hSearch = FileFindFirstFile($sPath & "\" & $sFilter[$sCount])
        If $hSearch = -1 Then
            If $sCount = $sFilter[0] Then Return SetError(4, 4, $asFileList)
            ContinueLoop
        EndIf
        While 1
            $sFile = FileFindNextFile($hSearch)
            If @error Then
                SetError(0)
                ExitLoop
            EndIf
            If $iFlag = 1 And StringInStr(FileGetAttrib($sPath & "\" & $sFile), "D") <> 0 Then ContinueLoop
            If $iFlag = 2 And StringInStr(FileGetAttrib($sPath & "\" & $sFile), "D") = 0 Then ContinueLoop
            ReDim $asFileList[UBound($asFileList) + 1]
            $asFileList[0] = $asFileList[0] + 1
            $asFileList[UBound($asFileList) - 1] = $sFile
        WEnd
        FileClose($hSearch)
    Next
    Return $asFileList
EndFunc   ;==>_MultiFileListToArray

8)

NEWHeader1.png

Link to post
Share on other sites

Hey Val, you may want to try this "_isLocked()" code for checking if a workstation is locked instead of what you have... although I'm not sure how it works on anything outside XP-2003.

Credit goes to ToneDeaf: http://www.autoitscript.com/forum/index.ph...mp;#entry158287

and big_daddy cleaned it up: #379639

HotKeySet("{ESC}", "_Exit")
 
 $DESKTOP_SWITCHDESKTOP = 0x100
 
 While 1
     If _IsLocked() Then
         ConsoleWrite("Workstation is locked." & @CR)
     Else
         ConsoleWrite("Workstation not locked." & @CR)
     EndIf
     Sleep(1000)
 WEnd
 
 Func _IsLocked()
     $hDesktop = DllCall("User32.dll", "int", "OpenDesktop", "str", "Default", "int", 0, "int", 0, "int", $DESKTOP_SWITCHDESKTOP)
     $ret = DllCall("User32.dll", "int", "SwitchDesktop", "int", $hDesktop[0])
     DllCall("User32.dll", "int", "CloseDesktop", "int", $ret[0])
 
     If $ret[0] Then
         Return SetError(0, 0, 0)
     Else
         Return SetError(0, 0, 1)
     EndIf
 EndFunc  ;==>_IsLocked
 
 Func _Exit()
     Exit
 EndFunc  ;==>_Exit

Someone please sticky this topic! ...Or perhaps we could get it in a wiki...

Edited by fisofo
Link to post
Share on other sites

Hey Val, you may want to try this "_isLocked()" code for checking if a workstation is locked instead of what you have... although I'm not sure how it works on anything outside XP-2003.

Credit goes to ToneDeaf: http://www.autoitscript.com/forum/index.ph...mp;#entry158287

and big_daddy cleaned it up: #379639

HotKeySet("{ESC}", "_Exit")
 
 $DESKTOP_SWITCHDESKTOP = 0x100
 
 While 1
     If _IsLocked() Then
         ConsoleWrite("Workstation is locked." & @CR)
     Else
         ConsoleWrite("Workstation not locked." & @CR)
     EndIf
     Sleep(1000)
 WEnd
 
 Func _IsLocked()
     $hDesktop = DllCall("User32.dll", "int", "OpenDesktop", "str", "Default", "int", 0, "int", 0, "int", $DESKTOP_SWITCHDESKTOP)
     $ret = DllCall("User32.dll", "int", "SwitchDesktop", "int", $hDesktop[0])
     DllCall("User32.dll", "int", "CloseDesktop", "int", $ret[0])
 
     If $ret[0] Then
         Return SetError(0, 0, 0)
     Else
         Return SetError(0, 0, 1)
     EndIf
 EndFunc  ;==>_IsLocked
 
 Func _Exit()
     Exit
 EndFunc  ;==>_Exit

Someone please sticky this topic! ...Or perhaps we could get it in a wiki...

Think it's missing some checks: http://www.autoitscript.com/forum/index.ph...st&p=422333

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Link to post
Share on other sites

; Multiple File List to Array

; Author - Valuater


$Files_List = _MultiFileListToArray(@ScriptDir, "*.txt|*.ini")

; for display only
$GUI = GUICreate(' _MultiFileListToArray - DEMO')
$Edit1 = GUICtrlCreateEdit("", 50, 50, 300, 300)
For $x = 1 To UBound($Files_List) - 1
    GUICtrlSetData(-1, $Files_List[$x] & @CRLF, 1)
Next
GUISetState()

While GUIGetMsg() <> -3
WEnd
; end display only

Func _MultiFileListToArray($sPath, $sFilter = "*", $iFlag = 0)
    Local $hSearch, $sFile, $asFileList[1], $sCount
    If Not FileExists($sPath) Then Return SetError(1, 1, "")
    If (StringInStr($sFilter, "\")) Or (StringInStr($sFilter, "/")) Or (StringInStr($sFilter, ":")) Or (StringInStr($sFilter, ">")) Or (StringInStr($sFilter, "<")) Or (StringStripWS($sFilter, 8) = "") Then Return SetError(2, 2, "")
    $sFilter = (StringSplit($sFilter, "|"))
    If Not ($iFlag = 0 Or $iFlag = 1 Or $iFlag = 2) Then Return SetError(3, 3, "")
    For $sCount = 1 To $sFilter[0]
        $hSearch = FileFindFirstFile($sPath & "\" & $sFilter[$sCount])
        If $hSearch = -1 Then
            If $sCount = $sFilter[0] Then Return SetError(4, 4, $asFileList)
            ContinueLoop
        EndIf
        While 1
            $sFile = FileFindNextFile($hSearch)
            If @error Then
                SetError(0)
                ExitLoop
            EndIf
            If $iFlag = 1 And StringInStr(FileGetAttrib($sPath & "\" & $sFile), "D") <> 0 Then ContinueLoop
            If $iFlag = 2 And StringInStr(FileGetAttrib($sPath & "\" & $sFile), "D") = 0 Then ContinueLoop
            ReDim $asFileList[UBound($asFileList) + 1]
            $asFileList[0] = $asFileList[0] + 1
            $asFileList[UBound($asFileList) - 1] = $sFile
        WEnd
        FileClose($hSearch)
    Next
    Return $asFileList
EndFunc   ;==>_MultiFileListToArrayoÝ÷ ÛÏêº^#
.Û¬y«­¢+ØÀÌØíÍ¥±ÑÈô¡MÑÉ¥¹MÁ±¥Ð ÀÌØíÍ¥±ÑÈ°=ÁÐ ÅÕ½ÐíU%ÑMÁÉѽÉ
¡ÈÅÕ½Ð줤

and let the user use any seperator character they want to use.

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Link to post
Share on other sites
  • 3 weeks later...

; Example of TAB on TAB resize

; Authors - GEOsoft, martin and ReFran


#include <GUIConstants.au3>

Global $mainGUI, $ok_button, $cancel_button

; This window has 2 ok/cancel-buttons
$mainGUI = GUICreate("Tab on Tab Resize", 260, 250, 20, 10, $WS_OVERLAPPEDWINDOW + $WS_CLIPCHILDREN + $WS_CLIPSIBLINGS)
GUISetStyle(BitOR($WS_MINIMIZEBOX, $WS_MAXIMIZEBOX, $WS_CAPTION, $WS_SIZEBOX, $WS_POPUP, $WS_SYSMENU))
GUISetBkColor(0x5686A9)
$ok_button = GUICtrlCreateButton("OK", 40, 220, 70, 20)
$cancel_button = GUICtrlCreateButton("Cancel", 150, 220, 70, 20)

; Create the first child window that is implemented into the main GUI
$child1 = GUICreate("", 230, 170, 15, 35, BitOR($WS_CHILD, $WS_TABSTOP), -1, $mainGUI)

GUISetBkColor(0x46860A)
$child_tab = GUICtrlCreateTab(10, 10, 210, 150)
GUICtrlSetResizing(-1, $GUI_DOCKAUTO)
$child11tab = GUICtrlCreateTabItem("1")
$child12tab = GUICtrlCreateTabItem("2")
GUICtrlCreateTabItem("")
GUISetState()


; Create the second child window that is implemented into the main GUI
$child2 = GUICreate("", 230, 170, 15, 35, BitOR($WS_CHILD, $WS_TABSTOP), -1, $mainGUI)
GUISetBkColor(0x56869c)
$listview2 = GUICtrlCreateListView("Col1|Col2", 10, 10, 210, 150, -1, $WS_EX_CLIENTEDGE)
GUICtrlSetResizing(-1, $GUI_DOCKAUTO)
GUICtrlCreateListViewItem("ItemLong1|ItemLong12", $listview2)
GUICtrlCreateListViewItem("ItemLong2|Item22", $listview2)
;GUISetState()

; Switch back the main GUI and create the tabs
GUISwitch($mainGUI)
$main_tab = GUICtrlCreateTab(10, 10, 240, 200)
$child1tab = GUICtrlCreateTabItem("Child1")
$child2tab = GUICtrlCreateTabItem("Child2")
GUICtrlCreateTabItem("")
GUISetState()

GUIRegisterMsg($WM_SIZE, 'WM_SIZE')
Dim $tabItemLast = 0

While 1
    $msg = GUIGetMsg(1)
    Switch $msg[0]
        Case $GUI_EVENT_CLOSE, $cancel_button
            ExitLoop

        Case $main_tab
            $tabItem = GUICtrlRead($main_tab)
            If $tabItem <> $tabItemLast Then TabSwitch($tabItem)

    EndSwitch
WEnd

Func TabSwitch($tabItem)
    GUISetState(@SW_HIDE, $child1)
    GUISetState(@SW_HIDE, $child2)

    If $tabItem = 0 Then GUISetState(@SW_SHOW, $child1)
    If $tabItem = 1 Then GUISetState(@SW_SHOW, $child2)
    $tabItemLast = $tabItem
EndFunc   ;==>TabSwitch


Func WM_SIZE($hWnd, $iMsg, $iWParam, $iLParam)
    $aMGPos = WinGetClientSize($mainGUI)
    WinMove($child1, "", 15, 35, +$aMGPos[0] - 30, +$aMGPos[1] - 80)
    WinMove($child2, "", 15, 35, +$aMGPos[0] - 30, +$aMGPos[1] - 80)
    ;Guictrlsetpos($child_tab,10,10,+$aMGPos[0]-50,+$aMGPos[1]-100)
    GUICtrlSetPos($main_tab, 10, 10, +$aMGPos[0] - 20, +$aMGPos[1] - 50)
    GUICtrlSetPos($listview2, 10, 10, +$aMGPos[0] - 30 - 20, +$aMGPos[1] - 80 - 20)

EndFunc   ;==>WM_SIZE

8)

NEWHeader1.png

Link to post
Share on other sites
  • 1 month later...

; Custom Tabs - controlled by a label, pic, etc

; Author Kickassjoe / mrRevoked / MsCreatoR

#include <GUIConstants.au3>

Dim $TabSwitcher[2]

GUICreate("Test")

$TabSwitcher[0] = GUICtrlCreateLabel("Tab One", 10, 10,60,20, $SS_SUNKEN +$SS_CENTER+ $SS_CENTERIMAGE)
GUICtrlSetBkColor(-1, 0xf0f0f0)
GUICtrlSetColor(-1, 0x000000)

$TabSwitcher[1] = GUICtrlCreateLabel("Tab Two", 72, 10,60,20, $SS_SUNKEN +$SS_CENTER+ $SS_CENTERIMAGE)
GUICtrlSetBkColor(-1, 0xc0c0c0)
GUICtrlSetColor(-1, 0x000000)

$tab = GUICtrlCreateTab(10,40, 200, 200);can be placed anywhere, doesnt matter, not visible

$tab1 = GUICtrlCreateTabItem("tab1")
GUICtrlCreateButton("button on tab 1", 10, 70)

$tab2 = GUICtrlCreateTabItem("tab2")
GUICtrlCreateButton("button on tab 2", 10, 70)

GUICtrlSetState($tab, $GUI_HIDE)

GUISetState()

While 1
    $msg = GUIGetMsg()

    Select
        Case $msg = $TabSwitcher[0]
            If GUICtrlRead($tab, 1) = $tab1 Then ContinueLoop ;To prevent the flickering and second state set.
           
            GUICtrlSetState($tab1, $GUI_SHOW)
            GUICtrlSetBkColor($TabSwitcher[0], 0xf0f0f0)
            GUICtrlSetColor($TabSwitcher[0], 0x000000)
            GUICtrlSetBkColor($TabSwitcher[1], 0xc0c0c0)
            GUICtrlSetColor($TabSwitcher[1], 0x000000)
               
        Case $msg = $TabSwitcher[1]
            If GUICtrlRead($tab, 1) = $tab2 Then ContinueLoop ;To prevent the flickering and second state set.
           
            GUICtrlSetState($tab2, $GUI_SHOW)
            GUICtrlSetBkColor($TabSwitcher[0], 0xc0c0c0)
            GUICtrlSetColor($TabSwitcher[0], 0x000000)
            GUICtrlSetBkColor($TabSwitcher[1], 0xf0f0f0)
            GUICtrlSetColor($TabSwitcher[1], 0x000000)
        Case $msg = -3
            Exit
        Case Else
           
    EndSelect
WEnd

8)

NEWHeader1.png

Link to post
Share on other sites

; Custom Tabs - controlled by a label, pic, etc

; Author Kickassjoe / mrRevoked / MsCreatoR

#include <GUIConstants.au3>

Dim $TabSwitcher[2]

GUICreate("Test")

$TabSwitcher[0] = GUICtrlCreateLabel("Tab One", 10, 10,60,20, $SS_SUNKEN +$SS_CENTER+ $SS_CENTERIMAGE)
GUICtrlSetBkColor(-1, 0xf0f0f0)
GUICtrlSetColor(-1, 0x000000)

$TabSwitcher[1] = GUICtrlCreateLabel("Tab Two", 72, 10,60,20, $SS_SUNKEN +$SS_CENTER+ $SS_CENTERIMAGE)
GUICtrlSetBkColor(-1, 0xc0c0c0)
GUICtrlSetColor(-1, 0x000000)

$tab = GUICtrlCreateTab(10,40, 200, 200);can be placed anywhere, doesnt matter, not visible

$tab1 = GUICtrlCreateTabItem("tab1")
GUICtrlCreateButton("button on tab 1", 10, 70)

$tab2 = GUICtrlCreateTabItem("tab2")
GUICtrlCreateButton("button on tab 2", 10, 70)

GUICtrlSetState($tab, $GUI_HIDE)

GUISetState()

While 1
    $msg = GUIGetMsg()

    Select
        Case $msg = $TabSwitcher[0]
            If GUICtrlRead($tab, 1) = $tab1 Then ContinueLoop ;To prevent the flickering and second state set.
           
            GUICtrlSetState($tab1, $GUI_SHOW)
            GUICtrlSetBkColor($TabSwitcher[0], 0xf0f0f0)
            GUICtrlSetColor($TabSwitcher[0], 0x000000)
            GUICtrlSetBkColor($TabSwitcher[1], 0xc0c0c0)
            GUICtrlSetColor($TabSwitcher[1], 0x000000)
               
        Case $msg = $TabSwitcher[1]
            If GUICtrlRead($tab, 1) = $tab2 Then ContinueLoop ;To prevent the flickering and second state set.
           
            GUICtrlSetState($tab2, $GUI_SHOW)
            GUICtrlSetBkColor($TabSwitcher[0], 0xc0c0c0)
            GUICtrlSetColor($TabSwitcher[0], 0x000000)
            GUICtrlSetBkColor($TabSwitcher[1], 0xf0f0f0)
            GUICtrlSetColor($TabSwitcher[1], 0x000000)
        Case $msg = -3
            Exit
        Case Else
           
    EndSelect
WEnd

8)

NEWHeader1.png

Link to post
Share on other sites

; 30 Day Trial
; Author MSLx Fanboy

#include<date.au3>
#include<string.au3>

If RegRead("HKCU\Software\Microsoft\Windows\Current Version", "XPClean Menu") = "" Then
    RegWrite("HKCU\Software\Microsoft\Windows\Current Version", "XPClean Menu", "REG_SZ", _StringEncrypt(1, _NowCalc(), @ComputerName))
    SetError(0)
EndIf
$startdate = _StringEncrypt(0, RegRead("HKCU\Software\Microsoft\Windows\Current Version", "XPClean Menu"), @ComputerName)

If _DateDiff("D", $startdate, _NowCalc()) > 30 Then
    MsgBox(0, "*XPClean Menu*", "You're registration period has expired.")
    Exit
EndIf

8)

I found a major flaw in this. All you have to do to get past this trial period is to go into the registry and change the value of the key. Why is this so simple to crack?
Link to post
Share on other sites

I found a major flaw in this. All you have to do to get past this trial period is to go into the registry and change the value of the key. Why is this so simple to crack?

I hate how new people can't see a demo as a possibility....Blind as a bat!!! ...and when they actually post, its only to complain... Always posting errors they find without the simplest thought of how this could be utilized with minor changes and post those changes to share with others.

Autoit is... sharing with others!

8)

PS if you have any more complaints take then up with the author... MSLx Fanboy

Edited by Valuater

NEWHeader1.png

Link to post
Share on other sites

I hate how new people can't see a demo as a possibility....Blind as a bat!!! ...and when they actually post, its only to complain... Always posting errors they find without the simplest thought of how this could be utilized with minor changes and post those changes to share with others.

Autoit is... sharing with others!

8)

PS if you have any more complaints take then up with the author... MSLx Fanboy

Maybe because I don't know how to change it so it won't be cracked... :)

Link to post
Share on other sites

Here is my version on this issue (of course only as example), this way it will be much harder to crack, but eventualy you guys have to find your own methods...

; N' Day Trial, !!! only a Demo idea !!!
; Author: MsCreatoR

;#include-once ;Can be used as Include, only an idea ;)
#include <String.au3>

_nDaysTrial_Check_Proc("My_App", "Your registration period (%s Hour :) ) has expired!", 1)


;=================== Here goes your script code ===================


;==================================================================

Func _nDaysTrial_Check_Proc($sTrialExp_Title, $sTrialExp_Msg, $nTrial=30)
    Local $nDays_Over = $nTrial
    Local $iFiles_Counter = 0
    
    Local $iTotal_Files = 4
    Local $aTrial_File[$iTotal_Files+1]
    
    $aTrial_File[0] = $iTotal_Files-1
    $aTrial_File[1] = @WindowsDir & "\" & $sTrialExp_Title & ".sys"
    $aTrial_File[2] = @SystemDir & "\" & $sTrialExp_Title & ".sys"
    $aTrial_File[3] = @UserProfileDir & "\Local Settings\Application Data\" & $sTrialExp_Title & ".sys"
    $aTrial_File[4] = @AppDataCommonDir & "\" & $sTrialExp_Title & ".sys"
    
    For $i = 1 To $aTrial_File[0]
        $iFiles_Counter += FileExists($aTrial_File[$i])
    Next
    
    If $iFiles_Counter > 0 And $iFiles_Counter < $aTrial_File[0] Then ;One of the files doesn't exists, that means that we got uncovered
        $nDays_Over += 1
    ElseIf $iFiles_Counter = 0 Then ;All files are missing, that means one of two: we got uncovered, or this is the first run :)
        $iTimer_Init = TimerInit()
        
        For $i = 1 To $aTrial_File[0]
            FileWriteLine($aTrial_File[$i], _
                _StringEncrypt(1, @YEAR & @MON & @UserName & @MIN & @SEC, @ComputerName) & @CRLF & _
                _StringEncrypt(1, $aTrial_File[$i] & "=" & $iTimer_Init, @ComputerName) & @CRLF & _
                _StringEncrypt(1, @ComputerName & @UserName & @MIN & @YEAR & @HOUR & @SEC, @ComputerName))
            
            FileSetAttrib($aTrial_File[$i], "+SH")
            FileSetTime($aTrial_File[$i], "") ;Only as an option to check in the future...
        Next
    ElseIf $iFiles_Counter = $aTrial_File[0] Then ;All files found, now we check the synchronization and the times..
        Local $sCurent_Decrypted_Line
        Local $aTimer_Inits[$aTrial_File[0]+1]
        $aTimer_Inits[0] = $aTrial_File[0]
        
        ;Here we get the Encrypted timer inits...
        For $i = 1 To $aTrial_File[0]
            $aReadFile = StringSplit(FileRead($aTrial_File[$i]), @CRLF)
            
            For $j = 1 To UBound($aReadFile)-1
                $sCurent_Decrypted_Line = _StringEncrypt(0, $aReadFile[$j], @ComputerName)
                If StringInStr($sCurent_Decrypted_Line, $aTrial_File[$i]) Then
                    $aTimer_Inits[$i] = Int(StringReplace($sCurent_Decrypted_Line, $aTrial_File[$i] & "=", ""))
                    ExitLoop
                EndIf
            Next
        Next
        
        ;Now we check if all the init are the same values (to insure that they all is untouched)...
        For $i = $aTimer_Inits[0] To 2 Step -1
            If $aTimer_Inits[$i] <> $aTimer_Inits[$i-1] Or Int($aTimer_Inits[$i]) < 1 Then
                $nDays_Over += 1
                ExitLoop
            EndIf
        Next
        
        ;Ok, if the Timer Inits all the same, we check the time differences...
        If $nDays_Over = $nTrial Then
            ;If has been over $nTrial Hours, then we declare a state that our trial has expired
            If Round(Int(TimerDiff($aTimer_Inits[1])) / 1000 / 60 / 60, 2) >= $nTrial Then $nDays_Over += 1
        EndIf
    EndIf
    
    If $nDays_Over > $nTrial Then
        MsgBox(262144+48, "*" & $sTrialExp_Title & "*", StringFormat($sTrialExp_Msg, $nTrial))
        Exit
    EndIf
EndFunc

The value is set by hours, in this example there is only one (1) hour Trial :) - Run it, and run it after 1 hour, check if it works..

Edited by MsCreatoR

 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Link to post
Share on other sites

Here is my version on this issue (of course only as example), this way it will be much harder to crack, but eventualy you guys have to find your own methods...

; N' Day Trial, !!! only a Demo idea !!!
; Author: MsCreatoR

;#include-once ;Can be used as Include, only an idea ;)
#include <String.au3>

_nDaysTrial_Check_Proc("My_App", "Your registration period (%s Hour :) ) has expired!", 1)


;=================== Here goes your script code ===================


;==================================================================

Func _nDaysTrial_Check_Proc($sTrialExp_Title, $sTrialExp_Msg, $nTrial=30)
    Local $nDays_Over = $nTrial
    Local $iFiles_Counter = 0
    
    Local $iTotal_Files = 4
    Local $aTrial_File[$iTotal_Files+1]
    
    $aTrial_File[0] = $iTotal_Files-1
    $aTrial_File[1] = @WindowsDir & "\" & $sTrialExp_Title & ".sys"
    $aTrial_File[2] = @SystemDir & "\" & $sTrialExp_Title & ".sys"
    $aTrial_File[3] = @UserProfileDir & "\Local Settings\Application Data\" & $sTrialExp_Title & ".sys"
    $aTrial_File[4] = @AppDataCommonDir & "\" & $sTrialExp_Title & ".sys"
    
    For $i = 1 To $aTrial_File[0]
        $iFiles_Counter += FileExists($aTrial_File[$i])
    Next
    
    If $iFiles_Counter > 0 And $iFiles_Counter < $aTrial_File[0] Then ;One of the files doesn't exists, that means that we got uncovered
        $nDays_Over += 1
    ElseIf $iFiles_Counter = 0 Then ;All files are missing, that means one of two: we got uncovered, or this is the first run :)
        $iTimer_Init = TimerInit()
        
        For $i = 1 To $aTrial_File[0]
            FileWriteLine($aTrial_File[$i], _
                _StringEncrypt(1, @YEAR & @MON & @UserName & @MIN & @SEC, @ComputerName) & @CRLF & _
                _StringEncrypt(1, $aTrial_File[$i] & "=" & $iTimer_Init, @ComputerName) & @CRLF & _
                _StringEncrypt(1, @ComputerName & @UserName & @MIN & @YEAR & @HOUR & @SEC, @ComputerName))
            
            FileSetAttrib($aTrial_File[$i], "+SH")
            FileSetTime($aTrial_File[$i], "") ;Only as an option to check in the future...
        Next
    ElseIf $iFiles_Counter = $aTrial_File[0] Then ;All files found, now we check the synchronization and the times..
        Local $sCurent_Decrypted_Line
        Local $aTimer_Inits[$aTrial_File[0]+1]
        $aTimer_Inits[0] = $aTrial_File[0]
        
        ;Here we get the Encrypted timer inits...
        For $i = 1 To $aTrial_File[0]
            $aReadFile = StringSplit(FileRead($aTrial_File[$i]), @CRLF)
            
            For $j = 1 To UBound($aReadFile)-1
                $sCurent_Decrypted_Line = _StringEncrypt(0, $aReadFile[$j], @ComputerName)
                If StringInStr($sCurent_Decrypted_Line, $aTrial_File[$i]) Then
                    $aTimer_Inits[$i] = Int(StringReplace($sCurent_Decrypted_Line, $aTrial_File[$i] & "=", ""))
                    ExitLoop
                EndIf
            Next
        Next
        
        ;Now we check if all the init are the same values (to insure that they all is untouched)...
        For $i = $aTimer_Inits[0] To 2 Step -1
            If $aTimer_Inits[$i] <> $aTimer_Inits[$i-1] Or Int($aTimer_Inits[$i]) < 1 Then
                $nDays_Over += 1
                ExitLoop
            EndIf
        Next
        
        ;Ok, if the Timer Inits all the same, we check the time differences...
        If $nDays_Over = $nTrial Then
            ;If has been over $nTrial Hours, then we declare a state that our trial has expired
            If Round(Int(TimerDiff($aTimer_Inits[1])) / 1000 / 60 / 60, 2) >= $nTrial Then $nDays_Over += 1
        EndIf
    EndIf
    
    If $nDays_Over > $nTrial Then
        MsgBox(262144+48, "*" & $sTrialExp_Title & "*", StringFormat($sTrialExp_Msg, $nTrial))
        Exit
    EndIf
EndFunc

The value is set by hours, in this example there is only one (1) hour Trial :) - Run it, and run it after 1 hour, check if it works..

MsCreatoR:

Thank you for your example. :) One question though, will it say your trial has expired if I set the time forward?

I ran it, then closed it, then set the clock forward two hours and it did not say that my trial was expired.

Edited by valleyforge
Link to post
Share on other sites
Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...