Jump to content

Autoit Wrappers


Valuater
 Share

Recommended Posts

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.

This example is not relied on the system time, it uses TimerInit/Diff().

 

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 comment
Share on other sites

  • 3 weeks later...

; get Active Window  (Title)(Text)
; Author - SmOke_N & Valuater

$MyText = WinGetText(FindActiveWindow())
$MyTitle = WinGetTitle(FindActiveWindow())
MsgBox(0, $MyTitle, $MyText)
Func FindActiveWindow()
    Local $HidOpt = Opt("WinDetectHiddenText", 1);0=don't detect, 1=do detect
    Local $w_WinList = WinList()
    For $i = 1 to $w_WinList[0][0]
      If $w_WinList[$i][0] <> "" AND BitAnd(WinGetState($w_WinList[$i][1]), 2) _
          And BitAnd(WinGetState($w_WinList[$i][1]), 8) Then Return $w_WinList[$i][0]
      Next
    Opt("WinDetectHiddenText", $HidOpt);0=don't detect, 1=do detect
EndFunc

8)

wingettitle("")

done?

-jaenster

Link to comment
Share on other sites

wingettitle("")

done?

The UDF also checks if the window is visible :)

@MsCreator

How can i set the trial period to 30-days ? (That means 720 hours, right ?)

Yes, 24 * 30 :)

 

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 comment
Share on other sites

  • 2 weeks later...

I updated the _IconButon UDF: Now the Icon doesn't need the Disabled-State anymore :D

;===============================================================================
;
; Function Name:   _IconButton(
; Description::    Creates a button with Icon and Text
; Parameter(s):    $text - text
;                  $dll - Icon FileName
;                  $iconID - ID of icon in File
;                  $x - top
;                  $y - left
;                  $w - width, is min. 40
;                  $h - height, is min. 55
; Requirement(s):  AutoIT :P
; Return Value(s): ControlID of the button, to cnage the Icon use the functions below :)
; Author(s):       Prog@ndy
;
;===============================================================================
;
Func _IconButton($text,$dll,$iconID,$x,$y,$w = 50,$h = 60)
    Local $space, $spaceh = 9
    If $w < 40 Then $w = 40
    Local $space = Floor(($w-32)/2)
    If $h < 55 Then $h = 55
    If $h < 60 Then $spaceh = 5
    GUICtrlCreateIcon($dll, $iconID, $x+$space, $y+$spaceh, 32, 32,0) ; --> die letzte 0, damit kein Klick-Ereignis ausgelöst wird (Click-Through)
    Return GUICtrlCreateButton($text, $x, $y, $w, $h, BitOR($WS_CLIPSIBLINGS, $BS_BOTTOM, $BS_MULTILINE))
EndFunc

; by Prog@ndy
Func _IconButtonSetIco($btn,$dll, $iconID=0)
    GUICtrlSetImage($btn-1,$dll, $iconID)
EndFunc
; by Prog@ndy
Func _IconButtonDelete($btn)
    GUICtrlDelete($btn-1)
    GUICtrlDelete($btn)
EndFunc
; by Prog@ndy
Func _IconButtonIconSetStyle($btn,$style,$styleEx)
    GUICtrlSetStyle($btn-1,$style,$styleEx)
EndFunc

; Gets The Control ID of the Icon, so you can use all GUICtrl... Functions on it :)
; by Prog@ndy
Func _IconButtonIconGetCtrlID($btn)
    Return $btn-1
EndFunc

*GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes

Link to comment
Share on other sites

; multi-color changing background

; Author - monoceres


#include <GUIConstantsEx.au3>

Dim $color, $redm = 1, $bluem = 2, $greenm = 3, $index

GUICreate("test")
GUISetState()

While GUIGetMsg() <> -3
    Sleep(10)
    $index += 0.01
    $color = "0x" & Hex(255 * ((Sin($index * $redm) + 1) / 2), 2) & Hex(255 * ((Sin($index * $greenm) + 1) / 2), 2) & Hex(255 * ((Sin($index * $bluem) + 1) / 2), 2)
    GUISetBkColor($color)
WEnd

8)

NEWHeader1.png

Link to comment
Share on other sites

;  Slider with no annoying dotted border

; Author - martin




;example $slider1 = _GuiCtrlCreateSliderB(100,80,160,40)

Func _GUICtrlCreateSliderB($x, $y, $w, $h)
    Local $sld = GUICtrlCreateSlider(120, 96, 145, 49, $WS_CLIPSIBLINGS)
    GUICtrlCreateLabel("", $x, $y - 1, $w, 2)
    GUICtrlCreateLabel("", $x, $y + $h - 1, $w, 2)
    GUICtrlCreateLabel("", $x - 1, $y, 2, $h)
    GUICtrlCreateLabel("", $x + $w - 1, $y, 2, $y)
    Return $sld
EndFunc  ;==>_GUICtrlCreateSliderB

8)

The coords are predefined inside the UDF :) - «120, 96, 145, 49» should be replaced with «$x, $y, $w, $h».

 

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 comment
Share on other sites

The coords are predefined inside the UDF :) - «120, 96, 145, 49» should be replaced with «$x, $y, $w, $h».

In fact the function should have the labels disabled. BigDod actually came up with the idea of hiding the dotted lines with labels, smashly made it work and I made a function which is suspiciously like smashly's code, but I didn't think of disabling the labels. If the labels aren't disabled then it is possible to click and get the dotted lines to show, though I don't understand why.

Here is how it should be

Func _GUICtrlCreateSliderB($x, $y, $w, $h)
    Local $sld = GUICtrlCreateSlider($x, $y, $w, $h, $WS_CLIPSIBLINGS)
    GUICtrlCreateLabel("", $x, $y - 1, $w, 2)
    GUICtrlSetState(-1, $GUI_DISABLE)
    GUICtrlCreateLabel("", $x, $y + $h - 1, $w, 2)
    GUICtrlSetState(-1, $GUI_DISABLE)
    GUICtrlCreateLabel("", $x - 1, $y, 2, $h)
    GUICtrlSetState(-1, $GUI_DISABLE)
    GUICtrlCreateLabel("", $x + $w - 1, $y, 2, $h)
    GUICtrlSetState(-1, $GUI_DISABLE)
    Return $sld
    Return $sld
EndFunc;==>_GUICtrlCreateSliderB

For a better method see this example using subclassing.

Edited by martin
Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

; pick random sets of numbers

; author monoceres


$numbers=_Generate(7,1,36)
Dim $string
For $a=0 To UBound($numbers)-1
    $string&="Element "&$a&": "&$numbers[$a]&@CRLF
Next
MsgBox(0,"Array Display",$string)

Func _Generate ($size=7, $min=1, $max=36)
    Local $array[$size]
    $array[0]=Random($min,$max,1)
    For $i=0 To $size-1
        While True
            $temp=Random($min,$max,1)
            For $j=0 To $i-1
                If $array[$j]=$temp Then ContinueLoop 2
            Next
            ExitLoop
        WEnd
        $array[$i]=$temp
    Next
    Return $array
EndFunc

8)

NEWHeader1.png

Link to comment
Share on other sites

  • 4 weeks later...

New Time converter page

;
;===============================================================================
; Function Name:     _Time_12Hour()
; Description:   Return the time formatted according to your regional settings
; Syntax:   _Time_12Hour([include seconds])
; Parameter(s):   $iSec - whether to include the seconds in the output display
;                         0 - (default) don't include, anything except 0 - include
; Requirement(s):   
; Return Value(s):   Formatted time string
; Author(s):     GEOSoft with thanks to Valuater for helping shorten the code
;                                    as well as good advice. That's one more I owe him.
; Modification(s):   
; Note(s):    
; Example(s):   MsgBox(0, "TEST", _Time_12Hour(1))
;===============================================================================

Func _Time_12Hour($iSec = 0)
   Local $fKey = "HKCU\Control Panel\International", $ap = RegRead($fKey, "s1159")
   Local $pStr = RegRead($fKey, "s2359"), $tSep = RegRead($fKey, "sTime"), $sStr = ""
   Local $hour = @Hour
   If $hour = 0 Then $hour = 12
   If @Hour >= 12 Then
      $hour = @Hour
      If $hour > 12 Then $hour -= 12
      $ap = $pStr
   EndIf
   If $iSec <> 0 Then $sStr = $tSep & @Sec
   Return $hour & $tSep & @Min & $sStr & Chr(32) & $ap
EndFunc;<==> _Time_12Hour()
;oÝ÷ Ú]²Ü¥y«­¢+ÙÕ¹Q¥µ ¤(%!=UHÐìÄÈQ¡¸(ÀÌØí¡½ÕÈô!=UH´ÄÈ(ÀÌØí5A4ôÅÕ½ÐíA4ÅÕ½Ðì(±Í%!=UHôÀQ¡¸(ÀÌØí¡½ÕÈôÄÈ(ÀÌØí5A4ôÅÕ½Ðí4ÅÕ½Ðì(±Í(ÀÌØí¡½ÕÈô!=UH(ÀÌØí5A4ôÅÕ½Ðí4ÅÕ½Ðì(¹%(IÑÕɸÀÌØí¡½ÕȵÀìÅÕ½ÐìèÅÕ½ÐìµÀì5%8µÀìÀÌØí5A4)¹Õ¹

The new style takes into account for Regional Settings!!

8)

NEWHeader1.png

Link to comment
Share on other sites

Ever need to determine how often a character occurs in a string?

Here is a down and dirty method to do it. $cStr = The string to check, $cChar is the character to be counted and $iCase determines case sensitivity, if 0 then not case sensitive.

Func _StringGetChrCount($cStr, $cChr, $iCase = 0)
    If $iCase <> 0 Then $iCase = 1
    StringReplace($cStr, $cChr, $cChr, 0, $iCase)
    Return @Extended
 EndFunc

EDIT: I should have pointed ot that this an be used for othr purposes besides character counting.

Example to see how many times the word "and" appears in a text file.

$ count = _StringGetChrCount(FileRead("myfile.txt), " and ")
Edited by GEOSoft

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

; Get Path by PID

; Author - Smoke_N

$PID = Run("notepad.exe")
WinWaitActive("")

MsgBox(0x0,"PID/Path", _PidGetPath($PID))
    
    
Func _PidGetPath($pid = "", $strComputer = 'localhost')
    If $pid = "" Then $pid = WinGetProcess(WinGetTitle(""))
    $wbemFlagReturnImmediately = 0x10
    $wbemFlagForwardOnly = 0x20
    $colItems = ""
    $objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\CIMV2")
    $colItems = $objWMIService.ExecQuery ("SELECT * FROM Win32_Process WHERE ProcessId = " & $pid, "WQL", $wbemFlagReturnImmediately + $wbemFlagForwardOnly)
    If IsObj($colItems) Then
        For $objItem In $colItems
            If $objItem.ExecutablePath Then Return $objItem.ExecutablePath
        Next
    EndIf
EndFunc   ;==>_PidGetPath

8)

NEWHeader1.png

Link to comment
Share on other sites

;===============================================================================
; Function Name:     _ReturnCard()
; Description:   Returns a random card W/ Face value, Includes optional "Joker" card W/ No face valie
; Syntax:   _ReturnCard([$nJoker) 
; Parameter(s):   $nJoker- Boolean representing whether or not the "Joker" is a possible card
;                         0 - (default) Joker is not included
; Requirement(s):   
; Return Value(s):   $nJoker = 1: Card "Of" Face Value OR "Joker"
;                           $nJoker = 0: Card "Of" Face Value
; Author(s):     KentonBomb (KentonBomb@gmail.com)
; Modification(s):   None
; Note(s):   This UDF may be useful for games, but Autoit's Random function may not be just "Random" Enough
; Example(s):   MsgBox(0, "Your Card", "Your card was " & _ReturnCard())
;===============================================================================

Func _ReturnCard($nJoker = 0)
    Local $nNumbers, $azSplits, $nRandom, $nReturn, $sFace, $sFaces, $nRandom2
    $nNumbers = "Two,Three,Four,Five,Six,Seven,Eight,Nine,Ten,Jack,King,Queen,Ace"
    If $nJoker Then
        $nNumbers &= ",Joker"
    EndIf
    $azSplits = StringSplit($nNumbers, ",")
    $sReturn = $azSplits[Random(1, $azSplits[0], 1)]
    $sFaces = StringSplit("Spades|Clubs|Hearts|Diamonds", "|")
    $nRandom2 = Random(1, $sFaces[0] - 1)
    $sFace = $sFaces[Round($nRandom2)]
    If $sReturn = "Joker" Then
        Return $sReturn
    Else
        Return $sReturn & " Of " &$sFace
    EndIf
EndFunc   ;==>_ReturnCard

cool!

8)

NEWHeader1.png

Link to comment
Share on other sites

Form Snap to screen edges by Lazycat:

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

Just run this code and move GUI form near to the edge of screen and you will see ...

EDIT: Now placed code also directly to this post.

#include <GUIConstants.au3>

Global Const $WM_WINDOWPOSCHANGING = 0x0046 
Global Const $SPI_GETWORKAREA = 0x30

Global $nGap = 20, $nEdge = BitOR(1, 2, 4, 8); Left, Top, Right, Bottom

$hGUI = GUICreate("Snapped window", 300, 200)

GUIRegisterMsg($WM_WINDOWPOSCHANGING, "MY_WM_WINDOWPOSCHANGING")

GUISetState()

While 1
    $GUIMsg = GUIGetMsg()
    
    Switch $GUIMsg
        Case $GUI_EVENT_CLOSE
            ExitLoop
    EndSwitch
WEnd


Func MY_WM_WINDOWPOSCHANGING($hWnd, $Msg, $wParam, $lParam)
#cs
    HWND hwnd;
    HWND hwndInsertAfter;
    int x;
    int y;
    int cx;
    int cy;
    UINT flags;
#ce
    Local $stRect = DllStructCreate("int;int;int;int")
    Local $stWinPos = DllStructCreate("uint;uint;int;int;int;int;uint", $lParam)
    DllCall("User32.dll", "int", "SystemParametersInfo", "int", $SPI_GETWORKAREA, "int", 0, "ptr", DllStructGetPtr($stRect), "int", 0)
    Local $nLeft   = DllStructGetData($stRect, 1)
    Local $nTop = DllStructGetData($stRect, 2)
    Local $nRight  = DllStructGetData($stRect, 3) - DllStructGetData($stWinPos, 5)
    Local $nBottom = DllStructGetData($stRect, 4) - DllStructGetData($stWinPos, 6)
    If BitAND($nEdge, 1) and Abs($nLeft   - DllStructGetData($stWinPos, 3)) <= $nGap Then DllStructSetData($stWinPos, 3, $nLeft)
    If BitAND($nEdge, 2) and Abs($nTop  - DllStructGetData($stWinPos, 4)) <= $nGap Then DllStructSetData($stWinPos, 4, $nTop)
    If BitAND($nEdge, 4) and Abs($nRight  - DllStructGetData($stWinPos, 3)) <= $nGap Then DllStructSetData($stWinPos, 3, $nRight)
    If BitAND($nEdge, 8) and Abs($nBottom - DllStructGetData($stWinPos, 4)) <= $nGap Then DllStructSetData($stWinPos, 4, $nBottom)
    Return 0
EndFunc
Edited by Zedna
Link to comment
Share on other sites

; not sure if this one is in here

; Set a Child GUI into a Parent GUI

; Author - Everybody... 8)

Func _SetParent($h_child, $h_parent)
    Local $opt = Opt("WinTitleMatchMode", 2)
    If Not IsHWnd($h_parent) Then $h_parent = WinGetHandle($h_parent)
    If Not IsHWnd($h_child) Then $h_child = WinGetHandle($h_child) ; GUICtrlGetHandle($h_child)
    If DllCall("user32.dll", "hwnd", "SetParent", "hwnd", $h_child, "hwnd", $h_parent) <> 0 Then Return SetError(1, Opt("WinTitleMatchMode", $opt), 1)
    Return SetError(0, Opt("WinTitleMatchMode", $opt), 0)
EndFunc   ;==>_SetParent

8)

Edited by Valuater

NEWHeader1.png

Link to comment
Share on other sites

; not sure if this one is in here

; Set a Child GUI into a Parent GUI

; Author - Everybody... 8)

Func _SetParent($h_child, $h_parent)
    Local $opt = Opt("WinTitleMatchMode", 2)
    If Not IsHWnd($h_parent) Then $h_parent = WinGetHandle($h_parent)
    If Not IsHWnd($h_child) Then $h_child = WinGetHandle($h_child) ; GUICtrlGetHandle($h_child)
    If DllCall("user32.dll", "hwnd", "SetParent", "hwnd", $h_child, "hwnd", $h_parent) <> 0 Then Return SetError(1, Opt("WinTitleMatchMode", $opt), 1)
    Return SetError(0, Opt("WinTitleMatchMode", $opt), 0)
EndFunc   ;==>_SetParent

8)

_WinAPI_SetParent :)

And I have one in my sig that I made last year :)

Link to comment
Share on other sites

Just a new variation of the _Time_12Hour() posted above. This one is still in the regional format however you can return either 12 or 24 hour time using $tFormat. If $tFormat is not 12 then it returns 24 hour.

;
Func _Time($iSec = 0, $tFormat = 12)
  Local $fKey = "HKCU\Control Panel\International", $ap = RegRead($fKey, "s1159")
  Local $pStr = RegRead($fKey, "s2359"), $tSep = RegRead($fKey, "sTime"), $sStr = ""
  Local $hour = @Hour
  If $tFormat = 12 Then
    If $hour = 0 Then $hour = 12
    If @Hour >= 12 Then
      $hour = @Hour
      If $hour > 12 Then $hour -= 12
      $ap = $pStr
    EndIf
  Else
    $ap = ""
    $hour = StringFormat("%02u",$hour)
  EndIf
  If $iSec <> 0 Then $sStr = $tSep & @Sec
  If $ap <> "" Then $ap = Chr(32) & $ap
  Return $hour & $tSep & @Min & $sStr & $ap
EndFunc;<==> _Time()
;

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

  • 2 weeks later...

; Stop internal "beep" speaker

; Author - MrCreator

_EnableBeepSpeaker(0)
Beep(200, 600)

_EnableBeepSpeaker(1)
Beep(500, 300)

Func _EnableBeepSpeaker($iFlag=0, $iPause=500)
    Switch $iFlag
        Case 0
            Run(@ComSpec & ' /c net stop beep & sc config beep start= disabled', '', @SW_HIDE)
        Case Else
            Run(@ComSpec & ' /c sc config beep start= system & net start beep', '', @SW_HIDE)
    EndSwitch
    
    Sleep($iPause)
EndFunc

8)

NEWHeader1.png

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

  • Recently Browsing   0 members

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