Jump to content
Sign in to follow this  
Emmhor1

Choose between Functions within GUI

Recommended Posts

Hi All,


MAIN QUESTION:
Is it possible to Call specific function within a GUI


So I have a script with multiple functions although I don't want to use every function every time.
My Idea is to create a simple GUI which allows me to select what functions I want to use then run the funtions by clicking a button.

I have already made a GUI which allows me to select specific .exe's I would like to run after selection it runs the .exe one by one.
This script is on my work laptops and cannot access it right now.

 

Who can help me with this?

GUIcreate

Func1 
Func2
Func3

Then have a boxes which allows me to select the specif Func.(I used GUIChecked and Unchecked in my other script)
Then a button which executes/calls the selected functions

Share this post


Link to post
Share on other sites

This is a quick modyfication for GUICreate() first Example from HelpFile :

#include <GUIConstantsEx.au3>
#include <MsgBoxConstants.au3>

Example()

Func Example()
    ; Create a GUI with various controls.
    Local $hGUI = GUICreate("Example")
    Local $idOK = GUICtrlCreateButton("OK", 310, 370, 85, 25)

    ; Display the GUI.
    GUISetState(@SW_SHOW, $hGUI)

    ; Loop until the user exits.
    While 1
        Switch GUIGetMsg()
            Case $GUI_EVENT_CLOSE
                ExitLoop
            Case $idOK
                _ButtonOK_Pressed()
        EndSwitch
    WEnd

    ; Delete the previous GUI and all controls.
    GUIDelete($hGUI)
EndFunc   ;==>Example

Func _ButtonOK_Pressed()
    MsgBox($MB_ICONINFORMATION, 'Info', 'Button OK Pressed')
EndFunc   ;==>_ButtonOK_Pressed

I this what you are looking for ?

Edited by mLipok

Signature beginning:   Wondering who uses AutoIT and what it can be used for ?
* GHAPI UDF - modest beginning - communication with GitHub REST API Forum Rules *
ADO.au3 UDF     POP3.au3 UDF     XML.au3 UDF    How to use IE.au3  UDF with  AutoIt v3.3.14.x  for other useful stuff click the following button

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST APIErrorLog.au3 UDF - A logging Library *

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskScheduler

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2019-10-01

Share this post


Link to post
Share on other sites
23 minutes ago, mLipok said:

 

Hi mLipok,

Thanks for you reply although I managed to find my script I mentioned above.

I modified it a bit:

This is my original script

#requireadmin
#include <GUIConstantsEx.au3>
#pragma compile(Icon, C:\Program Files (x86)\AutoIt3\Aut2Exe\Icons\AutoIt_Main_v10_48x48_256.ico)

$state = "UNCHECKED"
;CHECK BOXES
$gui=GUICreate("VidaXL App Installer", 500, 340)
;Standard Applications
$app1 = GUICtrlCreateCheckbox("7 Zip", 20, 30, 120, 20)
$app2 = GUICtrlCreateCheckbox("Google Chrome", 20, 50, 120, 20)



$standardSoftware = GUICtrlCreateLabel("Standard Software", 20, 10, 120, 20)
GUICtrlSetColor($StandardSoftware, 0x93117E)
GUICtrlSetFont($StandardSoftware,10,Default,Default,"Comic Sans MS")



$select=GUICtrlCreateButton("Select All", 20, 235, 100, 20)
$deselect=GUICtrlCreateButton("Deselect All", 20, 255, 100, 20)

$select2=GUICtrlCreateButton("Select All", 200, 235, 100, 20)
$deselect2=GUICtrlCreateButton("Deselect All", 200, 255, 100, 20)

$select3=GUICtrlCreateButton("Select All", 380, 235, 100, 20)
$deselect3=GUICtrlCreateButton("Deselect All", 380, 255, 100, 20)

$button=GUICtrlCreateButton("Start Installation", 150, 290, 200, 20)
$cancelbutton=GUICtrlCreateButton("Cancel", 150, 310, 200, 20)
$msg=GUISetState()

While 1

   Switch GUIGetMsg()
   Case $select
       GUICtrlSetState($app1, $GUI_CHECKED)
       GUICtrlSetState($app2, $GUI_CHECKED)
     
   Case $deselect
       GUICtrlSetState($app1, $GUI_UNCHECKED)
       GUICtrlSetState($app2, $GUI_UNCHECKED)


       Case $button
        If BitAnd(GUICtrlRead($app1),$GUI_CHECKED) = $GUI_CHECKED Then
           RunWait("\\sl051-file-01\IT Workstation\Software\Standard\7Zip.exe")
        EndIf
        If BitAnd(GUICtrlRead($app2),$GUI_CHECKED) = $GUI_CHECKED Then
           RunWait("\\sl051-file-01\IT Workstation\Software\Standard\Chrome.exe")
        EndIf
      


    Case $GUI_EVENT_CLOSE
       MsgBox(0, 'Thank you for using!', 'Made by Emmanuel Horvat')
        Exit
     Case $cancelbutton
        MsgBox(0, 'Thank you for using!', 'Made by Emmanuel Horvat')
        Exit
    EndSwitch
 WEnd

This works. As you see I get a GUI with 2 checkboxes. If I select app1 it only installs app1 if I select app1 and app2 it installs both and if I silect app2 it only installs app2

But like you see it uses runwait to run the EXE. In the new situation I have not created multiple exe's but more functions within the script

This is what I use now:

$app1 = GUICtrlCreateCheckbox("Char1", 20, 30, 120, 20)
$app2 = GUICtrlCreateCheckbox("Char2", 20, 50, 120, 20)
$select=GUICtrlCreateButton("Select All", 20, 235, 100, 20)
$deselect=GUICtrlCreateButton("Deselect All", 20, 255, 100, 20)

$button=GUICtrlCreateButton("Start Installation", 150, 290, 200, 20)
$cancelbutton=GUICtrlCreateButton("Cancel", 150, 310, 200, 20)
$msg=GUISetState()


While 1

   Switch GUIGetMsg()
   Case $select
       GUICtrlSetState($app1, $GUI_CHECKED)
       GUICtrlSetState($app2, $GUI_CHECKED)

   Case $deselect
       GUICtrlSetState($app1, $GUI_UNCHECKED)
       GUICtrlSetState($app2, $GUI_UNCHECKED)


   Case $button
        If BitAnd(GUICtrlRead($app1),$GUI_CHECKED) = $GUI_CHECKED Then
           Call("Char1")
        EndIf
        If BitAnd(GUICtrlRead($app2),$GUI_CHECKED) = $GUI_CHECKED Then
           Call("Char2")
        EndIf


    Case $GUI_EVENT_CLOSE
       MsgBox(0, 'Thank you for using!', 'Made by Emmanuel Horvat')
        Exit
     Case $cancelbutton
        MsgBox(0, 'Thank you for using!', 'Made by Emmanuel Horvat')
        Exit
    EndSwitch
 WEnd

Func Char1()
 WHAT THE FUNCTION DOESN BUT IT"S NOT IMPORTANT FOR NOW
EndFunc

Func Char2()

As you see it is the exact same but instead of runwait I use Call to select the function to run.

If I select Char1 it runs char1 function without issues

If I select char2 it runs char2 function without issues

If I select both it only runs char1

 

How do I make it to run the selected functions correctly.So if I select char1 and char2 that it runs both not only the first one.

Share this post


Link to post
Share on other sites

You do not need to use Call() just change this:
 

If BitAnd(GUICtrlRead($app1),$GUI_CHECKED) = $GUI_CHECKED Then
           Call("Char1")
        EndIf
        If BitAnd(GUICtrlRead($app2),$GUI_CHECKED) = $GUI_CHECKED Then
           Call("Char2")
        EndIf

to:

If BitAnd(GUICtrlRead($app1),$GUI_CHECKED) = $GUI_CHECKED Then
           Char1()
        EndIf
        If BitAnd(GUICtrlRead($app2),$GUI_CHECKED) = $GUI_CHECKED Then
           Char2()
        EndIf

 


Signature beginning:   Wondering who uses AutoIT and what it can be used for ?
* GHAPI UDF - modest beginning - communication with GitHub REST API Forum Rules *
ADO.au3 UDF     POP3.au3 UDF     XML.au3 UDF    How to use IE.au3  UDF with  AutoIt v3.3.14.x  for other useful stuff click the following button

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST APIErrorLog.au3 UDF - A logging Library *

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskScheduler

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2019-10-01

Share this post


Link to post
Share on other sites

Just using this simple example, both execute for me.

#include <GUIConstantsEx.au3>
#pragma compile(Icon, C:\Program Files (x86)\AutoIt3\Aut2Exe\Icons\AutoIt_Main_v10_48x48_256.ico)


;CHECK BOXES
$gui=GUICreate("VidaXL App Installer", 500, 340)
$app1 = GUICtrlCreateCheckbox("Char1", 20, 30, 120, 20)
$app2 = GUICtrlCreateCheckbox("Char2", 20, 50, 120, 20)
$select=GUICtrlCreateButton("Select All", 20, 235, 100, 20)
$deselect=GUICtrlCreateButton("Deselect All", 20, 255, 100, 20)

$button=GUICtrlCreateButton("Start Installation", 150, 290, 200, 20)
$cancelbutton=GUICtrlCreateButton("Cancel", 150, 310, 200, 20)
$msg=GUISetState()


While 1

   Switch GUIGetMsg()
   Case $select
       GUICtrlSetState($app1, $GUI_CHECKED)
       GUICtrlSetState($app2, $GUI_CHECKED)

   Case $deselect
       GUICtrlSetState($app1, $GUI_UNCHECKED)
       GUICtrlSetState($app2, $GUI_UNCHECKED)


   Case $button
        If BitAnd(GUICtrlRead($app1),$GUI_CHECKED) = $GUI_CHECKED Then
           Char1()
        EndIf
        If BitAnd(GUICtrlRead($app2),$GUI_CHECKED) = $GUI_CHECKED Then
           Char2()
        EndIf


    Case $GUI_EVENT_CLOSE
       MsgBox(0, 'Thank you for using!', 'Made by Emmanuel Horvat')
        Exit
     Case $cancelbutton
        MsgBox(0, 'Thank you for using!', 'Made by Emmanuel Horvat')
        Exit
    EndSwitch
 WEnd

Func Char1()
    msgbox(0,"","char1")
EndFunc

Func Char2()
    msgbox(0,"","char2")
EndFunc

Perhaps there is something else in your full script causing issue?


Share this post


Link to post
Share on other sites

I found out yesterday I had no Case $button

I added it and now it seems to work but only for 1/2 functions again they don't run together

Share this post


Link to post
Share on other sites

If you want to scale:

;#RequireAdmin
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Res_Icon_Add=Resources\AddRemApp.ico
#AutoIt3Wrapper_Icon=Resources\AddRemApp.ico
#AutoIt3Wrapper_Run_Tidy=n
#AutoIt3Wrapper_UseX64=n
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include <WinAPI.au3>
#include <GuiEdit.au3>
#include <GuiButton.au3>
#include <Constants.au3>
#include <GuiStatusBar.au3>
#include <GUIConstants.au3>
#include <GuiImageList.au3>
#include <GuiComboBoxEx.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

Opt("TrayMenuMode", 1)
Opt("TrayIconHide", 1)
Opt("GUIResizeMode", 1)
Opt("TrayIconDebug", 1)
Opt("TrayAutoPause", 0)
Opt("MouseCoordMode", 2)
Opt("GUIOnEventMode", 0)
Opt("MustDeclareVars", 0)
Opt("GUIEventOptions", 1)
Opt("TrayOnEventMode", 1)
Opt("ExpandEnvStrings", 1)
Opt("WinDetectHiddenText", 1)

FileInstall("AutoIt Checkboxes Installation.au3", @ScriptDir & '\AutoIt Checkboxes Installation.au3', 1)

TraySetIcon("IMG\install2.ico")

Local $STR1 = StringInStr(@ScriptDir, '\', 2, 2)
Local $STR2 = StringLeft(@ScriptDir, $STR1)

$hGUI = GUICreate("AutoIt Install Menu", 740, 250, 200, 200)
GUISetOnEvent($GUI_EVENT_CLOSE, "Quit")
$hlabel = GUICtrlCreateLabel("Select a Program to install", 30, 10, 126, 17)
$hButton1 = GUICtrlCreateButton("Start", 30, 200, 50)
$hButton2 = GUICtrlCreateButton("Select All", 80, 200, 80)
$hButton3 = GUICtrlCreateButton("UnSelect All", 160, 200, 80)

$totray = TrayCreateItem("Tray")
TrayItemSetOnEvent($totray, "ToTray")

$restore = TrayCreateItem("Restore")
TrayItemSetOnEvent($restore, "Restore")

$exititem = TrayCreateItem("Close")
TrayItemSetOnEvent($exititem, "Quit")

GUISetState()

Global $aRadio[32]
Global $aApps[32][3]
$aApps[0][0] = "W10Tools"
$aApps[0][1] = "W10Tools.exe"
$aApps[0][2] = "IMG\Pc.ico"
$aApps[1][0] = "SMP"
$aApps[1][1] = "AutoIt SMP.exe"
$aApps[1][2] = "IMG\SMP.ico"
$aApps[2][0] = "LAN"
$aApps[2][1] = "AutoIt LAN.exe"
$aApps[2][2] = "IMG\realtek.ico"
$aApps[3][0] = "Obsidian"
$aApps[3][1] = 'Obsidian\Obsidian.bat'
$aApps[3][2] = "Obsidian\normal.ico"
$aApps[4][0] = "Java"
$aApps[4][1] = "AutoIt Java.exe"
$aApps[4][2] = "IMG\java.ico"
$aApps[5][0] = "DX9c"
$aApps[5][1] = "AutoIt DX9c.exe"
$aApps[5][2] = "IMG\dx9c.ico"
$aApps[6][0] = "Create Synchronicity 6.0"
$aApps[6][1] = "Create Synchronicity 6.0.exe"
$aApps[6][2] = "IMG\sync.ico"
$aApps[7][0] = "Firefox"
$aApps[7][1] = "AutoIt FFox.exe"
$aApps[7][2] = "IMG\fox.ico"
$aApps[8][0] = "Group Policy Tool"
$aApps[8][1] = "GroupPolicy W10 X64\GPO Tool.exe"
$aApps[8][2] = "IMG\gpls.ico"
$aApps[9][0] = "Notepad ++"
$aApps[9][1] = "Notepad ++ 7.5.2 SFX.exe"
$aApps[9][2] = "IMG\notepad.ico"
$aApps[10][0] = "PowerCfgW10"
$aApps[10][1] = "PowerCfgW10.exe"
$aApps[10][2] = "IMG\power.ico"
$aApps[11][0] = "FlashPlayer"
$aApps[11][1] = "AutoIt FlashPlayer.exe"
$aApps[11][2] = "IMG\flashplayer.ico"
$aApps[12][0] = "WinRar"
$aApps[12][1] = "AutoIt WinRar.exe"
$aApps[12][2] = "IMG\winrar.ico"
$aApps[13][0] = "Foxit Reader"
$aApps[13][1] = "FoxitReaderPortable.exe"
$aApps[13][2] = "IMG\foxit.ico"
$aApps[14][0] = "Realtek R*"
$aApps[14][1] = "AutoIt RLTK x64.exe"
$aApps[14][2] = "IMG\realtek.ico"
$aApps[15][0] = "AutoIt + SciTE"
$aApps[15][1] = "AutoIt AutoIt + SciTe Silent.exe"
$aApps[15][2] = "IMG\autoit.ico"
$aApps[16][0] = "PhysX"
$aApps[16][1] = "AutoIt PhysX.exe"
$aApps[16][2] = "IMG\physx.ico"
$aApps[17][0] = "FM2 Chipset"
$aApps[17][1] = "F2A85M-LE\FM2_Chipset\Setup.exe"
$aApps[17][2] = "IMG\amd.ico"
$aApps[18][0] = "Logitech SetPoint"
$aApps[18][1] = "AutoIt Logitech SetPoint.exe"
$aApps[18][2] = "IMG\logitech.ico"
$aApps[19][0] = "Logitech GS"
$aApps[19][1] = "AutoIt LGS.exe"
$aApps[19][2] = "IMG\lgs.ico"
$aApps[20][0] = "Synaptics 17.0.19C"
$aApps[20][1] = "AutoIt Synaptics 17.0.19C.exe"
$aApps[20][2] = "IMG\synaptics.ico"
$aApps[21][0] = "Fraps"
$aApps[21][1] = "AutoIt Fraps.exe"
$aApps[21][2] = "IMG\fraps.ico"
$aApps[22][0] = "Reserved"
$aApps[22][1] = ""
$aApps[22][2] = "IMG\Blank.ico"
$aApps[23][0] = "Reserved"
$aApps[23][1] = ""
$aApps[23][2] = "IMG\Blank.ico"
$aApps[24][0] = "Reserved"
$aApps[24][1] = ""
$aApps[24][2] = "IMG\Blank.ico"
$aApps[25][0] = "Reserved"
$aApps[25][1] = ""
$aApps[25][2] = "IMG\Blank.ico"
$aApps[26][0] = "Reserved"
$aApps[26][1] = ""
$aApps[26][2] = "IMG\Blank.ico"
$aApps[27][0] = "Reserved"
$aApps[27][1] = ""
$aApps[27][2] = "IMG\Blank.ico"
$aApps[28][0] = "Reserved"
$aApps[28][1] = ""
$aApps[28][2] = "IMG\Blank.ico"
$aApps[29][0] = "Reserved"
$aApps[29][1] = ""
$aApps[29][2] = "IMG\Blank.ico"
$aApps[30][0] = "Reserved"
$aApps[30][1] = ""
$aApps[30][2] = "IMG\Blank.ico"
$aApps[31][0] = "Reserved"
$aApps[31][1] = ""
$aApps[31][2] = "IMG\Blank.ico"

For $i = 0 To 3
    For $j = 0 To 7
        $sName = ($aApps[($i * 8) + $j][0])
        GUICtrlCreateIcon($aApps[($i * 8) + $j][2], -2, 30 + ($i * 160), 30 + ($j * 20), 17, 17)
        $aRadio[($i * 8) + $j] = GUICtrlCreateCheckbox($sName, 50 + ($i * 160), 30 + ($j * 20), 138, 20)
    Next
Next

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
        Case $hButton1
            For $i = 0 To 29
                If BitAND(GUICtrlRead($aRadio[$i]), $GUI_CHECKED) = $GUI_CHECKED Then
                    If Not FileExists($aApps[$i][1]) Then
                        MsgBox(262160, "File not found!", $aApps[$i][1], 0)
                    Else
                        ConsoleWrite("Running: " & $aApps[$i][0] & @CRLF)
                        ShellExecuteWait($aApps[$i][1])
                        TrayTip('Installer', "Running: " & $aApps[$i][0], 3)
                    EndIf
                EndIf
            Next
            ;================================================
        Case $hButton2 ;All
            For $i = 0 To 21
                GUICtrlSetState($aRadio[$i], $GUI_CHECKED)
            Next
            ;================================================
        Case $hButton3 ;None
            For $i = 0 To 31
                GUICtrlSetState($aRadio[$i], $GUI_UNCHECKED)
            Next
    EndSwitch
WEnd

Func ToTray()
    TrayItemSetState($totray, $TRAY_UNCHECKED)
    GUISetState(@SW_HIDE)
EndFunc   ;==>ToTray

Func Restore()
    TrayItemSetState($restore, $TRAY_UNCHECKED)
    GUISetState(@SW_SHOW)
EndFunc   ;==>Restore

Func Quit()
    Exit
EndFunc   ;==>Quit

 


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

Share this post


Link to post
Share on other sites

I managed to get it to work these are the changes

 

First

Func Char1()
 While 1
      Local $hWnd = WinWait($Class, "", 10)
      Local $iState = WinGetState($hWnd)

   If BitAND($Title, $WIN_STATE_EXISTS) Then
        WinActivate($Title)
    Else
        Exit
    EndIf

    Sleep(2000)

      Send("{q down}")
      Send("{q up}")

    Sleep(2000)
 WEnd
EndFunc

If I use this setup in both Functions only 1 is being executed

But if I change it to this it works:
 

Func Char1()
   WinActivate($Title)

    Sleep(5000)
    Send("{q down}")
      Send("{q up}")
EndFunc

 

The next problem is the functions itself. The functions contain a While this means it won't execute the second function because the first function is still in it's loop

 

Func Char1()

   While 1
      WinActivate($Title)
      Sleep(5000)
      Send("{q down}")
      Send("{q up}")
   WEnd 
EndFunc

Func Char2()
   While 1
      WinActivate($Title)
      Sleep(5000)
      Send("{a down}")
      Send("{a up}")
   WEnd
EndFunc

Is it possible to run the 2 functions at the same time?

 

EDIT: Managed to get it to work by not calling the function but by running a external script
The thing with this is I will have to create a lot of scripts imagine having 20 charactet this means 20 scripts atleast

If BitAnd(GUICtrlRead($Character1),$GUI_CHECKED) = $GUI_CHECKED Then
         $PID = Run(@AutoItExe & ' /AutoIt3ExecuteScript "' & @ScriptDir & '\test.au3' & '"')

      EndIf
      If BitAnd(GUICtrlRead($Character2),$GUI_CHECKED) = $GUI_CHECKED Then
         $PID = Run(@AutoItExe & ' /AutoIt3ExecuteScript "' & @ScriptDir & '\test1.au3' & '"')

 

Edited by Emmhor1

Share this post


Link to post
Share on other sites

Run 2 functions at the same time would be multithreading so no.

But you could have it all in the main loop, set the conditions and it would run sequentially. And there's adlib.


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

Share this post


Link to post
Share on other sites
2 hours ago, careca said:

Run 2 functions at the same time would be multithreading so no.

But you could have it all in the main loop, set the conditions and it would run sequentially. And there's adlib.

Could you set this up for me and then i Will expanderen it with my needs

Share this post


Link to post
Share on other sites

I'll help you, and that's <> than doing it FOR you, besides it's easy enough so you can at least try.

A condition is for example:

If $varX = 1 Then

So if you put conditions, inside the main loop, and under these conditions, code to execute, this means you select what you want to get executed, just need to change the variables value. You can have for example checkboxes corresponding to what sections you want executed, the checkbox can be read, also in the main loop, and depending on checked or not, set the variable to 1 or 0. That simple.


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

Share this post


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
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By thedemons
      Introduction
      ImGui is a popular library written by ocornut, it can make awesome user interface based on directx. It is being used by many big apps/games.  The UI is nice and flexible, easy to use because of frame-by-frame drawing. So I decided to convert the entire ImGui library to AutoIt
      At first it's just an experiment, i converted some basic draw functions of imgui, compile to a dll, then using DllCall in autoit to call the functions. I was testing to see how much FPS i can get in autoit, and i was expected a low FPS, since autoit is slow. Suprisingly, the FPS turned out to be so high, it works really fast, even when drawing 1000 buttons at the same time. Features
      More than +270 functions converted from ImGui (compiled dll). Has 90% of the capability of what you can do in C++; Usable ImGuiIO and ImGuiStyle, so you can set whatever configurations you like. Preview
          
      Usage
      #include <WinAPI.au3> #include "ImGui.au3" ; Create a window Local $hwnd = _ImGui_GUICreate("AutoIt ImGui", 1024, 768) _WinAPI_ShowWindow($hwnd) ; Set style color _ImGui_StyleColorsLight() ;~ _ImGui_StyleColorsDark() Local $f_value = 5 While 1 ; when the user click close button on the window, this will return false if Not _ImGui_PeekMsg() Then Exit ; must call _ImGui_BeginFrame() _ImGui_Begin("Another window") _ImGui_Text("Hello there..") If _ImGui_Button("click me") Then $f_value = 5 _ImGui_SliderFloat("slider", $f_value, 2, 20) If _ImGui_IsItemHovered() Then _ImGui_ToolTip("what r u doing?") _ImGui_End() ; must call _ImGui_EndFrame() Wend  
      Remark
      Most of the functions were converted automatically. I haven't tested all of them yet, if some function doesn't work for you, please tell me. Still missing some features of ImGui, please tell me if you needed any. Run \tools\imgui-au3-setup.au3 to add _ImGui functions to SciTE auto-complete. Source Code
      Require: DirectX GitHub: imgui-autoit
    • By MesterPerfect
      good morning
      this is the first post here in the autoit forums
      i hope that you can help me in my problem
      i have a JSON encoded
      it a map of my forums
      where i want to make a treeview that have the same type of map
      e.g
      a system (as category)
      windows (as sub category)
      software (as an child item in the windows category)
      .....
      i don't know how to do that
      so, i know that i can do that using the json functions
      but i need your help about how we can do it as the type that i told you
      by the way i need to put the sub info for each item in an array that give me the ability to manage my items
      e.g
      can post thread
      can reply
      message cound ...
      you just give me a small example and i can continue.
      am sorry if this against the rules of the forum.
      but i realy searched a lot but i couldn't
      i hope some one give me the way.
      thank you very much in advance
       
      here is the link of json forum
      https://www.autoitscript.com/forum/topic/148114-a-non-strict-json-udf-jsmn/
      and here is my encoded json file
       
      { "tree_map": { "0": [ 1, 5, 6, 7 ], "1": [ 2 ], "2": [ 4 ], "5": [ 3 ], "6": [ 8 ], "8": [ 9, 10 ] }, "nodes": [ { "breadcrumbs": [], "description": "", "display_in_list": true, "display_order": 1, "node_id": 1, "node_name": null, "node_type_id": "Category", "parent_node_id": 0, "title": "Main category", "type_data": {} }, { "breadcrumbs": [ { "node_id": 1, "title": "Main category", "node_type_id": "Category" } ], "description": "", "display_in_list": true, "display_order": 1, "node_id": 2, "node_name": null, "node_type_id": "Forum", "parent_node_id": 1, "title": "Main forum", "type_data": { "allow_poll": true, "allow_posting": true, "can_create_thread": true, "can_upload_attachment": true, "discussion_count": 0, "last_post_date": 0, "last_post_id": 0, "last_post_username": "", "last_thread_id": 0, "last_thread_prefix_id": 0, "last_thread_title": "", "message_count": 0, "min_tags": 0, "require_prefix": false } }, { "breadcrumbs": [ { "node_id": 1, "title": "Main category", "node_type_id": "Category" }, { "node_id": 2, "title": "Main forum", "node_type_id": "Forum" } ], "description": "", "display_in_list": true, "display_order": 1, "node_id": 4, "node_name": null, "node_type_id": "Forum", "parent_node_id": 2, "title": "my forums1", "type_data": { "allow_poll": true, "allow_posting": true, "can_create_thread": true, "can_upload_attachment": true, "discussion_count": 0, "last_post_date": 0, "last_post_id": 0, "last_post_username": "", "last_thread_id": 0, "last_thread_prefix_id": 0, "last_thread_title": "", "message_count": 0, "min_tags": 0, "require_prefix": false } }, { "breadcrumbs": [], "description": "", "display_in_list": true, "display_order": 2, "node_id": 5, "node_name": null, "node_type_id": "Category", "parent_node_id": 0, "title": "Perfect", "type_data": {} }, { "breadcrumbs": [ { "node_id": 5, "title": "Perfect", "node_type_id": "Category" } ], "description": "", "display_in_list": true, "display_order": 2, "node_id": 3, "node_name": null, "node_type_id": "Forum", "parent_node_id": 5, "title": "ahmed", "type_data": { "allow_poll": true, "allow_posting": true, "can_create_thread": true, "can_upload_attachment": true, "discussion_count": 0, "last_post_date": 0, "last_post_id": 0, "last_post_username": "", "last_thread_id": 0, "last_thread_prefix_id": 0, "last_thread_title": "", "message_count": 0, "min_tags": 0, "require_prefix": false } }, { "breadcrumbs": [], "description": "", "display_in_list": true, "display_order": 3, "node_id": 6, "node_name": null, "node_type_id": "Forum", "parent_node_id": 0, "title": "autoit", "type_data": { "allow_poll": true, "allow_posting": true, "can_create_thread": true, "can_upload_attachment": true, "discussion_count": 0, "last_post_date": 0, "last_post_id": 0, "last_post_username": "", "last_thread_id": 0, "last_thread_prefix_id": 0, "last_thread_title": "", "message_count": 0, "min_tags": 0, "require_prefix": false } }, { "breadcrumbs": [ { "node_id": 6, "title": "autoit", "node_type_id": "Forum" } ], "description": "", "display_in_list": true, "display_order": 3, "node_id": 8, "node_name": null, "node_type_id": "Forum", "parent_node_id": 6, "title": "examples", "type_data": { "allow_poll": true, "allow_posting": true, "can_create_thread": true, "can_upload_attachment": true, "discussion_count": 0, "last_post_date": 0, "last_post_id": 0, "last_post_username": "", "last_thread_id": 0, "last_thread_prefix_id": 0, "last_thread_title": "", "message_count": 0, "min_tags": 0, "require_prefix": false } }, { "breadcrumbs": [ { "node_id": 6, "title": "autoit", "node_type_id": "Forum" }, { "node_id": 8, "title": "examples", "node_type_id": "Forum" } ], "description": "", "display_in_list": true, "display_order": 3, "node_id": 9, "node_name": null, "node_type_id": "Forum", "parent_node_id": 8, "title": "GUI", "type_data": { "allow_poll": true, "allow_posting": true, "can_create_thread": true, "can_upload_attachment": true, "discussion_count": 0, "last_post_date": 0, "last_post_id": 0, "last_post_username": "", "last_thread_id": 0, "last_thread_prefix_id": 0, "last_thread_title": "", "message_count": 0, "min_tags": 0, "require_prefix": false } }, { "breadcrumbs": [ { "node_id": 6, "title": "autoit", "node_type_id": "Forum" }, { "node_id": 8, "title": "examples", "node_type_id": "Forum" } ], "description": "", "display_in_list": true, "display_order": 31, "node_id": 10, "node_name": null, "node_type_id": "Forum", "parent_node_id": 8, "title": "windowEX", "type_data": { "allow_poll": true, "allow_posting": true, "can_create_thread": true, "can_upload_attachment": true, "discussion_count": 0, "last_post_date": 0, "last_post_id": 0, "last_post_username": "", "last_thread_id": 0, "last_thread_prefix_id": 0, "last_thread_title": "", "message_count": 0, "min_tags": 0, "require_prefix": false } }, { "breadcrumbs": [], "description": "", "display_in_list": true, "display_order": 4, "node_id": 7, "node_name": null, "node_type_id": "Category", "parent_node_id": 0, "title": "vbs", "type_data": {} } ] }  
    • By Tosyk
      Hi,
      Please help me to beat the flashing of input field:
      #include <File.au3> #Include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <ColorConstants.au3> AutoItSetOption("MustDeclareVars", 1) HotKeySet("{ESC}", "Terminate") Local $i Local $sSourceFile, $sDestFileA, $sDestFile3, $sRunWaitA, $sParamsA, $sNewFileNameA, $sFileLogPath, $iFileSize, $ScriptNameWoExt Local $hGUI, $ProgressBar1, $Label, $Progress, $Progress1, $inpVal, $CheckKeepAlpha, $v1, $sNewFileName, $sDestFile, $sParams, $sRunWait, $LabelStatus, $bMover, $cMover, $qMover, $ExtractAlpha, $FlipY, $ExtractBlue Local $sDrive, $sFolder, $sFileName, $sExt ;path to image magick tools Local $sIMConv = 'magick.exe', $sIMPathFull = 'C:\Program Files\ImageMagick\', $sIMPath = FileGetShortName($sIMPathFull & $sIMConv) ;supported input file extensions Local $Exts = "tga|jpg|bmp|dds|png|tif|jpeg", $sPattern = "\.(?i:" & $Exts & ")", $ExtsPreview = " tga | jpg | bmp | dds | png | tif | jpeg " Local $ExtOutput = "jpg", $ExtOutput2 = "png" Local $LogDefaultSize = '70' If Not $CmdLine[0] Then MsgBox($MB_SYSTEMMODAL, "Usage", "Drop " & $ExtsPreview & " file(s)" & @LF & "on " & @ScriptName) ConsoleWrite("Usage: " & @ScriptName & " <file>" & @CRLF) Exit EndIf If $CmdLine[0] <> 0 Then If FileExists($sIMPath) Then ProcessFiles() Else MsgBox(0, $sIMConv & " not found", "File [" & $sIMPathFull & $sIMConv & "] not found" & @CRLF) ConsoleWrite("Download Image Magick: " & $sIMConv & " to use this tool." & @CRLF) EndIf Else MsgBox(0, "Usage", "Drop file(s) on " & @ScriptName) ConsoleWrite("Usage: " & @ScriptName & " <file>" & @CRLF) EndIf Func ProcessFiles() #Region ### START Koda GUI section ### Form= $hGUI = GUICreate("Converting to PNG", 300, 285, -1, -1, BitXOR($GUI_SS_DEFAULT_GUI, $WS_MINIMIZEBOX)) GUISetOnEvent($GUI_EVENT_CLOSE, "Terminate") ;PNG Option group $cMover = 0 Local $Group2 = GUICtrlCreateGroup("Options (PNG):", 8, 5+$cMover, 284, 56) $CheckKeepAlpha = GUICtrlCreateCheckbox("Keep alpha channel", 24, 30+$cMover, 130, 17) $FlipY = GUICtrlCreateCheckbox("Flip Vertical", 160, 30+$cMover, 130, 17) GUICtrlSetState($CheckKeepAlpha, $GUI_CHECKED) ;JPG Quality Input $qMover = 68 Local $Group1 = GUICtrlCreateGroup("Extraction options (JPG):", 8, 5+$qMover, 284, 86) $ExtractAlpha = GUICtrlCreateCheckbox("Extract alpha channel", 24, 28+$qMover, 130, 17) $ExtractBlue = GUICtrlCreateCheckbox("Extract blue channel", 160, 28+$qMover, 130, 17) $inpVal = GUICtrlCreateInput("90", 20, 56+$qMover, 260, 22) GUICtrlSetState($inpVal, $GUI_DISABLE) ;Buttons and bar $bMover = 92 $Label = GUICtrlCreateLabel("Press Convert to proceed", 20, 94+$bMover, 220, 20, $SS_LEFT) $LabelStatus = GUICtrlCreateLabel("Ready", 20, 153+$bMover, 220, 20, $SS_LEFT) $Progress1 = CreateProgress(20, 115+$bMover, 260, 20) Local $Button1 = GUICtrlCreateButton("Convert", 206, 150+$bMover, 75, 25) GUICtrlSetState ($Button1, $GUI_DEFBUTTON) ;Initializer GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Exit Case $ExtractAlpha or $ExtractBlue If _IsChecked($ExtractAlpha) or _IsChecked($ExtractBlue) Then GUICtrlSetState($inpVal, $GUI_ENABLE) Else GUICtrlSetState($inpVal, $GUI_DISABLE) EndIf Case $Button1 GUICtrlSetState($inpVal, $GUI_DISABLE) GUICtrlSetState($CheckKeepAlpha, $GUI_DISABLE) GUICtrlSetState($Button1, $GUI_DISABLE) MainLoop() ExitLoop Case Else ContinueLoop EndSwitch WEnd EndFunc ;==>ProcessFiles Func Settings() If _IsChecked($CheckKeepAlpha) Then $v1 = ' ' Else $v1 = ' ' & '-alpha off' & ' ' EndIf If _IsChecked($ExtractAlpha) Then ;Extracting JPG $sSourceFile = '"' & $sSourceFile & '"' $sNewFileNameA = ($sFileName & '_a.' & $ExtOutput) $sDestFileA = '"' & $sDrive & StringTrimRight($sFolder, 1) & '\' & $sNewFileNameA & '"' $sParamsA = '-channel A -separate -quality' & ' ' & GUICtrlRead($inpVal) & ' ' & '-colorspace sRGB' $sRunWaitA = $sIMPath & " " & $sSourceFile & " " & $sParamsA & " " & $sDestFileA EndIf ;Converting PNG $sNewFileName = ($sFileName & '.' & $ExtOutput2) $sDestFile = '"' & $sDrive & StringTrimRight($sFolder, 1) & '\' & $sNewFileName & '"' $sDestFile3 = $sDrive & StringTrimRight($sFolder, 1) & '\' & $sNewFileName $sParams = $v1 & '-colorspace sRGB' $sRunWait = $sIMPath & " " & $sSourceFile & " " & $sParams & " " & $sDestFile EndFunc ;==>Settings Func MainLoop() WriteLogFile() ConsoleWrite("File Log Path: " & $sFileLogPath & @LF) For $i = 1 To $CmdLine[0] $sSourceFile = $CmdLine[$i] _PathSplit($sSourceFile, $sDrive, $sFolder, $sFileName, $sExt) GUICtrlSetData($ProgressBar1, ($i / $CmdLine[0]) * 100) UpdateProgress($Progress1, ($i / $CmdLine[0]) * 100) GUICtrlSetData($Label, $sFileName & $sExt) GUICtrlSetState($LabelStatus, $GUI_ENABLE) GUICtrlSetColor($LabelStatus, $COLOR_BLACK) GUICtrlSetData($LabelStatus, 'Converting') Sleep(20) If StringRegExp($sExt, "\A" & $sPattern & "\z", 0) = 1 Then If FileExists($sSourceFile) Then Settings() ; function of settings ConsoleWrite("Full converting path: " & $sRunWaitA & @LF) If _IsChecked($ExtractAlpha) Then RunWait(@ComSpec & ' /c ' & $sRunWaitA, '', @SW_HIDE) EndIf RunWait(@ComSpec & ' /c ' & $sRunWait, '', @SW_HIDE) Else ConsoleWriteError("File [" & $sSourceFile & "] not found" & @CRLF) EndIf If FileExists($sDestFile3) Then LabelAnim(' .') LabelAnim(' . .') LabelAnim(' . . .') LabelAnim(' . . . OK') Sleep(20) Else LabelAnim(' .') LabelAnim(' . .') LabelAnim(' . . .') GUICtrlSetColor($LabelStatus, $COLOR_RED) LabelAnim(' . . . ERROR') UpdateLogFile() EndIf Else ; MsgBox(0, "Wrong extension", "Extension of file [" & $sFileName & "] is [" & $sExt & "] and not in" & @LF & "[" & $ExtsPreview & "]" & @CRLF) ConsoleWriteError("Extension of file [" & $sSourceFile & "] is [" & $sExt & "] and not in [" & $sPattern & "]" & @CRLF) ; Terminate() LabelAnim(' .') LabelAnim(' . .') LabelAnim(' . . .') GUICtrlSetColor($LabelStatus, $COLOR_RED) LabelAnim(' . . . Wrong Extension') UpdateLogFile() EndIf Next ; Retrieve the file size (in bytes) $iFileSize = FileGetSize($sFileLogPath) ConsoleWrite("FileLog size: " & $iFileSize & @LF) If $iFileSize < $LogDefaultSize Then FileDelete($sFileLogPath) ElseIf $iFileSize > $LogDefaultSize Then FileMove($sFileLogPath, @WorkingDir, $FC_OVERWRITE) EndIf GUICtrlSetData($Label, "Converting complete") Sleep(10) EndFunc ;==>MainLoop Func LabelAnim($Result) GUICtrlSetData($LabelStatus, 'Converting' & $Result) Sleep(12) EndFunc Func RemoveExt($Input) Local $ExtArray = StringSplit($Input, ".") Return StringReplace($Input, "." & $ExtArray[$ExtArray[0]], "", -1) EndFunc Func GetFileName($Input) Local $PathArray = StringSplit($Input, "\/") Return $PathArray[$PathArray[0]] EndFunc ;--------------------------------------------------------------- ;- Creating file in @tempdir ;--------------------------------------------------------------- Func WriteLogFile() ; Create a constant variable in Local scope of the filepath that will be read/written to. $ScriptNameWoExt = RemoveExt(GetFileName(@ScriptName)) $sFileLogPath = (@TempDir & '\' & '_' & $ScriptNameWoExt & '_errorlog_' & @YEAR & '_' & @MON & '_' & @MDAY & '_' & @HOUR & '_' & @MIN & '_' & @SEC & '_.txt') If FileExists($sFileLogPath) Then FileDelete($sFileLogPath) EndIf ; Create a temporary file to write data to. If Not FileWrite($sFileLogPath, "ImageMagick converter (" & $sIMConv & ") can't convert these files:" & @CRLF) Then MsgBox($MB_SYSTEMMODAL, "", "An error occurred whilst writing the temporary file.") Return False EndIf EndFunc ;--------------------------------------------------------------- ;- Update log file in @tempdir ;--------------------------------------------------------------- Func UpdateLogFile() ; Open the file for writing (append to the end of a file) and store the handle to a variable. Local $hFileOpen = FileOpen($sFileLogPath, $FO_APPEND) If $hFileOpen = -1 Then MsgBox($MB_SYSTEMMODAL, "", "An error occurred whilst writing the temporary file.") Return False EndIf ; Write data to the file using the handle returned by FileOpen. FileWriteLine($hFileOpen, ($sFileName & $sExt)) Sleep(20) ; Close the handle returned by FileOpen. FileClose($hFileOpen) EndFunc ;--------------------------------------------------------------- ;- Enhanced Progress widget ;--------------------------------------------------------------- Func CreateProgress($x, $y, $w, $h, $Label="") Dim $Progress[2] $Progress[0] = GuiCtrlCreateProgress($x, $y, $w, $h) ; this is progress bar $Progress[1] = GuiCtrlCreateLabel("---", $x+0, $y-21, '', '', $SS_RIGHT) ; this is percentage label GUICtrlSetFont($Progress[1], 11, 500, 0, "") GUICtrlSetBkColor($Progress[1], $GUI_BKCOLOR_TRANSPARENT) Return $Progress EndFunc Func UpdateProgress($ProgressID, $Percent, $Label="") GUICtrlSetData($ProgressID[0], $Percent) GUICtrlSetData($ProgressID[1], $Label & Round($Percent, 1) & "%") EndFunc Func _IsChecked($idControlID) Return BitAND(GUICtrlRead($idControlID), $GUI_CHECKED) = $GUI_CHECKED EndFunc ;==>_IsChecked Func Terminate() If WinGetHandle('') <> $hGUI Then HotKeySet('{ESC}') Send('{ESC}') HotKeySet('{ESC}', '_Close') Return EndIf GUIDelete() Exit EndFunc ;==>Terminate Exit(0) the problem caused by this area:
      Case $ExtractAlpha or $ExtractBlue If _IsChecked($ExtractAlpha) or _IsChecked($ExtractBlue) Then GUICtrlSetState($inpVal, $GUI_ENABLE) Else GUICtrlSetState($inpVal, $GUI_DISABLE) EndIf if I remove "or $ExtractBlue" and "or _IsChecked($ExtractBlue)" the input field is not flashing.
      p.s.: also my button don't work if I use OR for the "Case" condition.
    • By nooneclose
      Why can I not click on either of my input fields?
      #Region ### START Koda GUI section ### Form= Global $Form1 = GUICreate("Form1", 730, 437, 192, 124) ;GUISetFont(14, 800, 0, "MS Sans Serif") GUISetBkColor(0xC0DCC0) Global $Label1 = GUICtrlCreateLabel("Enter your Password. UserName is auto filled", 62, 40, 604, 41, $SS_CENTER) GUICtrlSetFont(-1, 26, 800, 0, "MS Sans Serif") Global $Label2 = GUICtrlCreateLabel("User Name:", 120, 130, 604, 31, $SS_LEFT) GUICtrlSetFont(-1, 20, 800, 0, "MS Sans Serif") Global $Label3 = GUICtrlCreateLabel("Password:", 135, 210, 604, 31, $SS_LEFT) GUICtrlSetFont(-1, 20, 800, 0, "MS Sans Serif") Global $Input1 = GUICtrlCreateInput(@UserName, 274, 130, 185, 32) GUICtrlSetFont(-1, 14, 800, 1, "MS Sans Serif") Global $Input2 = GUICtrlCreateInput("Password", 274, 210, 185, 32, $ES_PASSWORD) GUICtrlSetFont(-1, 14, 800, 0, "MS Sans Serif") Global $OK = GUICtrlCreateButton("OK", 274, 270, 185, 57) GUICtrlSetFont(-1, 20, 800, 0, "MS Sans Serif") GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $OK Global $UserName = GUICtrlRead($Input1) Global $PassWord = GUICtrlRead($Input2) ExitLoop EndSwitch WEnd ; Delete the GUI window GUIDelete()  
    • By sudeepjd
      I was looking for a way to embed Windows Media Player into Autoit. I found 2 Windows Media Player UDF's but both of them seem to have used the OCX directly. The problem with using the OCX directly is that the video display size cannot be changed, and it takes the size of the video inherently.
      @seangriffin created the VLC GUI based on embedding the IE object into the GUI and that seems to work perfectly with Windows Media Player as well and it does not give the resize problem.
      I built the WMP.au3 around this concept and would like to share it with everybody.
      Attached is the WMP.au3 and the WMP_Example.au3 where it is used.

      Feedback is appreciated. This is my first UDF, so please be kind. 
      SudeepJD
      WMP_Example.au3
      WMP.au3
×
×
  • Create New...