Jump to content

GuiFlatButton UDF : Change Colors of Regular Buttons


Recommended Posts

  • Replies 41
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Popular Posts

GuiFlatButton is a UDF to easily create regular buttons with different colors for background, foreground, border, hover, focus, etc.. This started as an effort to change the background color of a

@NMS, I'm not sure exactly what is causing this issue, but here are 2 workarounds. More investigation is required to create a proper fix... Option 1: create the GUI with the $WS_EX_COMPOSIT

@kurtykurtyboy I hope it's not too late to add to this thread, but I've encountered a problem using flat buttons that I just can't get a handle on. Under some circumstances, the flat buttons

Posted Images

Looks great! Should be part of the default button creation. :P

Spoiler

Renamer - Rename files and folders, remove portions of text from the filename etc.

GPO Tool - Export/Import Group policy settings.

MirrorDir - Synchronize/Backup/Mirror Folders

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

String Trigger - Triggers pasting text or applications or internet links on specific strings.

Inconspicuous - Hide files in plain sight, not fully encrypted.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

IUIAutomation - Topic with framework and examples

Au3Record.exe

Link to post
Share on other sites

Impressive!   Thanks for this.

The only "improvement" that comes to mind is to add a two-button example that makes clear (by direct comparison) the capabilities of GuiFlatButton_SetColorsEx ... and maybe include a couple of commented-out alternative lines that show some of the more effective uses you've tested.

 

Link to post
Share on other sites

In working with the UDF, I've settled on a default (my default) look for buttons that will work on many screens. As a test, I've edited the Button_Create function as follows:

;fill the array with the default values
    $aGuiFlatButton[$i][0] = $i
    $aGuiFlatButton[$i][4] = False
    $aGuiFlatButton[$i][5] = 13357056               ; bk color
    $aGuiFlatButton[$i][6] = 0x00000000             ; color of text
    $aGuiFlatButton[$i][17] = $sText
    For $j = 7 To 16
        $aGuiFlatButton[$i][$j] = -1
    Next

Should I be looking at a different method for this? Have you thought of adding some sort of SetTheme function that can predefine several of the settings prior to any Button_Create calls?

5c5bb8c5e31e1_DefaultButton.PNG.10d6eb4d7966c633e51c86473886a6ce.PNG

Edited by qwert
Link to post
Share on other sites
Quote

I hope you don't mind

Not at all.  Thanks for keeping at it.  This is going to be a very useful UDF!  Styles and such on websites have led users to expect this sort of thing ... which Autoit scripts are now going to be able to deliver.

Link to post
Share on other sites
Quote

I specifically want to commend you for placing the file date in the file name. Most files are posted without any indication. (Worse, of course, is posting a later version down in the thread!)

I've lost count of the number of times I'd had to figure out which version of a zip or au3 was the latest.

Thanks for your good work. These are nice features.

 

Link to post
Share on other sites
  • 6 months later...

Hello,

I have two questions, 

Is there anyway to set and manipulate the text on buttons? (Font, size and position)

When it comes to icons on buttons, can I use an ico file (and can the position be set)? Does it only support icons? 
If you can give some examples, I would be grateful,

Thank you again for this beautiful work.

 

Link to post
Share on other sites
On 4/15/2019 at 4:33 AM, kurtykurtyboy said:

First post updated.

Changes include:
Fixed bug, not showing pressed down state when clicking rapidly
Added Icon/Bitmap support!
Added function GuiFlatButton_SetPos to change the position and/or size of a button

Hello,

I have two questions, 

Is there anyway to set and manipulate the text on buttons? (Font, size and position)

When it comes to icons on buttons, can I use an ico file (and can the position be set)? Does it only support icons? 
If you can give some examples, I would be grateful,

Thank you again for this beautiful work.

Link to post
Share on other sites
  • 8 months later...

hi, i have a problem whit new button style after use GUIDelete() 

;-----------------------------------------------------
;#includes
#include-once
#include <MsgBoxConstants.au3>
#include <GuiFlatButton.au3>
;-----------------------------------------------------


_Main()


Func _Main()
    $GUI_Main = GUICreate("Main " & FileGetVersion(@ScriptFullPath), 200, 200, 10, 10, $WS_POPUPWINDOW)
    $BTN_Show_Page_2 = GuiFlatButton_Create("Show Page 2", 10, 10, 100, 38)
    Local $Param_1[12] = [0x0096a1, 0xFFFFFF, 0x0096a1, 0x0096a1, 0xFFFFFF, 0x0096a1, 0xE43D35, 0xFFFFFF, 0xE43D35, 0xFF3D35, 0xFFFFFF, 0xFF3D35]
    GuiFlatButton_SetColorsEx($BTN_Show_Page_2, $Param_1)
    GUISetState()
    While 1
        $iMsg_Main = GUIGetMsg()
        Select
            Case $iMsg_Main = $GUI_EVENT_CLOSE 
                Continueloop
            Case $iMsg_Main = $BTN_Show_Page_2
                GUIDelete()
                _Page_2()
                ExitLoop
        EndSelect
    WEnd
EndFunc


Func _Page_2()
    $GUI_HWNDPARENT2 = GUICreate("Page 2 " & FileGetVersion(@ScriptFullPath), 200, 200, 80, 80-1, $WS_POPUPWINDOW)
    $BTN_Exit = GuiFlatButton_Create("Exit", 10, 10, 100, 38)
    Local $Param_2[12] = [0x0096a1, 0xFFFFFF, 0x0096a1, 0x0096a1, 0xFFFFFF, 0x0096a1, 0xE43D35, 0xFFFFFF, 0xE43D35, 0xFF3D35, 0xFFFFFF, 0xFF3D35]
    GuiFlatButton_SetColorsEx($BTN_Exit, $Param_2)
    GUISetState()
    While 1
        $iMsg_Main = GUIGetMsg()
        Select
            Case $iMsg_Main = $GUI_EVENT_CLOSE 
                Continueloop
            Case $iMsg_Main = $BTN_Exit 
                Exit
        EndSelect
    WEnd
EndFunc

 

after show page 2 the new button style Loss of color !!!

i most use GUIDelete() and afterthat  open another form

what is the problem???

 

Link to post
Share on other sites
5 hours ago, r2du-soft said:

hi, i have a problem whit new button style after use GUIDelete() 

;-----------------------------------------------------
;#includes
#include-once
#include <MsgBoxConstants.au3>
#include <GuiFlatButton.au3>
;-----------------------------------------------------


_Main()


Func _Main()
    $GUI_Main = GUICreate("Main " & FileGetVersion(@ScriptFullPath), 200, 200, 10, 10, $WS_POPUPWINDOW)
    $BTN_Show_Page_2 = GuiFlatButton_Create("Show Page 2", 10, 10, 100, 38)
    Local $Param_1[12] = [0x0096a1, 0xFFFFFF, 0x0096a1, 0x0096a1, 0xFFFFFF, 0x0096a1, 0xE43D35, 0xFFFFFF, 0xE43D35, 0xFF3D35, 0xFFFFFF, 0xFF3D35]
    GuiFlatButton_SetColorsEx($BTN_Show_Page_2, $Param_1)
    GUISetState()
    While 1
        $iMsg_Main = GUIGetMsg()
        Select
            Case $iMsg_Main = $GUI_EVENT_CLOSE 
                Continueloop
            Case $iMsg_Main = $BTN_Show_Page_2
                GUIDelete()
                _Page_2()
                ExitLoop
        EndSelect
    WEnd
EndFunc


Func _Page_2()
    $GUI_HWNDPARENT2 = GUICreate("Page 2 " & FileGetVersion(@ScriptFullPath), 200, 200, 80, 80-1, $WS_POPUPWINDOW)
    $BTN_Exit = GuiFlatButton_Create("Exit", 10, 10, 100, 38)
    Local $Param_2[12] = [0x0096a1, 0xFFFFFF, 0x0096a1, 0x0096a1, 0xFFFFFF, 0x0096a1, 0xE43D35, 0xFFFFFF, 0xE43D35, 0xFF3D35, 0xFFFFFF, 0xFF3D35]
    GuiFlatButton_SetColorsEx($BTN_Exit, $Param_2)
    GUISetState()
    While 1
        $iMsg_Main = GUIGetMsg()
        Select
            Case $iMsg_Main = $GUI_EVENT_CLOSE 
                Continueloop
            Case $iMsg_Main = $BTN_Exit 
                Exit
        EndSelect
    WEnd
EndFunc

 

after show page 2 the new button style Loss of color !!!

i most use GUIDelete() and afterthat  open another form

what is the problem???

 

also i use from GuiFlatButton_SetDefaultColorsEx but i need chage a button style blue and blue light and another button gree and red but all buttons set a style color like:

;-----------------------------------------------------
;#includes
#include-once
#include <MsgBoxConstants.au3>
#include <GuiFlatButton.au3>
;-----------------------------------------------------


_Main()

Func _Main()
    ;------------
    $GUI_Main = GUICreate("Main " & FileGetVersion(@ScriptFullPath), 200, 200, 10, 10, $WS_POPUPWINDOW)
    ;------------
    ;Green | Red
    Local $aColorsEx = _
    [0x0096a1, 0xFFFFFF, 0x0096a1, _    ; normal    : Background, Text, Border
     0x0096a1, 0xFFFFFF, 0x0096a1, _    ; focus     : Background, Text, Border
     0xE43D35, 0xFFFFFF, 0xE43D35, _    ; hover     : Background, Text, Border
     0xFF3D35, 0xFFFFFF, 0xFF3D35]      ; selected  : Background, Text, Border
    GuiFlatButton_SetDefaultColorsEx($aColorsEx)
    ;---
    $BTN_Show_Page_2 = GuiFlatButton_Create("Show Page 2", 10, 10, 100, 38)
    ;------------
    GUISetState()
    While 1
        $iMsg_Main = GUIGetMsg()
        Select
            Case $iMsg_Main = $GUI_EVENT_CLOSE 
                Continueloop
            Case $iMsg_Main = $BTN_Show_Page_2
                GUIDelete()
                _Page_2()
                ExitLoop
        EndSelect
    WEnd
EndFunc

Func _Page_2()

    $GUI_HWNDPARENT2 = GUICreate("Page 2 " & FileGetVersion(@ScriptFullPath), 200, 200, 80, 80-1, $WS_POPUPWINDOW)
    ;------------
    ;Green | Red
    Local $aColorsEx = _
    [0x0096a1, 0xFFFFFF, 0x0096a1, _    ; normal    : Background, Text, Border
     0x0096a1, 0xFFFFFF, 0x0096a1, _    ; focus     : Background, Text, Border
     0xE43D35, 0xFFFFFF, 0xE43D35, _    ; hover     : Background, Text, Border
     0xFF3D35, 0xFFFFFF, 0xFF3D35]      ; selected  : Background, Text, Border
    GuiFlatButton_SetDefaultColorsEx($aColorsEx)
    ;---
    $BTN_Back = GuiFlatButton_Create("Back", 10, 10, 100, 38,1)
    ;------------
    ;Blue | BlueLight
    Local $aColorsEx = _
    [0x4aa5d2, 0xFFFFFF, 0x4aa5d2, _    ; normal    : Background, Text, Border
     0x4aa5d2, 0xFFFFFF, 0x4aa5d2, _    ; focus     : Background, Text, Border
     0x4aa5d2, 0xFFFFFF, 0x4aa5d2, _    ; hover     : Background, Text, Border
     0x54aedb, 0xFFFFFF, 0x54aedb]      ; selected  : Background, Text, Border
    GuiFlatButton_SetDefaultColorsEx($aColorsEx)
    ;---
    $BTN_Exit_2 = GuiFlatButton_Create("Exit 2", 20, 60, 100, 38,1)
    ;------------
    GUISetState()
    While 1
        $iMsg_Main = GUIGetMsg()
        Select
            Case $iMsg_Main = $GUI_EVENT_CLOSE 
                Continueloop
            Case $iMsg_Main = $BTN_Back
                GUIDelete()
                _Main()
                MsgBox(0, "", "END 1")
                ExitLoop
            Case $iMsg_Main = $BTN_Exit_2
                Exit
        EndSelect
    WEnd
EndFunc

 

how  can fix this?

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

@kurtykurtyboy

Greate UDF, thank you!

I have found some minor flaws:

"D:\_\AUTOIT\Include\kurtykurtyboy\GuiFlatButton_20210102\GuiFlatButton.au3" (152) : ==> Variable used without being declared.:
$buttonID = GUICtrlCreateButton("", 0, 0, $w, $h)
^ ERROR

"D:\_\AUTOIT\Include\kurtykurtyboy\GuiFlatButton_20210102\GuiFlatButton.au3" (157) : ==> Variable used without being declared.:
$idIndex = GuiFlatButton_FindControlId($buttonID)
^ ERROR

"D:\_\AUTOIT\Include\kurtykurtyboy\GuiFlatButton_20210102\GuiFlatButton.au3" (181) : ==> Variable used without being declared.:
$aColors = $aGuiFlatButton[0][3]
^ ERROR

... if using Opt("MustDeclareVars", 1) .

Would be great if you could fix it.

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

@kurtykurtyboy

I hope it's not too late to add to this thread, but I've encountered a problem using flat buttons that I just can't get a handle on.

Under some circumstances, the flat buttons disappear from the GUI I'm using them on. (Minimizing and restoring the GUI doesn't being them back.)

It's so rare that I haven't been able to isolate a cause. (I suspect it might be related to my use of SplashTextOn windows as overlays.) And the flat buttons work fine, up until they go away. Once they're gone, they're completely gone ... hovering ... tooltips ... everything.

MSDN has a detailed description of window type here ... but it's hard to follow how all the variations might interact.

So my questions are: 1) should my main GUI be created as a Layered window? and 2) are flat buttons considered Child windows?

Those answers will help me decipher what might be happening.

Thanks in advance for help.

Link to post
Share on other sites
On 4/22/2021 at 7:00 PM, qwert said:

@kurtykurtyboy

I hope it's not too late to add to this thread, but I've encountered a problem using flat buttons that I just can't get a handle on.

Under some circumstances, the flat buttons disappear from the GUI I'm using them on. (Minimizing and restoring the GUI doesn't being them back.)

It's so rare that I haven't been able to isolate a cause. (I suspect it might be related to my use of SplashTextOn windows as overlays.) And the flat buttons work fine, up until they go away. Once they're gone, they're completely gone ... hovering ... tooltips ... everything.

MSDN has a detailed description of window type here ... but it's hard to follow how all the variations might interact.

So my questions are: 1) should my main GUI be created as a Layered window? and 2) are flat buttons considered Child windows?

Those answers will help me decipher what might be happening.

Thanks in advance for help.

 

I have same problem With GuiFlatButton in MetroGUI or Layerd Windows 

Edited by Parsix
Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By t0nZ
      Always searching for the "final" solution to my zipping/unzipping needs, I started years ago using WinRar with AutoIT (don't ask me why...) and for the last 10 years I worked well with the _zip.UDF , a good solution using the embedded windows zipfldr.dll.
      But often I work with a lot of data (both multi gigabytes and/or 100K+ files) and I noticed the performance of the windows zip DLL are not so good, the problem is maybe worsened by the mono thread operation using AutoIT +  zipfldr.dll.
      SO my choice is 7zip (7ZA.exe)  also for licence (freeware also for business) reasons, and I wrote a small and simple UDF:
      ; #INDEX# ======================================================================================================================= ; Title .........: _7za ; AutoIt Version : 3.3.16.0 ; Language ......: English ; Description ...: Functions for using 7za.exe archive manipulation app ; Author(s) .....: NSC ; Version .......: 1.2 ; Date ..........: 2022/06/28 ; =============================================================================================================================== ; ------------------------------------------------------------------------------ ; This software is provided 'as-is', without any express or ; implied warranty. In no event will the authors be held liable for any ; damages arising from the use of this software. ; #INCLUDES# =================================================================================================================== ; #include-once #include <AutoItConstants.au3> ; =============================================================================================================================== ; #VARIABLES# =================================================================================================================== ; Global Global $7za_exe = @ScriptDir & "\" & "7za.exe" ; =============================================================================================================================== ; #CURRENT# ===================================================================================================================== ; _EXEC7za ;_UNcompress_7za ;_COMpress_7za_7z ;_COMpress_7za_zip ; =============================================================================================================================== ; #FUNCTION# ==================================================================================================================== ; Name ..........: _EXEC7za ; Description ...: launch 7Za.exe with params and returns exit codes ; Syntax ........: EXEC7za($7zCommands, $archive, $folder[, $show]) ; Parameters ....: $7zCommands - 7zip command line params ; $archive - complete path to the archive ; $folder - the source/destination folder ; $show - optional set the state of 7za console visibility, default @SW_HIDE, ; other values as ShellExecuteWait() ; Return values .: 1 - Success ; 0 - and set @error = 1 ; and ; @extended = 1 (Warning (Non fatal error(s)) ; @extended = 2 (Fatal error) ; @extended = 7 (Command line error) ; @extended = 8 (Not enough memory for operation) ; @extended = 255 (User stopped the process) ; @extended values set by 7za.exe exit codes ; Author ........: NSC ; Modified ......: 2022/05/13 ; Remarks .......: requires 7za.exe in @scriptdir, 7za.exe (7-Zip Extra: standalone console version) ; Thanks to 7-zip.org ; Related .......: ; Link ..........: ; Examples .......: compress a folder recursive with subfolders ; EXEC7za("u -mx4 -bt", c:\folder1\archive.7z", c:\folder1\folderTOcompress\ ) ; uncompress the same folder recursive ; EXEC7za("x -aoa -bt -r", "c:\folder1\archive.7z", "-oc:\folder2\") ; =============================================================================================================================== Func _EXEC_7za($7zCommands, $archive, $folder, $show = @SW_HIDE) Local $return7za = ShellExecuteWait($7za_exe, $7zCommands & ' "' & $archive & '" "' & $folder & '"', '', $SHEX_OPEN, $show) Select Case $return7za = 0 Return 1 Case Else Return SetError(1, $return7za, 0) EndSelect EndFunc ;==>_EXEC_7za ; #FUNCTION# ==================================================================================================================== ; Name ..........: _UNcompress_7za ; Description ...: launch 7Za.exe with preset params to uncompress an archive (.7z or .zip recursively) and returns exit codes ; Syntax ........: _UNcompress_7za($archive, $folder[, $show]) ; Parameters ....: $archive - complete path to the archive ; $folder - the source/destination folder ; $show - optional set the state of 7za console visibility, default @SW_HIDE, ; other values as ShellExecuteWait() ; Return values .: 1 - Success ; 0 - and set @error = 1 ; and ; @extended = 1 (Warning (Non fatal error(s)) ; @extended = 2 (Fatal error) ; @extended = 7 (Command line error) ; @extended = 8 (Not enough memory for operation) ; @extended = 255 (User stopped the process) ; @extended values set by 7za.exe exit codes ; Author ........: NSC ; Modified ......: 2022/05/19 ; Remarks .......: requires 7za.exe in @scriptdir, 7za.exe (7-Zip Extra: standalone console version) ; Thanks to 7-zip.org ; Related .......: ; Link ..........: ; =============================================================================================================================== Func _UNcompress_7za($archive, $folder, $show = @SW_HIDE) Local $return7za = ShellExecuteWait($7za_exe, "x -aoa -bt -r" & ' "' & $archive & '" -o"' & $folder & '"', '', $SHEX_OPEN, $show) Select Case $return7za = 0 Return 1 Case Else Return SetError(1, $return7za, 0) EndSelect EndFunc ;==>_UNcompress_Folder_7za ; #FUNCTION# ==================================================================================================================== ; Name ..........: _COMpress_7za_7z ; Description ...: launch 7Za.exe with precompiled params to compress in .7z format ;a single file, a filtered (*.pdf) bunch of files or a folder (recursively) and returns exit codes ; Syntax ........: _COMpress_7za_7z($archive, $folder[, $show [, $compLvl]] ) ; Parameters ....: $archive - complete path to the archive ; $folder - the source file(s) / folder ; $show - optional set the state of 7za console visibility, default @SW_HIDE, ; other values as ShellExecuteWait() ; $CompLvl - optional compression level (1-9) default 4 ; Return values .: 1 - Success ; 0 - and set @error = 1 ; and ; @extended = 1 (Warning (Non fatal error(s)) ; @extended = 2 (Fatal error) ; @extended = 7 (Command line error) ; @extended = 8 (Not enough memory for operation) ; @extended = 255 (User stopped the process) ; @extended values set by 7za.exe exit codes ; Author ........: NSC ; Modified ......: 2022/06/22 ; Remarks .......: requires 7za.exe in @scriptdir, 7za.exe (7-Zip Extra: standalone console version) ; avoids re-compress of popular archives. ; Thanks to 7-zip.org ; Related .......: ; Link ..........: ; =============================================================================================================================== Func _COMpress_7za_7z($archive, $folder, $show = @SW_HIDE, $CompLvl = 4) If StringRight($folder, 4) = ".zip" Or StringRight($folder, 3) = ".7z" Or StringRight($folder, 4) = ".rar" Or StringRight($folder, 4) = ".lha" Or StringRight($folder, 3) = ".gz" Or StringRight($folder, 7) = ".tar.gz" Or StringRight($folder, 4) = ".iso" Then $CompLvl = 0 EndIf Local $return7za = ShellExecuteWait($7za_exe, 'u -mx' & $CompLvl & ' -mmt -bt' & ' "' & $archive & '" "' & $folder & '"', '', $SHEX_OPEN, $show) Select Case $return7za = 0 Return 1 Case Else Return SetError(1, $return7za, 0) EndSelect EndFunc ;==>_COMpress_7za_7z ; #FUNCTION# ==================================================================================================================== ; Name ..........: _COMpress_7za_zip ; Description ...: launch 7Za.exe with precompiled params to compress in zip format ; a single file, a filtered (*.pdf) bunch of files or a folder (recursively) and returns exit codes ; Syntax ........: _COMpress_7za_zip($archive, $folder[, $show [, $compLvl]] ) ; Parameters ....: $archive - complete path to the archive ; $folder - the source file(s) / folder ; $show - optional set the state of 7za console visibility, default @SW_HIDE, ; other values as ShellExecuteWait() ; $CompLvl - optional compression level (1-9) default 4 ; Return values .: 1 - Success ; 0 - and set @error = 1 ; and ; @extended = 1 (Warning (Non fatal error(s)) ; @extended = 2 (Fatal error) ; @extended = 7 (Command line error) ; @extended = 8 (Not enough memory for operation) ; @extended = 255 (User stopped the process) ; @extended values set by 7za.exe exit codes ; Author ........: NSC ; Modified ......: 2022/06/22 ; Remarks .......: requires 7za.exe in @scriptdir, 7za.exe (7-Zip Extra: standalone console version), ; avoids re-compress of popular archives. ; Thanks to 7-zip.org ; Related .......: ; Link ..........: ; =============================================================================================================================== Func _COMpress_7za_zip($archive, $folder, $show = @SW_HIDE, $CompLvl = 9) If StringRight($folder, 4) = ".zip" Or StringRight($folder, 3) = ".7z" Or StringRight($folder, 4) = ".rar" Or StringRight($folder, 4) = ".lha" Or StringRight($folder, 3) = ".gz" Or StringRight($folder, 7) = ".tar.gz" Or StringRight($folder, 4) = ".iso" Then $CompLvl = 0 EndIf Local $return7za = ShellExecuteWait($7za_exe, 'u -tzip -mx' & $CompLvl & ' -mmt -bt' & ' "' & $archive & '" "' & $folder & '"', '', $SHEX_OPEN, $show) Select Case $return7za = 0 Return 1 Case Else Return SetError(1, $return7za, 0) EndSelect EndFunc ;==>_COMpress_7za_zip You have to provide 7za.exe, in scriptdir in some way, maybe with a fileinstall or embedding in some way. 
      Daily I use most of the time:
      _UNcompress_7za
      _COMpress_7za_7z
      so I'am almost done with these funcs....
      Also I made a quick and dirty benchmark on some real world data (for me at least) , comparing the windows DLL, the zip ULTRA by 7zip and the various 7zip levels.

      My choice is level 4 (time/size) but your mileage may vary...
      Also, extracting many thousands of little files from a 7z archive with 7zip is waaaay fast in respect to other solutions.
    • By Kanashius
      This UDF can be used to draw at the Desktop Wallpaper (Windows 8+) with GDI+ without using files.
      The example runs with 60-120fps at my machine, so the speed is acceptable.
      When the script exits, the original wallpaper is restored.
      Have fun :).
      PS: The UDF uses the window between the background and the icons, so it could be used to add an own child window at the desktop. Just look at the begin of __Wallpaper_Startup ($hWorkerW).
       
      Example:
       
      WallpaperUDF.au3 WallpaperUDF Example.au3
    • By sandgre
      Wondering if you can help a teacher out.  For the last few years of remote, hybrid, and in-person teaching I've been using an AutoHotKey script that creates an inking toolbar to be used during a PowerPoint presentation.  (https://www.autohotkey.com/boards/viewtopic.php?t=79163) The annotation tools available through Ppt are woefully inadequate, and, on my machine at least, jump around all over the place - sometimes on the bottom, sometimes on the left, sometimes on the right.  It's a scavenger hunt every single time.  The inking tool is always available, and recent updates allowed for the addition of lots more colors, which I used for modeling phenomena with students. One tragic day I arrived to school to find that my district IT dep't took away access to AutoHotKey.  No more tool bar. 
      I've been trying to resurrect some programming skills from a past life. I'm working through various tutorials and help files, with the goal of recreating the toolbar in AutoIt.  I'm really needing some help to move things along though.  I've been going through your PowerPoint UDF and all of your functions seem to just relate to editing the slides. Can you point me in the direction of how to create a toolbar that accesses the annotation tools that are available during the slideshow itself? 
       
    • By Hermes
      Hi, I am struggling in setting the value of a textarea based on the value of clipboard (that contains a long web page source codes). If I use _WD_SetElementValue, it freezes after some time, or appears to be pressing tab and goes out of focus. I can also use send keys but i need the script to run in the background.
      Here is the full script:
      #Include "Chrome.au3" #Include "wd_core.au3" #Include "wd_helper.au3" #Include "WinHttp.au3" #include <MsgBoxConstants.au3> #include <WinAPIFiles.au3> #include <Array.au3> #include <AutoItConstants.au3> #include <WinAPIFiles.au3> #include <GDIPlus.au3> #include <Excel.au3> Local $sDesiredCapabilities, $sSession SetupChrome() _WD_Startup() $sSession = _WD_CreateSession($sDesiredCapabilities) _WD_LoadWait($sSession) _WD_Navigate($sSession, "http://demo.borland.com/testsite/stadyn_largepagewithimages.html") _WD_LoadWait($sSession) Global $sSource = _WD_GetSource($sSession) Local $Paste = ClipPut($sSource) Local $sData = ClipGet() Local $aArray = 0, _ $iOffset = 1 While 1 $aArray = StringRegExp($sData, '(?s)<p>.*</p>', $STR_REGEXPARRAYMATCH, $iOffset) If @error Then ExitLoop $iOffset = @extended For $i = 0 To UBound($aArray) - 1 Local $Paste = ClipPut($aArray[$i]) Local $sRegExData = ClipGet() ;MsgBox(0, "", "$sRegExData = " & $sRegExData) Next WEnd _WD_Navigate($sSession, "https://www.w3schools.com/tags/tryit.asp?filename=tryhtml5_textarea_placeholder") _WD_WaitElement($sSession, $_WD_LOCATOR_ByCSSSelector, "iframe#iframeResult") Local $sElement1 = _WD_FindElement($sSession, $_WD_LOCATOR_ByCSSSelector, "iframe#iframeResult") _WD_FrameEnter($sSession, $sElement1) _WD_WaitElement($sSession, $_WD_LOCATOR_ByXPath, "//html/body/textarea") $textarea = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//html/body/textarea") _WD_ElementAction($sSession, $textarea, 'click') ;WD SetElementValue(SsSession, Stextarea, $sRegExData) <-- I can do this but the focus goes out, or the browser freezes _WD_FrameLeave($sSession) sleep(2000) Send("^v") _WD_LoadWait($sSession) _WD_Shutdown() Func SetupChrome() _WD_Option('Driver', 'chromedriver.exe') _WD_Option('Port', 9515) _WD_Option('DriverParams', '--log-path="' & @ScriptDir & '\chrome.log"') $sDesiredCapabilities = '{"capabilities": {"alwaysMatch": {"goog:chromeOptions": {"w3c": true, "args":["start-maximized","disable-infobars"]}}}}' EndFunc ;==>SetupChrome Can someone help me please, or re-direct me to the right path? TIA!
    • By Hermes
      Hi, I am trying to select elements in print page (dialog window) for a specific web page. But when trying to do so, it looks like it does not allow me to do it.
      So far, this is what I have:
      _WD_WaitElement($sSession, $_WD_LOCATOR_ByCSSSelector, "body") Local $mainpagebody = _WD_FindElement($sSession, $_WD_LOCATOR_ByCSSSelector, "body") _WD_HighlightElement($sSession, $mainpagebody, 2) _WD_WaitElement($sSession, $_WD_LOCATOR_ByCSSSelector, "img.print-button") Local $printbutton = _WD_FindElement($sSession, $_WD_LOCATOR_ByCSSSelector, "img.print-button") _WD_ElementAction($sSession, $printbutton, 'click') _WD_LoadWait($sSession) Sleep(3000) _WD_WaitElement($sSession, $_WD_LOCATOR_ByCSSSelector, "body") Local $printpagebody = _WD_FindElement($sSession, $_WD_LOCATOR_ByCSSSelector, "body") _WD_HighlightElement($sSession, $printpagebody, 2) The script above highlights the main web page "body" element, then clicks a tag to print a specific part of the page, then it will open a print page window where i am trying to highlight the body of that print page - but it looks like it is dropping from the session because it opens up another chrome page chrome://print.
       
      Below is the output log:
      __WD_Post: URL=HTTP://127.0.0.1:9515/session/cd08704233a965ccbaf9292e8692c3e4/element; $sData={"using":"css selector","value":"body"} __WD_Post: StatusCode=200; ResponseText={"value":{"element-6066-11e4-a52e-4f735466cecf":"91a394f0-004c-480d-aedf-52e2b30233c6"}}... _WD_FindElement: {"value":{"element-6066-11e4-a52e-4f735466cecf":"91a394f0-004c-480d-aedf-52e2b30233c6"}} _WD_WaitElement ==> Success __WD_Post: URL=HTTP://127.0.0.1:9515/session/cd08704233a965ccbaf9292e8692c3e4/element; $sData={"using":"css selector","value":"body"} __WD_Post: StatusCode=200; ResponseText={"value":{"element-6066-11e4-a52e-4f735466cecf":"91a394f0-004c-480d-aedf-52e2b30233c6"}}... _WD_FindElement: {"value":{"element-6066-11e4-a52e-4f735466cecf":"91a394f0-004c-480d-aedf-52e2b30233c6"}} __WD_Post: URL=HTTP://127.0.0.1:9515/session/cd08704233a965ccbaf9292e8692c3e4/execute/sync; $sData={"script":"arguments[0].style='background: #FFFF66; border-radius: 5px; padding-left: 3px;'; return true;", "args":[{"element-6066-11e4-a52e-4f735466cecf":"91a394f0-004c-480d-aedf-52e2b30233c6"}]} __WD_Post: StatusCode=200; ResponseText={"value":true}... _WD_ExecuteScript: {"value":true}... __WD_Post: URL=HTTP://127.0.0.1:9515/session/cd08704233a965ccbaf9292e8692c3e4/element; $sData={"using":"css selector","value":"img.print-link"} __WD_Post: StatusCode=200; ResponseText={"value":{"element-6066-11e4-a52e-4f735466cecf":"eb9e4673-4dec-4d4c-be6a-b7967743394b"}}... _WD_FindElement: {"value":{"element-6066-11e4-a52e-4f735466cecf":"eb9e4673-4dec-4d4c-be6a-b7967743394b"}} _WD_WaitElement ==> Success __WD_Post: URL=HTTP://127.0.0.1:9515/session/cd08704233a965ccbaf9292e8692c3e4/element; $sData={"using":"css selector","value":"img.print-link"} __WD_Post: StatusCode=200; ResponseText={"value":{"element-6066-11e4-a52e-4f735466cecf":"eb9e4673-4dec-4d4c-be6a-b7967743394b"}}... _WD_FindElement: {"value":{"element-6066-11e4-a52e-4f735466cecf":"eb9e4673-4dec-4d4c-be6a-b7967743394b"}} __WD_Post: URL=HTTP://127.0.0.1:9515/session/cd08704233a965ccbaf9292e8692c3e4/element/eb9e4673-4dec-4d4c-be6a-b7967743394b/click; $sData={"id":"eb9e4673-4dec-4d4c-be6a-b7967743394b"} __WD_Post: StatusCode=200; ResponseText={"value":null}... _WD_ElementAction: {"value":null}... __WD_Post: URL=HTTP://127.0.0.1:9515/session/cd08704233a965ccbaf9292e8692c3e4/execute/sync; $sData={"script":"arguments[0].style='background: #FFFF66; border-radius: 5px; padding-left: 3px;'; return true;", "args":[{"element-6066-11e4-a52e-4f735466cecf":"eb9e4673-4dec-4d4c-be6a-b7967743394b"}]} __WD_Post: StatusCode=200; ResponseText={"value":true}... _WD_ExecuteScript: {"value":true}... __WD_Post: URL=HTTP://127.0.0.1:9515/session/cd08704233a965ccbaf9292e8692c3e4/execute/sync; $sData={"script":"return document.readyState", "args":[]} __WD_Post: StatusCode=500; ResponseText={"value":{"error":"script timeout","message":"script timeout\n (Session info: chrome=92.0.4515.107)... __WD_Post ==> Webdriver Exception: {"value":{"error":"script timeout","message":"script timeout\n (Session info: chrome=92.0.4515.107)","stacktrace":"Backtrace:\n\tOrdinal0 [0x00C63733+2504499]\n\tOrdinal0 [0x00BFC401+2081793]\n\tOrdinal0 [0x00B024F0+1058032]\n\tOrdinal0 [0x00B55685+1398405]\n\tOrdinal0 [0x00B45E83+1334915]\n\tOrdinal0 [0x00B54CDB+1395931]\n\tOrdinal0 [0x00B45D4B+1334603]\n\tOrdinal0 [0x00B222B4+1188532]\n\tOrdinal0 [0x00B23149+1192265]\n\tGetHandleVerifier [0x00DDFB8C+1512252]\n\tGetHandleVerifier [0x00E8B0DF+2214031]\n\tGetHandleVerifier [0x00CE4BC3+484211]\n\tGetHandleVerifier [0x00CE3E69+480793]\n\tOrdinal0 [0x00C0218D+2105741]\n\tOrdinal0 [0x00C066E8+2123496]\n\tOrdinal0 [0x00C06827+2123815]\n\tOrdinal0 [0x00C0FB73+2161523]\n\tBaseThreadInitThunk [0x75EB62C4+36]\n\tRtlSubscribeWnfStateChangeNotification [0x77C11B69+1081]\n\tRtlSubscribeWnfStateChangeNotification [0x77C11B34+1028]\n"}} _WD_ExecuteScript: {"value":{"error":"script timeout","message":"script timeout\n (Session info: chrome=92.0.4515.107)... _WD_ExecuteScript ==> Webdriver Exception: HTTP status = 500 _WD_LoadWait ==> Webdriver Exception __WD_Post: URL=HTTP://127.0.0.1:9515/session/cd08704233a965ccbaf9292e8692c3e4/element; $sData={"using":"css selector","value":"body"} __WD_Post: StatusCode=200; ResponseText={"value":{"element-6066-11e4-a52e-4f735466cecf":"91a394f0-004c-480d-aedf-52e2b30233c6"}}... _WD_FindElement: {"value":{"element-6066-11e4-a52e-4f735466cecf":"91a394f0-004c-480d-aedf-52e2b30233c6"}} _WD_WaitElement ==> Success __WD_Post: URL=HTTP://127.0.0.1:9515/session/cd08704233a965ccbaf9292e8692c3e4/element; $sData={"using":"css selector","value":"body"} __WD_Post: StatusCode=200; ResponseText={"value":{"element-6066-11e4-a52e-4f735466cecf":"91a394f0-004c-480d-aedf-52e2b30233c6"}}... _WD_FindElement: {"value":{"element-6066-11e4-a52e-4f735466cecf":"91a394f0-004c-480d-aedf-52e2b30233c6"}} __WD_Post: URL=HTTP://127.0.0.1:9515/session/cd08704233a965ccbaf9292e8692c3e4/execute/sync; $sData={"script":"arguments[0].style='background: #FFFF66; border-radius: 5px; padding-left: 3px;'; return true;", "args":[{"element-6066-11e4-a52e-4f735466cecf":"91a394f0-004c-480d-aedf-52e2b30233c6"}]} __WD_Post: StatusCode=200; ResponseText={"value":true}... _WD_ExecuteScript: {"value":true}...  
      Is it even possible to select elements in print page?

×
×
  • Create New...