Jump to content
Valuater

Autoit Wrappers

Recommended Posts

Zedna

; for ListView with checknoxes $Type: 0=uncheck all 1=check all 2=inversion check
Func _CheckListView($Form, $ListView, $Type) 
    GuiSetState(@SW_LOCK, $Form)
    For $i = 0 To _GUICtrlListViewGetItemCount($ListView) - 1
        Select
            Case $Type = 0
                $state = 0
            Case $Type = 1
                $state = 1
            Case $Type = 2
                $state = Not _GUICtrlListViewGetCheckedState($ListView, $i)
        EndSelect
        _GUICtrlListViewSetCheckState($ListView, $i, $state)
    Next
    GuiSetState(@SW_UNLOCK, $Form)
EndFunc

; example of use:
#include <GUIConstants.au3>
#include <GuiListView.au3>
#include <Misc.au3>

$Form1 = GUICreate("ListView checkboxes", 300, 300)
$ListView1 = GUICtrlCreateListView("#|Name|Age", 10, 10, 280, 250, _
                BitOR($LVS_REPORT,$LVS_SINGLESEL,$LVS_SHOWSELALWAYS,$WS_HSCROLL,$WS_VSCROLL,$WS_BORDER), _
                BitOR($WS_EX_CLIENTEDGE,$LVS_EX_CHECKBOXES,$LVS_EX_FULLROWSELECT))
$btn_inv_check = GUICtrlCreateButton("Inversion check", 60, 270, 85, 25)
$btn_check_all = GUICtrlCreateButton("Check all", 160, 270, 85, 25)
For $i = 1 To 10
    $tmp = $i & '|' & Chr($i + 64) & '|' & Random(1,100,1)
    GUICtrlCreateListViewItem($tmp, $ListView1)
    If Mod($i,2) Then GUICtrlSetState(-1, $GUI_CHECKED)
Next
GUICtrlSendMsg($ListView1, $LVM_SETCOLUMNWIDTH, 0, 50)
GUICtrlSendMsg($ListView1, $LVM_SETCOLUMNWIDTH, 1, 50)
GUICtrlSendMsg($ListView1, $LVM_SETCOLUMNWIDTH, 2, 50)
GUISetState(@SW_SHOW)

While 1
    ; when pressed Ctrl change text of button  from 'Check all' to 'Uncheck all'
    $tmp = GUICtrlRead($btn_check_all)
    If _IsPressed('11') = 1 Then ; Ctrl
        If $tmp = 'Check all' Then GUICtrlSetData($btn_check_all, 'Uncheck all')
    Else
        If $tmp = 'Uncheck all' Then GUICtrlSetData($btn_check_all, 'Check all')
    EndIf
        
    $msg = GuiGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
        Case $msg = $btn_inv_check
            _CheckListView($Form1, $ListView1, 2)
        Case $msg = $btn_check_all
            If _IsPressed('11') = 1 Then ; Ctrl
                _CheckListView($Form1, $ListView1, 0)
            Else
                _CheckListView($Form1, $ListView1, 1)
            EndIf
    EndSelect
WEnd

For real example see my Email_zak project from my signature ...

Edited by Zedna

Share this post


Link to post
Share on other sites
Zedna

This one I grabbed somewhere on this forum and used in my Obdelnik project , see my signature for example of use:

Const $RGN_AND = 1
Const $RGN_OR = 2
Const $RGN_XOR = 3
Const $RGN_DIFF = 4
Const $RGN_COPY = 5

Func _GuiHole($h_win, $i_x, $i_y, $i_sizew, $i_sizeh)
    Dim $pos, $outer_rgn, $inner_rgn, $wh, $combined_rgn
    $pos = WinGetPos($h_win)
   
    $outer_rgn = DllCall("gdi32.dll", "long", "CreateRectRgn", "long", 0, "long", 0, "long", $pos[2], "long", $pos[3])
    $inner_rgn = DllCall("gdi32.dll", "long", "CreateRectRgn", "long", $i_x, "long", $i_y, "long", $i_x + $i_sizew, "long", $i_y + $i_sizeh)
    $combined_rgn = DllCall("gdi32.dll", "long", "CreateRectRgn", "long", 0, "long", 0, "long", 0, "long", 0)
    DllCall("gdi32.dll", "long", "CombineRgn", "long", $combined_rgn[0], "long", $outer_rgn[0], "long", $inner_rgn[0], "int", $RGN_DIFF)
    DllCall("user32.dll", "long", "SetWindowRgn", "hwnd", $h_win, "long", $combined_rgn[0], "int", 1)
EndFunc
Edited by Zedna

Share this post


Link to post
Share on other sites
GaryFrost

This one I grabbed somewhere on this forum and used in my Obdelnik project , see my signature for example of use:

Const $RGN_AND = 1
Const $RGN_OR = 2
Const $RGN_XOR = 3
Const $RGN_DIFF = 4
Const $RGN_COPY = 5

Func _GuiHole($h_win, $i_x, $i_y, $i_sizew, $i_sizeh)
    Dim $pos, $outer_rgn, $inner_rgn, $wh, $combined_rgn
    $pos = WinGetPos($h_win)
   
    $outer_rgn = DllCall("gdi32.dll", "long", "CreateRectRgn", "long", 0, "long", 0, "long", $pos[2], "long", $pos[3])
    $inner_rgn = DllCall("gdi32.dll", "long", "CreateRectRgn", "long", $i_x, "long", $i_y, "long", $i_x + $i_sizew, "long", $i_y + $i_sizeh)
    $combined_rgn = DllCall("gdi32.dll", "long", "CreateRectRgn", "long", 0, "long", 0, "long", 0, "long", 0)
    DllCall("gdi32.dll", "long", "CombineRgn", "long", $combined_rgn[0], "long", $outer_rgn[0], "long", $inner_rgn[0], "int", $RGN_DIFF)
    DllCall("user32.dll", "long", "SetWindowRgn", "hwnd", $h_win, "long", $combined_rgn[0], "int", 1)
EndFunc
http://www.autoitscript.com/forum/index.ph...amp;hl=_GuiHole

SciTE for AutoItDirections for Submitting Standard UDFs

 

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

 

Share this post


Link to post
Share on other sites
fisofo
:P cancel that fella's, looks like i didn't fully debug. I'll post again when i get it working. Edited by fisofo

Share this post


Link to post
Share on other sites
DarthVega

; 30 Day Trial

If _DateDiff("D", $startdate, _NowCalc()) > 30 Then

MsgBox(0, "*XPClean Menu*", "You're registration period has expired.")

Exit

EndIf

You misspelled your!!! You're is YOU ARE. Your registration has expired.

Edited by DarthVega

Share this post


Link to post
Share on other sites
fisofo

Took some doing, but I finally figured this out. If you'd like to move a window that is maximized, using "winmove" will not change the windows' state. This will.

Global Const $WINDOWPLACEMENT = "uint;uint;uint;int[2];int[2];int[4]"

Func _NewWinMove($hWindow, $left, $top, $right, $bottom)
    Dim $rcNormalPosition[4] = [$left, $top, $right, $bottom]
    Dim $struct_WP = DllStructCreate($WINDOWPLACEMENT)
    DllStructSetData($struct_WP, 1, DllStructGetSize($struct_WP))
    DllStructSetData($struct_WP, 2, 0)
    DllStructSetData($struct_WP, 3, @SW_RESTORE)
    DllStructSetData($struct_WP, 6, $rcNormalPosition[0], 1)
    DllStructSetData($struct_WP, 6, $rcNormalPosition[1], 2)
    DllStructSetData($struct_WP, 6, $rcNormalPosition[2], 3)
    DllStructSetData($struct_WP, 6, $rcNormalPosition[3], 4)

    DllCall("user32.dll", "int", "SetWindowPlacement", "hwnd", $hWindow, "ptr", DllStructGetPtr($struct_WP))

    $struct_WP = 0
EndFunc

Note that it takes the top-left and bottom-right coordinates of a window, not the width and height.

Share this post


Link to post
Share on other sites
Valuater

;Time Machine #1
;Minutes/seconds/miliseconds

; Author - Valuater

$Minutes = 90 ; will wait 90 minutes

Local $60Count = 0, $begin = TimerInit()
While $Minutes > $60Count
   
    $dif = TimerDiff($begin)
    $dif2 = StringLeft($dif, StringInStr($dif, ".") -1)
    $Count = int($dif/1000)
    $60Count = Int($Count / 60)
   
    ToolTip("Minutes Required = " & $Minutes & @CRLF & "Minutes Past = " & $60Count & @CRLF & "Seconds Count = " & $Count & @CRLF & "Mili-Seconds Count = " & $dif2, 20, 20, "Time Machine #1", 1)
   
    Sleep(20)
   
WEnd

MsgBox(64, "Time-Up!!", "Your " & $Minutes & " minutes have passed    ")

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites
Valuater

; Time Machine #2
; Hours  & Minutes

; Author Valuater

$start = @HOUR & ":" & @MIN + 2 ; for testing

While 1

    $start2 = @HOUR & ":" & @MIN

    If $start = $start2 Then
        Run("notepad.exe")
        ExitLoop
    EndIf

    ToolTip("Start Time = " & $start & @CRLF & "Real Time = " & $start2, 20, 20, "Time Machine", 1)
    Sleep(2000)

WEnd
Exit

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites
Valuater

; Time Machine #3
; Day & Hour

; Author - Valuater

$start = @MDAY & "/" & @HOUR + 1 ; for testing

While 1

    $start2 = @MDAY & "/" & @HOUR

    If $start = $start2 Then
        Run("notepad.exe")
        Exit
    EndIf

    ToolTip("Start Time = " & $start & @CRLF & "Real Time = " & $start2, 20, 20, "Time Machine", 1)
    Sleep(2000)

WEnd
Exit

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites
Valuater

Or combine them into the first post? I agree it should be stickied though.

@Razer

I have tried to get all the posts on page one... thanks Razer

@ALL

Thanks for all the votes for "Sticky" status

BigDod, Theguy0000, D-Generation X, th.meger, and RazerM

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites
BigDod

This topic keeps getting harder to find.



Get Beta versions Here Get latest SciTE editor Here AutoIt 1-2-3 by Valuater - A great starting point.

Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

Share this post


Link to post
Share on other sites
fisofo

This topic keeps getting harder to find.

agreed... sticky!

Share this post


Link to post
Share on other sites
SmOke_N

This topic keeps getting harder to find.

Not as hard as the UDFs in it are to find!! Not to hard to find Search - Topics Only - Valuater ... it's somewhere among the multitude of them :)

@Val - Thought about linking to each one with a description in the first post?


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.

Share this post


Link to post
Share on other sites
Valuater

Not as hard as the UDFs in it are to find!! Not to hard to find Search - Topics Only - Valuater ... it's somewhere among the multitude of them :)

@Val - Thought about linking to each one with a description in the first post?

I thought I had "almost" all of the links on the first page, just adding a small description may help

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites
Valuater

; File size difference before (au3) and after (exe)...

; Author - SmOke_N

$file = FileOpenDialog('pick', @ScriptDir, 'Au3 (*.au3)')
If @error = -1 Then Exit
$Au2 = '"' & @ProgramFilesDir & '\AutoIt3\Aut2Exe\Aut2Exe.exe"'
$Exe2 =  '"' & @ProgramFilesDir & '\AutoIt3\Extras\Exe2Aut\Exe2Aut.exe"'
$newfile = _CompileDecompile($file, $Au2, $Exe2, 'bbbb')

Dim $sStringMain = FileRead($file), $nSizeMain = FileGetSize($file)
Dim $sStringNew = FileRead($newfile), $nSizeNew = FileGetSize($newfile)
Dim $nMainLines = UBound(StringSplit(StringStripCR($sStringMain), @LF)) - 1
Dim $nNewLines = UBound(StringSplit(StringStripCR($sStringNew), @LF)) - 1

FileDelete($newfile)

MsgBox(64, 'Info', '**** Current File ****' & @CRLF & _
    'Line Count = ' & $nMainLines & @CRLF & _
    'Kb size = ' & Round($nSizeMain / 1024, 2) & @CRLF & @CRLF & _
    '**** After Includes ****' & @CRLF & _
    'Line Count = ' & $nNewLines & @CRLF & _
    'kb size = ' & Round($nSizeNew / 1024, 2))

Func _CompileDecompile($filename, $Au2Exe, $Exe2Aut, $pass = 'asdf')
    RunWait ($Au2Exe & ' /in "' & $filename & '" /out "' & $filename & '.exe" /pass "' & $pass & '"')
    RunWait($Exe2Aut & ' /in "' & $filename & '.exe" /out "' & $filename & '_Output.au3" /pass "' & $pass & '"')
    FileDelete($filename & '.exe')
    Return $filename & '_Output.au3'
EndFunc

another nice one SmOke_N

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites
testingtest

hi not sure if this one is in here. I don't see it, its a nice function but not sure who to give credit to either.

#cs ----------------------------------------------------------------------------

 AutoIt Version: 3.2.1.14 (beta)
 Author:         myName

 Script Function:
    Template AutoIt script.

#ce ----------------------------------------------------------------------------

; Script Start - Add your code below here

$hwnd = GUICreate("Animate Window", 300, 200)
GUICtrlCreateLabel("Fantasic... You Have PASSED!!!", 50, 50, 200, 50)
GUICtrlSetFont( -1, 16, 800)

DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $hwnd, "int", 1000, "long", 0x00080000);fade-in
GUISetState()
DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $hwnd, "int", 1000, "long", 0x00090000);fade-out
DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $hwnd, "int", 500, "long", 0x00040001);slide in from left
DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $hwnd, "int", 500, "long", 0x00050002);slide out to left
DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $hwnd, "int", 500, "long", 0x00040002);slide in from right
DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $hwnd, "int", 500, "long", 0x00050001);slide out to right
DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $hwnd, "int", 500, "long", 0x00040004);slide-in from top
DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $hwnd, "int", 500, "long", 0x00050008);slide-out to top
DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $hwnd, "int", 500, "long", 0x00040008);slide-in from bottom
DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $hwnd, "int", 500, "long", 0x00050004);slide-out to bottom
DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $hwnd, "int", 500, "long", 0x00040005);diag slide-in from Top-left
DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $hwnd, "int", 500, "long", 0x0005000a);diag slide-out to Top-left
DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $hwnd, "int", 500, "long", 0x00040006);diag slide-in from Top-Right
DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $hwnd, "int", 500, "long", 0x00050009);diag slide-out to Top-Right
DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $hwnd, "int", 500, "long", 0x00040009);diag slide-in from Bottom-left
DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $hwnd, "int", 500, "long", 0x00050006);diag slide-out to Bottom-left
DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $hwnd, "int", 500, "long", 0x0004000a);diag slide-in from Bottom-right
DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $hwnd, "int", 500, "long", 0x00050005);diag slide-out to Bottom-right
DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $hwnd, "int", 500, "long", 0x00040010);explode
Sleep(1000)
DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $hwnd, "int", 5000, "long", 0x00050010);implode

#define AW_HOR_POSITIVE            0x00000001
#define AW_HOR_NEGATIVE            0x00000002
#define AW_VER_POSITIVE            0x00000004
#define AW_VER_NEGATIVE            0x00000008
#define AW_CENTER                  0x00000010
#define AW_HIDE                    0x00010000
#define AW_ACTIVATE                0x00020000
#define AW_SLIDE                   0x00040000
#define AW_BLEND                   0x00080000

Share this post


Link to post
Share on other sites
fisofo

hi not sure if this one is in here. I don't see it, its a nice function but not sure who to give credit to either.

When in doubt, assume gafrost :whistle:

In all seriousness, I'm pretty sure that's his code.

Share this post


Link to post
Share on other sites
testingtest

When in doubt, assume gafrost :whistle:

In all seriousness, I'm pretty sure that's his code.

don't want to make someone feel bad if it is there script , and get in a argument but thats funny :P

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.