Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 05/22/2019 in all areas

  1. I really want to have this, so, it's a head start ( and example ) of coloring this control ( or part of it so far ) So don't be shy and pitch in #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <GuiDateTimePicker.au3> #include <WindowsConstants.au3> #include <WinAPITheme.au3> #include <GuiMonthCal.au3> Global $g_hDTP1, $g_hDTP2, $g_idMemo Example() Func Example() Local $hGUI ; Create GUI $hGUI = GUICreate("DateTimePick coloring test", 500, 300) $g_idMemo = GUICtrlCreateEdit("", 2, 62, 496, 266, BitOR($GUI_SS_DEFAULT_EDIT,$ES_READONLY)) GUICtrlSetFont($g_idMemo, 9, 400, 0, "Courier New") GUICtrlSetData($g_idMemo, "MonthCal child handle will be created each time it pops up." & @CRLF & @CRLF, 1) $g_hDTP1 = GUICtrlGetHandle(GUICtrlCreateDate("", 2, 6, 185, 20)) $g_hDTP2 = _GUICtrlDTP_Create($hGUI, 2, 32, 240) GUICtrlCreateLabel("<-- now we need to find how to color", 195, 5, 500, 20) GUICtrlSetFont(-1, 9, 400, 0, "Courier New") GUICtrlSetState(-1, $GUI_FOCUS) GUICtrlCreateLabel("this part of the control", 280, 30, 500, 20) GUICtrlSetFont(-1, 9, 400, 0, "Courier New") GUICtrlSetState(-1, $GUI_FOCUS) GUISetState(@SW_SHOW) ; Set the display format _GUICtrlDTP_SetFormat($g_hDTP1, "ddd MMM dd, yyyy hh:mm ttt") _GUICtrlDTP_SetFormat($g_hDTP2, "ddd MMM dd, yyyy hh:mm ttt") GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY") WinActivate("DateTimePick coloring test") ; Loop until the user exits. Do Until GUIGetMsg() = $GUI_EVENT_CLOSE GUIDelete() EndFunc ;==>Example Func WM_NOTIFY($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg, $wParam Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR, $tInfo, $tBuffer, $tBuffer2, $iCtrl $tNMHDR = DllStructCreate($tagNMHDR, $lParam) $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom")) $iIDFrom = DllStructGetData($tNMHDR, "IDFrom") $iCode = DllStructGetData($tNMHDR, "Code") Switch $hWndFrom Case $g_hDTP1, $g_hDTP2 Switch $iCode Case $NM_SETFOCUS _WinAPI_SetThemeAppProperties(0) _DebugPrint("$NM_SETFOCUS" & @CRLF & "-->hWndFrom:" & @TAB & $hWndFrom & @CRLF & _ "-->IDFrom:" & @TAB & $iIDFrom & @CRLF & _ "-->Code:" & @TAB & $iCode) Case $NM_KILLFOCUS _WinAPI_SetThemeAppProperties(3) _DebugPrint("$NM_KILLFOCUS" & @CRLF & "-->hWndFrom:" & @TAB & $hWndFrom & @CRLF & _ "-->IDFrom:" & @TAB & $iIDFrom & @CRLF & _ "-->Code:" & @TAB & $iCode) Case $DTN_DROPDOWN ; Sent by a date and time picker (DTP) control when the user activates the drop-down month calendar _DebugPrint("$DTN_DROPDOWN" & @CRLF & "-->hWndFrom:" & @TAB & $hWndFrom & @CRLF & _ "-->IDFrom:" & @TAB & $iIDFrom & @CRLF & _ "-->Code:" & @TAB & $iCode) ; The return value for this notification is not used ; Get month control child handle $iCtrl = _GUICtrlDTP_GetMonthCal($hWndFrom) ;~ _WinAPI_SetWindowTheme($iCtrl, "", "") ; setting this here, does not change the size of the original canvas ;~ ; instead, for my simplicity, use _WinAPI_SetThemeAppProperties() OnFocus GUICtrlSetData($g_idMemo, "MonthCal child Handle: " & "0x" & Hex($iCtrl) & @CRLF, 1) _GUICtrlMonthCal_SetColor($iCtrl, $MCSC_TEXT, 0x8BD4DF) _GUICtrlMonthCal_SetColor($iCtrl, $MCSC_TITLEBK, 0xA9D7E4) _GUICtrlMonthCal_SetColor($iCtrl, $MCSC_TITLETEXT, 0x005894) _GUICtrlMonthCal_SetColor($iCtrl, $MCSC_MONTHBK, 0x3F3F3F) _GUICtrlMonthCal_SetColor($iCtrl, $MCSC_TRAILINGTEXT, 0xB2C2A9) Case $DTN_CLOSEUP ; Sent by a date and time picker (DTP) control when the user closes the drop-down month calendar _DebugPrint("$DTN_CLOSEUP" & @CRLF & "-->hWndFrom:" & @TAB & $hWndFrom & @CRLF & _ "-->IDFrom:" & @TAB & $iIDFrom & @CRLF & _ "-->Code:" & @TAB & $iCode) ; The return value for this notification is not used Case $DTN_DATETIMECHANGE ; Sent by a date and time picker (DTP) control whenever a change occurs $tInfo = DllStructCreate($tagNMDATETIMECHANGE, $lParam) _DebugPrint("$DTN_DATETIMECHANGE" & @CRLF & "-->hWndFrom:" & @TAB & DllStructGetData($tInfo, "hWndFrom") & @CRLF & _ "-->IDFrom:" & @TAB & DllStructGetData($tInfo, "IDFrom") & @CRLF & _ "-->Code:" & @TAB & DllStructGetData($tInfo, "Code") & @CRLF & _ "-->Flag:" & @TAB & DllStructGetData($tInfo, "Flag") & @CRLF & _ "-->Year:" & @TAB & DllStructGetData($tInfo, "Year") & @CRLF & _ "-->Month:" & @TAB & DllStructGetData($tInfo, "Month") & @CRLF & _ "-->DOW:" & @TAB & DllStructGetData($tInfo, "DOW") & @CRLF & _ "-->Day:" & @TAB & DllStructGetData($tInfo, "Day") & @CRLF & _ "-->Hour:" & @TAB & DllStructGetData($tInfo, "Hour") & @CRLF & _ "-->Minute:" & @TAB & DllStructGetData($tInfo, "Minute") & @CRLF & _ "-->Second:" & @TAB & DllStructGetData($tInfo, "Second") & @CRLF & _ "-->MSecond:" & @TAB & DllStructGetData($tInfo, "MSecond")) Return 0 Case $DTN_FORMAT ; Sent by a date and time picker (DTP) control to request text to be displayed in a callback field $tInfo = DllStructCreate($tagNMDATETIMEFORMAT, $lParam) $tBuffer = DllStructCreate("char Format[128]", DllStructGetData($tInfo, "Format")) $tBuffer2 = DllStructCreate("char Display[64]", DllStructGetData($tInfo, "pDisplay")) _DebugPrint("$DTN_FORMAT" & @CRLF & "-->hWndFrom:" & @TAB & DllStructGetData($tInfo, "hWndFrom") & @CRLF & _ "-->IDFrom:" & @TAB & DllStructGetData($tInfo, "IDFrom") & @CRLF & _ "-->Code:" & @TAB & DllStructGetData($tInfo, "Code") & @CRLF & _ "-->Format:" & @TAB & DllStructGetData($tBuffer, "Format") & @CRLF & _ "-->Year:" & @TAB & DllStructGetData($tInfo, "Year") & @CRLF & _ "-->Month:" & @TAB & DllStructGetData($tInfo, "Month") & @CRLF & _ "-->DOW:" & @TAB & DllStructGetData($tInfo, "DOW") & @CRLF & _ "-->Day:" & @TAB & DllStructGetData($tInfo, "Day") & @CRLF & _ "-->Hour:" & @TAB & DllStructGetData($tInfo, "Hour") & @CRLF & _ "-->Minute:" & @TAB & DllStructGetData($tInfo, "Minute") & @CRLF & _ "-->Second:" & @TAB & DllStructGetData($tInfo, "Second") & @CRLF & _ "-->MSecond:" & @TAB & DllStructGetData($tInfo, "MSecond") & @CRLF & _ "-->Display:" & @TAB & DllStructGetData($tBuffer2, "Display")) Return 0 Case $DTN_FORMATQUERY ; Sent by a date and time picker (DTP) control to retrieve the maximum allowable size of the string that will be displayed in a callback field $tInfo = DllStructCreate($tagNMDATETIMEFORMATQUERY, $lParam) $tBuffer = DllStructCreate("char Format[128]", DllStructGetData($tInfo, "Format")) _DebugPrint("$DTN_FORMATQUERY" & @CRLF & "-->hWndFrom:" & @TAB & DllStructGetData($tInfo, "hWndFrom") & @CRLF & _ "-->IDFrom:" & @TAB & DllStructGetData($tInfo, "IDFrom") & @CRLF & _ "-->Code:" & @TAB & DllStructGetData($tInfo, "Code") & @CRLF & _ "-->Format:" & @TAB & DllStructGetData($tBuffer, "Format") & @CRLF & _ "-->SizeX:" & @TAB & DllStructGetData($tInfo, "SizeX") & @CRLF & _ "-->SizeY:" & @TAB & DllStructGetData($tBuffer2, "SizeY")) DllStructSetData($tInfo, "SizeX", 64) DllStructSetData($tInfo, "SizeY", 10) Return 0 Case $DTN_USERSTRING ; Sent by a date and time picker (DTP) control when a user finishes editing a string in the control $tInfo = DllStructCreate($tagNMDATETIMESTRING, $lParam) $tBuffer = DllStructCreate("char UserString[128]", DllStructGetData($tInfo, "UserString")) _DebugPrint("$DTN_USERSTRING" & @CRLF & "-->hWndFrom:" & @TAB & DllStructGetData($tInfo, "hWndFrom") & @CRLF & _ "-->IDFrom:" & @TAB & DllStructGetData($tInfo, "IDFrom") & @CRLF & _ "-->Code:" & @TAB & DllStructGetData($tInfo, "Code") & @CRLF & _ "-->UserString:" & @TAB & DllStructGetData($tBuffer, "UserString") & @CRLF & _ "-->Year:" & @TAB & DllStructGetData($tInfo, "Year") & @CRLF & _ "-->Month:" & @TAB & DllStructGetData($tInfo, "Month") & @CRLF & _ "-->DOW:" & @TAB & DllStructGetData($tInfo, "DOW") & @CRLF & _ "-->Day:" & @TAB & DllStructGetData($tInfo, "Day") & @CRLF & _ "-->Hour:" & @TAB & DllStructGetData($tInfo, "Hour") & @CRLF & _ "-->Minute:" & @TAB & DllStructGetData($tInfo, "Minute") & @CRLF & _ "-->Second:" & @TAB & DllStructGetData($tInfo, "Second") & @CRLF & _ "-->MSecond:" & @TAB & DllStructGetData($tInfo, "MSecond") & @CRLF & _ "-->Flags:" & @TAB & DllStructGetData($tInfo, "Flags")) Return 0 Case $DTN_WMKEYDOWN ; Sent by a date and time picker (DTP) control when the user types in a callback field $tInfo = DllStructCreate($tagNMDATETIMEFORMATQUERY, $lParam) $tBuffer = DllStructCreate("char Format[128]", DllStructGetData($tInfo, "Format")) _DebugPrint("$DTN_WMKEYDOWN" & @CRLF & "-->hWndFrom:" & @TAB & DllStructGetData($tInfo, "hWndFrom") & @CRLF & _ "-->IDFrom:" & @TAB & DllStructGetData($tInfo, "IDFrom") & @CRLF & _ "-->Code:" & @TAB & DllStructGetData($tInfo, "Code") & @CRLF & _ "-->VirtKey:" & @TAB & DllStructGetData($tInfo, "VirtKey") & @CRLF & _ "-->Format:" & @TAB & DllStructGetData($tBuffer, "Format") & @CRLF & _ "-->Year:" & @TAB & DllStructGetData($tInfo, "Year") & @CRLF & _ "-->Month:" & @TAB & DllStructGetData($tInfo, "Month") & @CRLF & _ "-->DOW:" & @TAB & DllStructGetData($tInfo, "DOW") & @CRLF & _ "-->Day:" & @TAB & DllStructGetData($tInfo, "Day") & @CRLF & _ "-->Hour:" & @TAB & DllStructGetData($tInfo, "Hour") & @CRLF & _ "-->Minute:" & @TAB & DllStructGetData($tInfo, "Minute") & @CRLF & _ "-->Second:" & @TAB & DllStructGetData($tInfo, "Second") & @CRLF & _ "-->MSecond:" & @TAB & DllStructGetData($tInfo, "MSecond")) Return 0 Case Else _DebugPrint("$DTN_?????" & @CRLF & "-->hWndFrom:" & @TAB & $hWndFrom & @CRLF & _ "-->IDFrom:" & @TAB & $iIDFrom & @CRLF & _ "-->Code:" & @TAB & $iCode) EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_NOTIFY Func _DebugPrint($s_Text, $sLine = @ScriptLineNumber) ConsoleWrite( _ "!===========================================================" & @CRLF & _ "+======================================================" & @CRLF & _ "-->Line(" & StringFormat("%04d", $sLine) & "):" & @TAB & $s_Text & @CRLF & _ "+======================================================" & @CRLF) EndFunc ;==>_DebugPrint Hopefully it'll turn into a UDF
    2 points
  2. seangriffin

    Chrome UDF

    Chrome support for AutoIT is here! This UDF includes a Chrome Extension (http://developer.chrome.com/extensions/getstarted.html) and Native Messaging Host (http://developer.chrome.com/extensions/messaging.html#native-messaging-host) that integrate with a new Chrome UDF (Chrome.au3) to provide automation support for the Chrome browser. Several steps are required to install the Chrome Extension and Native Messaging Host prior to using the UDF. Please read the INSTALLATION section below. REQUIREMENTS: Windows XP 32-bit, Windows 7 32-bit or Windows 7 64-bit AutoIt3 3.2 or higher Chrome v29 or later (earlier versions are untested) AutoIT for Google Chrome (Chrome extension - see below) AutoIT Chrome Native Messaging Host (see below) INSTALLATION: STEP 1: Install the AutoIT extension into Chrome. Open the following link and download the file named AutoIT for Google Chrome.crx: https://docs.google.com/file/d/0B_6JmwNIIZ06enotRTVFNVdKOXM/edit?usp=sharing Note - you may be prompted to login with a Google account as this file is hosted on Google Drive. In your Chrome browser click on the Chrome menu, then select Tools -> Extensions. Drag the AutoIT for Google Chrome.crx file that you downloaded above, from Windows Explorer, into this page in Chrome. You should now see AutoIT for Google Chrome listed in the Extensions page in Chrome. Ensure that the Enabled checkbox next to AutoIT for Google Chrome is checked. Also make sure the Allow access to file URLs box is checked (very important to make EXAMPLE 2 work below)!! STEP 2: Install the AutoIT Chrome Native Messaging Host. Open the following link and download the file named autoit_chrome_native_messaging_host_install.exe: https://docs.google.com/file/d/0B_6JmwNIIZ06eDgxaVJPNUNxa28/edit?usp=sharing Note - you may be prompted to login with a Google account as this file is hosted on Google Drive. Run this file (autoit_chrome_native_messaging_host_install.exe). An installation window will display. Click the Install button. The window will display "Completed" and you can click the Close button. STEP 3: Install the Chrome UDF into AutoIT. Scroll to the DOWNLOAD section below, and save the Chrome.au3 file into your AutoIT Include folder (C:Program FilesAutoIt3Include). Please close your Chrome browser once you've completed these steps. LIST OF FUNCTIONS: EXAMPLE #1: This following example starts up Chrome and navigates to the URL http://www.december.com/html/demo/form.html. It then automatically completes the HTML form in this page (a series of text, radio, and checkbox input elements and select elements) and clicks the Send this survey button. The script waits for the next page to load, and retrieves the various elements from the page to the AutoIT console. chrome_example.au3 EXAMPLE #2: The following is an example of the automation of an offline HTML page (file URL). First, download the file named chrome_udf_example_2.html to your C: folder: https://docs.google.com/file/d/0B_6JmwNIIZ06SWduMjZGTVViNlU/edit?usp=sharing Then run the following AutoIT script: chrome_example_2.au3 Note that you must have checked the Allow access to file URLs box in the Chrome extension to make this work! DOWNLOAD: Latest Version - v0.5 (29/09/13) Chrome.au3
    1 point
  3. [NEW VERSION] - 17 Mar 22 Added: A new function _Notify_Size which allows you to adjust the size of the notification from its default 160x40. Please read the function header to see the max/min sizes that you can set for the width and height - the function returns informative @error/@extended values if these are not respected. Regardless of the size set, each notification will still display only 2 lines of text with the size of font used set automatically by the UDF. New UDF in the zip below. Previous changes: Changelog.txt A while ago I was asked to help port an AHK UDF to AutoIt. This was not too difficult and I found it useful myself (as a replacement for ConsoleWrite when debugging compiled scripts among other things). I have been polishing it for a while and thought I might release it in case it proves useful to anyone else. The notifications produced by Notify are small 2-line boxes that pop out of the edge of the display one above the other (you can select which side and in which direction they appear) - you can have as many as you want although only as many as can fit on your display will appear, the others will appear as soon as there is room. You can select whether they will retract after a certain time and/or when clicked. Colours and font are user-definable, and you can add an icon or image (bmp, jpg, gif or png) if you wish. When a notification retracts, the others move to leave space for more (you can select a smoooth slide or an instant move) - run the examples to see them in action. If you find the default sizing of the notifications is not to your liking you can change it by amending these values in the UDF (lines #354-356): ; Set default auto-sizing Notify dimensions Local $iNotify_Width_max = 300 Local $iNotify_Width_min = 150 Local $iNotify_Height = 40 A zip containing the UDF, example scripts and my StringSize UDF (which is also required): Notify.zip As usual happy for comments and/or compliments. M23
    1 point
  4. Utter is a free ware windows API automation script.It can do most of the sapi dll functions."SAPI" stands for Windows Speech Reconition API,SAPI.dll is the file which manages the speech recognition of windows Utter utilises most of the SAPI functions making use of the best potential of SAPI.dll,You can include speech recognition to your project by using utter. Utter zipped and updated (new version with examples) Modified ......: 12/04/2017 Version .......: 3.0.0.1 Author ........: Surya I am new to autoit it sounds great and i love it while i am getting used to it so i want to write my own UDF in autoit first of all i thank all the forum members because i couldnt do it without research,So i wrote UTTER ,Its is a UDF that uses most of the SAPI dll function or in simple words it can do many functions relating to the computers speech recognition if you have any doubt in the code or have any bugs please notify me freely I will be always there to help its my first UDF so please notify me if you found any error Thank you! Utter has been recently updated ,examples included.The zip can be downloaded here at the download section of autoit : Download utter !! CAUTION !! REMEMBER TO SHUTDOWN THE INSTANCE OF CREATED RECOGNITION ENGINE BEFORE STARTING ANOTHER INSTANCE IF YOU START ANOTHER WITHOUT SHUTTING THE PREVIOUS ONE DOWN IT WILL LEAD TO AN ERROR! REMEMBER THAT "|" IS THE DEFAULT GUIDataSeparatorChar CHANGE IT ACCORDING TO YOUR NEEDS AND GRAMMAR DELIMITER IS GUIDataSeparatorChar IF NO GUIDataSeparatorChar IS FOUND IN THE INPUT STRING THEN THE ENTIRE STRING WOULD BE CONSIDERED AS ONE WORD! DO NOT CALL THE INTERNAL FUNCTIONS THEY ARE TO BE CALLED INSIDE THE FUNCTION AND DO NOT CHANGE THE VALUE OF VARIABLES USED IN THE FUNCTION! THE RECIEVING FUNCTIONS SHOULD HAVE ATLEAST ONE PARAMETER TO ACCEPT THE SPEECH COMMANDS FROM THE _Utter_Speech_GrammarRecognize() FUNCTION please report if you have any bugs/complaints
    1 point
  5. Hi This is my first post in the forum I want to share with you what you recently modified on MetroGUI-UDF You added an icon or an image that appears with the button Such as what appears in the picture I added the function _Metro_ButtonImageRect _Metro_CreateButtonImage ; #FUNCTION# ==================================================================================================================== ; Name ..........: _Metro_ButtonImageRect ; Description ...: Make a data map of the position and size of the image within the button. ; Syntax ........: _Metro_ButtonImageRect($Image[, $X = Default[, $Y = Default[, $W = Default[, $H = Default]]]]) ; Parameters ....: $Image - image path. ; $Left - [optional] Left pos. ; $Top - [optional] Top pos. ; $Width - [optional] Width. ; $Height - [optional] Height. ; Return values .: Map in following format: ; : ["Image"] = image path. ; : ["Left"] = Left pos. ; : ["Top"] = Top pos. ; : ["Width"] = Width. ; : ["Height"] = Height. ; Author ........: DevMode ; =============================================================================================================================== Func _Metro_ButtonImageRect($Image, $X = Default, $Y = Default, $W = Default, $H = Default) Local $ImageMap[] $ImageMap["Image"] = $Image $ImageMap["Left"] = $X $ImageMap["Top"] = $Y $ImageMap["Width"] = $W $ImageMap["Height"] = $H Return $ImageMap EndFunc ; =============================================================================================================================== ; Name ..........: _Metro_CreateButtonImage ; Description ...: Creates metro style buttons with Image. Hovering creates a frame around the buttons. ; Syntax ........: _Metro_CreateButton($Text, $ImageMap, $Left, $Top, $Width, $Height[, $BGColor = $ButtonBKColor[, ; $FontColor = $ButtonTextColor[, $Font = "Arial"[, $Fontsize = 12.5[, $FontStyle = 1 $FrameColor = "0xFFFFFF"]]]]]) ; Parameters ....: $Text - Text of the button. ; $ImageMap - Image in format Map ; $Left - Left pos. ; $Top - Top pos. ; $Width - Width. ; $Height - Height. ; $BGColor - [optional] Button background color. Default is $ButtonBKColor. ; $FontColor - [optional] Font colore. Default is $ButtonTextColor. ; $Font - [optional] Font. Default is "Arial". ; $Fontsize - [optional] Fontsize. Default is 12.5. ; $FontStyle - [optional] Fontstyle. Default is 1. ; $FrameColor - [optional] Button frame color. Default is "0xFFFFFF". ; Return values .: Handle to the button. ; EditBy : DevMode ; =============================================================================================================================== Func _Metro_CreateButtonImage($Text,$ImageMap,$Left, $Top, $Width, $Height, $BG_Color = $ButtonBKColor, $Font_Color = $ButtonTextColor, $Font = "Arial", $Fontsize = 10, $FontStyle = 1, $FrameColor = "0xFFFFFF") Local $Button_Array[16] Local $btnDPI = _HighDPICheck() ;HighDPI Support If $HIGHDPI_SUPPORT Then $Left = Round($Left * $gDPI) $Top = Round($Top * $gDPI) $Width = Round($Width * $gDPI) $Height = Round($Height * $gDPI) Else $Fontsize = ($Fontsize / $Font_DPI_Ratio) EndIf $Button_Array[1] = False ; Set hover OFF $Button_Array[3] = "2" ; Type $Button_Array[9] = $Text $Button_Array[15] = GetCurrentGUI() ;Calculate Framesize Local $FrameSize = Round(4 * $btnDPI) If Not (Mod($FrameSize, 2) = 0) Then $FrameSize = $FrameSize - 1 ;Set Colors $BG_Color = "0xFF" & Hex($BG_Color, 6) $Font_Color = "0xFF" & Hex($Font_Color, 6) $FrameColor = "0xFF" & Hex($FrameColor, 6) Local $Brush_BTN_FontColor = _GDIPlus_BrushCreateSolid($Font_Color) Local $Brush_BTN_FontColorDis = _GDIPlus_BrushCreateSolid(StringReplace(_AlterBrightness($Font_Color, -30), "0x", "0xFF")) Local $Pen_BTN_FrameHoverColor = _GDIPlus_PenCreate($FrameColor, $FrameSize) ;Create Button graphics Local $Button_Graphic1 = _iGraphicCreate($Width, $Height, $BG_Color, 0, 5) ;Default Local $Button_Graphic2 = _iGraphicCreate($Width, $Height, $BG_Color, 0, 5) ;Hover Local $Button_Graphic3 = _iGraphicCreate($Width, $Height, $BG_Color, 0, 5) ;Disabled If IsMap($ImageMap) And FileExists($ImageMap.Image) Then $hImage = _GDIPlus_ImageLoadFromFile($ImageMap.Image) If $ImageMap.Left = Default Then $ImageMap.Left = ($Height-$Height/1.5)/2 If $ImageMap.Top = Default Then $ImageMap.Top = ($Height-$Height/1.5)/2 If $ImageMap.Width = Default Then $ImageMap.Width = $Height/1.5 If $ImageMap.Height = Default Then $ImageMap.Height = $Height/1.5 _GDIPlus_GraphicsDrawImageRect($Button_Graphic1[0], $hImage,$ImageMap.Left,$ImageMap.Top,$ImageMap.Width,$ImageMap.Height) _GDIPlus_GraphicsDrawImageRect($Button_Graphic2[0], $hImage,$ImageMap.Left,$ImageMap.Top,$ImageMap.Width,$ImageMap.Height) _GDIPlus_ImageDispose($hImage) EndIf ;Create font, Set font options Local $hFormat = _GDIPlus_StringFormatCreate(), $hFamily = _GDIPlus_FontFamilyCreate($Font), $hFont = _GDIPlus_FontCreate($hFamily, $Fontsize, $FontStyle) Local $tLayout = _GDIPlus_RectFCreate(($Height/1.5)/2, 0, $Width, $Height) _GDIPlus_StringFormatSetAlign($hFormat, 1) _GDIPlus_StringFormatSetLineAlign($hFormat, 1) ;Draw button text _GDIPlus_GraphicsDrawStringEx($Button_Graphic1[0], $Text, $hFont, $tLayout, $hFormat, $Brush_BTN_FontColor) _GDIPlus_GraphicsDrawStringEx($Button_Graphic2[0], $Text, $hFont, $tLayout, $hFormat, $Brush_BTN_FontColor) _GDIPlus_GraphicsDrawStringEx($Button_Graphic3[0], $Text, $hFont, $tLayout, $hFormat, $Brush_BTN_FontColorDis) ;Add frame _GDIPlus_GraphicsDrawRect($Button_Graphic2[0], 0, 0, $Width, $Height, $Pen_BTN_FrameHoverColor) ;Release created objects _GDIPlus_FontDispose($hFont) _GDIPlus_FontFamilyDispose($hFamily) _GDIPlus_StringFormatDispose($hFormat) _GDIPlus_BrushDispose($Brush_BTN_FontColor) _GDIPlus_BrushDispose($Brush_BTN_FontColorDis) _GDIPlus_PenDispose($Pen_BTN_FrameHoverColor) ;Set graphic and return Bitmap handle $Button_Array[0] = GUICtrlCreatePic("", $Left, $Top, $Width, $Height) $Button_Array[5] = _iGraphicCreateBitmapHandle($Button_Array[0], $Button_Graphic1) $Button_Array[6] = _iGraphicCreateBitmapHandle($Button_Array[0], $Button_Graphic2, False) $Button_Array[7] = _iGraphicCreateBitmapHandle($Button_Array[0], $Button_Graphic3, False) ;For GUI Resizing GUICtrlSetResizing($Button_Array[0], 768) _cHvr_Register($Button_Array[0], _iHoverOff, _iHoverOn, "", "", _iAddHover($Button_Array)) Return $Button_Array[0] EndFunc ;==>_Metro_CreateButton https://github.com/R3Pro/metro-style
    1 point
  6. matwachich

    Advanced Input Box

    DEPRECATED: see this new UDF
    1 point
  7. MattyD

    Big Analogue Clock

    Hey folks, This is actually the beginnings of something else - but I was pretty happy with how this part turned out. So hey, here is a clock. it is drag-able Escape (after clicking on clock) : Exit Wheel: Grow & Shrink Click Wheel: Reset Size Edit: somehow missed an include directive... #AutoIt3Wrapper_Au3Check_Parameters = -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7 #NoTrayIcon #include <GDIPlus.au3> #include <GUIConstants.au3> #include <WinAPI.au3> #include <WindowsConstants.au3> Opt("MustDeclareVars", 1) Global $hGUI, $iWinH, $iWinW, $iChSize, _ $iStartSz, $iMargin, $iCanvasSz, $iWinXStartPos Global Const $PI = 4 * ATan(1) Global Const $MAGIC_PINK = 0xFF00FF, $MAGIC_PINK_ARGB = 0xFFFF00FF $iWinH = @DesktopHeight $iWinW = $iWinH $iCanvasSz = $iWinH $iMargin = 4 $iStartSz = Int($iWinH / 4) - (2 * $iMargin) $iWinXStartPos = 0 ;Right Side: ide@DesktopWidth - ($iStartSz + (2 * $iMargin)) $hGUI = GUICreate("Clock", $iWinW, $iWinH, $iWinXStartPos, 0, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_TOPMOST)) GUISetBkColor($MAGIC_PINK) _WinAPI_SetLayeredWindowAttributes($hGUI, $MAGIC_PINK, 0xF0) GUISetState(@SW_SHOW) GUIRegisterMsg($WM_NCHITTEST, "WM_NCHITTEST") GUIRegisterMsg($WM_MOUSEWHEEL, "WM_MOUSEWHEEL") GUIRegisterMsg($WM_NCMBUTTONDOWN, "WM_NCMBUTTONDOWN") Clock() Func Clock() Local $hGraphic, $hClockBitmap, $hClockGraphic Local $iSize, $iDigSize, $iOrigin Local $iNumDist, $iDigXOffset, $iDigYOffset Local $ixOffset, $iyOffset Local $hFrameBrush, $hNoseBrush, $hHighlightBrush, $hFaceBrush Local $hBlackPen, $hSecPen, $hMinPen, $hHourPen Local $iSec, $iMin, $iHour Local $ixSecOffset, $iySecOffset, $ixMinOffset, $iyMinOffset, _ $ixHourOffset, $iyHourOffset $iDigSize = $iSize / 20 $iChSize = $iStartSz _GDIPlus_Startup() $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGUI) $hClockBitmap = _GDIPlus_BitmapCreateFromGraphics($iCanvasSz, $iCanvasSz, $hGraphic) $hClockGraphic = _GDIPlus_ImageGetGraphicsContext($hClockBitmap) _GDIPlus_GraphicsSetSmoothingMode($hClockGraphic, 4) $hFrameBrush = _GDIPlus_BrushCreateSolid(0xFF80BBCC) $hNoseBrush = _GDIPlus_BrushCreateSolid(0xEE778888) $hHighlightBrush = _GDIPlus_BrushCreateSolid(0x44FF00FF) $hFaceBrush = _GDIPlus_BrushCreateSolid(0xFFEEF0FF) $hSecPen = _GDIPlus_PenCreate(0xBB882255, 1) $hMinPen = _GDIPlus_PenCreate(0xBBFF8833, 4) $hHourPen = _GDIPlus_PenCreate(0xEE4488AA, 5) $hBlackPen = _GDIPlus_PenCreate(0xFF000000, 4) Do If $iSize <> $iChSize Or @SEC <> $iSec Then $iSize = $iChSize $iDigSize = $iSize / 20 $iOrigin = Int($iSize / 2) + $iMargin $iNumDist = $iSize / 2 - ($iSize / 8) $iDigXOffset = .55 * $iDigSize $iDigYOffset = -(.7 * $iDigSize) _GDIPlus_GraphicsClear($hClockGraphic, $MAGIC_PINK_ARGB) _GDIPlus_GraphicsFillEllipse($hClockGraphic, $iMargin, $iMargin, $iSize, $iSize, $hFrameBrush) _GDIPlus_GraphicsFillEllipse($hClockGraphic, $iMargin + 8, $iMargin + 8, $iSize - 8, $iSize - 8, $hHighlightBrush) _GDIPlus_GraphicsFillEllipse($hClockGraphic, $iMargin + 8, $iMargin + 8, $iSize - 16, $iSize - 16, $hFaceBrush) _GDIPlus_GraphicsDrawEllipse($hClockGraphic, $iMargin, $iMargin, $iSize, $iSize, $hBlackPen) For $i = 1 To 12 $ixOffset = Int($iNumDist * Sin($i * ($PI / 6))) $iyOffset = Int($iNumDist * Cos($i * ($PI / 6))) $ixOffset -= (StringLen($i) * $iDigXOffset) $iyOffset -= $iDigYOffset _GDIPlus_GraphicsDrawString($hClockGraphic, $i, ($iOrigin + $ixOffset), ($iOrigin - $iyOffset), "Symbol", $iDigSize) Next $iSec = @SEC $iMin = 60 * @MIN + $iSec $iHour = (3600 * @HOUR) + $iMin $ixSecOffset = Int((0.83 * $iNumDist) * Sin($iSec * ($PI / 30))) $iySecOffset = Int((0.83 * $iNumDist) * Cos($iSec * ($PI / 30))) $ixMinOffset = Int((0.85 * $iNumDist) * Sin($iMin * ($PI / 1800))) $iyMinOffset = Int((0.85 * $iNumDist) * Cos($iMin * ($PI / 1800))) $ixHourOffset = Int((0.65 * $iNumDist) * Sin($iHour * ($PI / 21600))) $iyHourOffset = Int((0.65 * $iNumDist) * Cos($iHour * ($PI / 21600))) _GDIPlus_GraphicsDrawLine($hClockGraphic, $iOrigin, $iOrigin, $iOrigin + $ixHourOffset, $iOrigin - $iyHourOffset, $hHourPen) _GDIPlus_GraphicsDrawLine($hClockGraphic, $iOrigin, $iOrigin, $iOrigin + $ixMinOffset, $iOrigin - $iyMinOffset, $hMinPen) _GDIPlus_GraphicsDrawLine($hClockGraphic, $iOrigin, $iOrigin, $iOrigin + $ixSecOffset, $iOrigin - $iySecOffset, $hSecPen) _GDIPlus_GraphicsFillEllipse($hClockGraphic, $iOrigin - 3, $iOrigin - 3, 6, 6, $hNoseBrush) _GDIPlus_GraphicsDrawImageRect($hGraphic, $hClockBitmap, 0, 0, $iCanvasSz, $iCanvasSz) EndIf Until GUIGetMsg() = $GUI_EVENT_CLOSE _GDIPlus_BrushDispose($hFrameBrush) _GDIPlus_BrushDispose($hNoseBrush) _GDIPlus_BrushDispose($hHighlightBrush) _GDIPlus_BrushDispose($hFaceBrush) _GDIPlus_PenDispose($hSecPen) _GDIPlus_PenDispose($hMinPen) _GDIPlus_PenDispose($hHourPen) _GDIPlus_PenDispose($hBlackPen) _GDIPlus_BitmapDispose($hClockBitmap) _GDIPlus_GraphicsDispose($hClockGraphic) _GDIPlus_GraphicsDispose($hGraphic) _GDIPlus_Shutdown() EndFunc ;==>Clock Func WM_NCMBUTTONDOWN($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg, $wParam, $lParam $iChSize = $iStartSz EndFunc ;==>WM_NCMBUTTONDOWN Func WM_MOUSEWHEEL($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg, $wParam, $lParam Local $iWheelDist, $iRate $iRate = 0.25 $iWheelDist = BitShift($wParam, 16) $iChSize -= Int($iRate * $iWheelDist) If $iChSize < 120 Then $iChSize = 120 If $iChSize > $iCanvasSz - (2 * $iMargin) Then $iChSize = $iCanvasSz - (2 * $iMargin) EndFunc ;==>WM_MOUSEWHEEL Func WM_NCHITTEST($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg, $wParam, $lParam Return $HTCAPTION EndFunc ;==>WM_NCHITTEST
    1 point
  8. File- and stdout/-err (console) output of messages, regular- and COM Object errors, exit method and -code, etc. Just call _AUERLO_Log() after to be logged functions (no parameters required if preceding function returns @error on failure). Or replace ConsoleWrite() (and SciTE trace lines) by _AUERLO_Log() for existing scripts. _AUERLO_FileRead() and _AUERLO_View() to display error log file contents (or import as CSV file to Microsoft Excel for example). Register custom functions to adjust date/time format and replace or add output functionality (no UDF source code modifications required). Output to: file console (stdout and stderr) non-blocking notification (Beep(), SoundPlay(), etc.) prompt (GUI dialog; script-halting notification) Microsoft Windows Event Log custom (register function) Download: AUERLO v2.0.0 Remarks: AutoIt v3.3.14.3+ required. @ScriptLineNumber = 0 if from callback (like $AUERLO_OPT_FUNCEXIT, except for $AUERLO_OPT_FUNCCOM = Default), -1 if @compiled. Generates Au3Stripper warnings (to be ignored without consequence; #AutoIt3Wrapper_Au3stripper_OnError=ForceUse -safe). agpl-3.0 auerlo.au3 : _AUERLO_Set() _AUERLO_Log() _AUERLO_LogAlt() _AUERLO_LogWinAPI() _AUERLO_LogEnv() _AUERLO_Assert() _AUERLO_FileClear() _AUERLO_FileRead() _AUERLO_View() auerloConstants.au3 : $AUERLO_LVL__ENUM - debug levels, $AUERLO_OPT__ENUM - _AUERLO_Set() options, $AUERLO_RET__ENUM - Return codes, $AUERLO_ERR__ENUM - @error codes, and $AUERLO_ATR__ENUM - error item attributes. Usage explanation: If @error signifies failure (implicit logging) : _ArrayDisplay($sNotAnArray); Returns @error = 1. _AUERLO_Log() ; Logs as $AUERLO_LVL_TRACE, $AUERLO_LVL_ERROR on @error, $AUERLO_LVL_DEBUG on @extended. If @error Then ... ; _AUERLO_Log() transparently passes @error and @extended from _ArrayDisplay(). If return value signifies failure (explicit logging) : If FileExists('invalid path') = 0 Then _AUERLO_Log('', $AUERLO_LVL_ERROR) Global $g_hFile = FileOpen('invalid path') If $g_hFile = -1 Then _AUERLO_Log('', $AUERLO_LVL_ERROR) If (return) value or expression result signifies failure (implicit logging): Global $g_hFile = FileOpen('invalid path') _AUERLO_Assert(Not ($g_hFile = -1)) ; $AUERLO_LVL_DEBUG if True (success), $AUERLO_LVL_WARNING if False. _AUERLO_Assert(FileWrite($g_hFile, 'data')); Successfull return value (1) evaluates to True; failure (0) to False. _AUERLO_Assert(IsArray($g_sNotAnArray)) Import error log file contents: Global $g_aArray2D = _AUERLO_FileRead(); Reads from current error log file. _AUERLO_View($g_aArray2D) Configuration ($AUERLO_OPT__ENUM in auerloConstants.au3 for description of all options) : _AUERLO_Set($AUERLO_OPT_LOGFILE, False) ; Disables output to error log file. _AUERLO_Set($AUERLO_OPT_LOGSTD, True) ; Enables output to stdout/stderr (console). _AUERLO_Set($AUERLO_OPT_FNCEXIT, Default) ; Registers default exit handler (no script exit logging without). _AUERLO_Set($AUERLO_OPT_FNCEXIT, Null) ; Deregisters default exit handler. _AUERLO_Set($AUERLO_OPT_FNCCOM, Default) ; Registers default COM Object error handler (no COM error logging without). _AUERLO_Set($AUERLO_OPT_FNCCOM, Null) ; Deregisters COM Object error handler. _AUERLO_Set($AUERLO_OPT_FNCCOM, YourFunc); Registers custom COM Object error handler YourFunc().
    1 point
  9. TheSaint

    Downloads Dropbox

    Updated to v1.9 (see first post for download). (v1.8) Added a conversion for GOG game thumb images to be saved full size, when URL pasted. (v1.9) Fixed an issue for Gutenberg downloads, where https (instead of http) refused to download. NOTE - This needs to be looked into further.
    1 point
  10. it's in the commandline property of the running process #include "_ProcessListProperties.au3" #include <Array.au3> ShellExecute('Notepad.exe') $avRET = _ProcessListProperties("notepad.exe") _ArrayDisplay($avRET) $cmdline = $avRet[1][9] MsgBox($MB_SYSTEMMODAL, 'Cmdline or where is my process called from? ', $cmdline) #include <Array.au3>; Only for _ArrayDisplay() ; Install a custom error handler Global $oMyError = ObjEvent("AutoIt.Error","MyErrFunc"), $f_COMError = False ; Globals Global $avRET, $iPID ; This is my custom error handler Func MyErrFunc() Local $HexNumber=hex($oMyError.number,8) Msgbox(0,"","intercepted a COM Error !" & @CRLF & _ "Number is: " & $HexNumber & @CRLF & _ "WinDescription is: " & $oMyError.windescription & @CRLF & _ "Source is: " & $oMyError.source & @CRLF & _ "ScriptLine is: " & $oMyError.scriptline) $f_COMError = True; something to check for when this function returns Endfunc ;=============================================================================== ; Function Name: _ProcessListProperties() ; Description: Get various properties of a process, or all processes ; Call With: _ProcessListProperties( [$Process [, $sComputer]] ) ; Parameter(s): (optional) $Process - PID or name of a process, default is "" (all) ; (optional) $sComputer - remote computer to get list from, default is local ; Requirement(s): AutoIt v3.2.4.9+ ; Return Value(s): On Success - Returns a 2D array of processes, as in ProcessList() ; with additional columns added: ; [0][0] - Number of processes listed (can be 0 if no matches found) ; [1][0] - 1st process name ; [1][1] - 1st process PID ; [1][2] - 1st process Parent PID ; [1][3] - 1st process owner ; [1][4] - 1st process priority (0 = low, 31 = high) ; [1][5] - 1st process executable path ; [1][6] - 1st process CPU usage ; [1][7] - 1st process memory usage ; [1][8] - 1st process creation date/time = "MM/DD/YYY hh:mm:ss" (hh = 00 to 23) ; [1][9] - 1st process command line string ; ... ; [n][0] thru [n][9] - last process properties ; On Failure: Returns array with [0][0] = 0 and sets @Error to non-zero (see code below) ; Author(s): PsaltyDS at http://www.autoitscript.com/forum ; Date/Version: 12/01/2009 -- v2.0.4 ; Notes: If an integer PID or string process name is provided and no match is found, ; then [0][0] = 0 and @error = 0 (not treated as an error, same as ProcessList) ; This function requires admin permissions to the target computer. ; All properties come from the Win32_Process class in WMI. ; To get time-base properties (CPU and Memory usage), a 100ms SWbemRefresher is used. ;=============================================================================== Func _ProcessListProperties($Process = "", $sComputer = ".") Local $sUserName, $sMsg, $sUserDomain, $avProcs, $dtmDate Local $avProcs[1][2] = [[0, ""]], $n = 1 ; Convert PID if passed as string If StringIsInt($Process) Then $Process = Int($Process) ; Connect to WMI and get process objects $oWMI = ObjGet("winmgmts:{impersonationLevel=impersonate,authenticationLevel=pktPrivacy, (Debug)}!\\" & $sComputer & "\root\cimv2") If IsObj($oWMI) Then ; Get collection processes from Win32_Process If $Process == "" Then ; Get all $colProcs = $oWMI.ExecQuery("select * from win32_process") ElseIf IsInt($Process) Then ; Get by PID $colProcs = $oWMI.ExecQuery("select * from win32_process where ProcessId = " & $Process) Else ; Get by Name $colProcs = $oWMI.ExecQuery("select * from win32_process where Name = '" & $Process & "'") EndIf If IsObj($colProcs) Then ; Return for no matches If $colProcs.count = 0 Then Return $avProcs ; Size the array ReDim $avProcs[$colProcs.count + 1][10] $avProcs[0][0] = UBound($avProcs) - 1 ; For each process... For $oProc In $colProcs ; [n][0] = Process name $avProcs[$n][0] = $oProc.name ; [n][1] = Process PID $avProcs[$n][1] = $oProc.ProcessId ; [n][2] = Parent PID $avProcs[$n][2] = $oProc.ParentProcessId ; [n][3] = Owner If $oProc.GetOwner($sUserName, $sUserDomain) = 0 Then $avProcs[$n][3] = $sUserDomain & "\" & $sUserName ; [n][4] = Priority $avProcs[$n][4] = $oProc.Priority ; [n][5] = Executable path $avProcs[$n][5] = $oProc.ExecutablePath ; [n][8] = Creation date/time $dtmDate = $oProc.CreationDate If $dtmDate <> "" Then ; Back referencing RegExp pattern from weaponx Local $sRegExpPatt = "\A(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})(?:.*)" $dtmDate = StringRegExpReplace($dtmDate, $sRegExpPatt, "$2/$3/$1 $4:$5:$6") EndIf $avProcs[$n][8] = $dtmDate ; [n][9] = Command line string $avProcs[$n][9] = $oProc.CommandLine ; increment index $n += 1 Next Else SetError(2); Error getting process collection from WMI EndIf ; release the collection object $colProcs = 0 ; Get collection of all processes from Win32_PerfFormattedData_PerfProc_Process ; Have to use an SWbemRefresher to pull the collection, or all Perf data will be zeros Local $oRefresher = ObjCreate("WbemScripting.SWbemRefresher") $colProcs = $oRefresher.AddEnum($oWMI, "Win32_PerfFormattedData_PerfProc_Process" ).objectSet $oRefresher.Refresh ; Time delay before calling refresher Local $iTime = TimerInit() Do Sleep(20) Until TimerDiff($iTime) >= 100 $oRefresher.Refresh ; Get PerfProc data For $oProc In $colProcs ; Find it in the array For $n = 1 To $avProcs[0][0] If $avProcs[$n][1] = $oProc.IDProcess Then ; [n][6] = CPU usage $avProcs[$n][6] = $oProc.PercentProcessorTime ; [n][7] = memory usage $avProcs[$n][7] = $oProc.WorkingSet ExitLoop EndIf Next Next Else SetError(1); Error connecting to WMI EndIf ; Return array Return $avProcs EndFunc ;==>_ProcessListProperties I got that processlist file from here it's in that array at row 1, column 9, the string shows where the file being executed is. that sample works with notepad, obviously you can look for any process by name, or leave that parameter blank to get all processes. So, I will need gluten Free donuts as payment thanks... kidding.
    1 point
  11. May I suggest to read this page of the help file to "associate a gui button with a key"
    1 point
×
×
  • Create New...