Jump to content
Sign in to follow this  
caramen

[Solved]Auto text

Recommended Posts

Hello guys. 

I totaly reworked a script to get less problem(Melba23) and i used a topic to copy an existing script and modified it. 

Since my last post it was bad evaluated as a spam bot but by my fault since i have not explained the purpose of it corectly. (Yes i got ugly english)

 

Then FIRST OF ALL the purpose of this script is to allow a call center to complet multiple fields in internet explorer and optionnaly; i am gonna see that after the principal code to configure multiple email that can be send. I know there is some UDF for outlook etc... but i want a single script to do all. this is the way i want to do that. 

 

Ok this is my complete code for the moment. 

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

 AutoIt Version: 3.3.14.2
 Author:         myName

 Script Function:
    Template AutoIt script.

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

; Script Start - Add your code below here
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Misc.au3>


$dll = DllOpen("user32.dll")

Global    $EnvoyerMess1Sub1
Global    $EnvoyerMess2Sub1
Global    $EnvoyerMess3Sub1
Global    $EnvoyerMess4Sub1
Global    $EnvoyerMess5Sub1

Global    $EnvoyerMess1Sub2
Global    $EnvoyerMess2Sub2
Global    $EnvoyerMess3Sub2
Global    $EnvoyerMess4Sub2
Global    $EnvoyerMess5Sub2

Global    $EnvoyerMess1Sub3
Global    $EnvoyerMess2Sub3
Global    $EnvoyerMess3Sub3
Global    $EnvoyerMess4Sub3
Global    $EnvoyerMess5Sub3

Global    $EnvoyerMess1Sub4
Global    $EnvoyerMess2Sub4
Global    $EnvoyerMess3Sub4
Global    $EnvoyerMess4Sub4
Global    $EnvoyerMess5Sub4

Global Const $SettingsFile = @SCRIPTDIR & '\Settings.ini'
$Setting1 = IniRead ($SettingsFile, 'Stats', 'Utilisation', "ERROR")
IniWrite ($SettingsFile, 'Stats', 'Utilisation',$Setting1+1)

$Valeur1 = IniRead ($SettingsFile, 'NomMenu', 'Menu1', "ERROR")
$Valeur2 = IniRead ($SettingsFile, 'NomMenu', 'Menu2', "ERROR")
$Valeur3 = IniRead ($SettingsFile, 'NomMenu', 'Menu3', "ERROR")
$Valeur4 = IniRead ($SettingsFile, 'NomMenu', 'Menu4', "ERROR")

$Valeur11 = IniRead ($SettingsFile, 'NomMenu', 'SousMenu1.1', "ERROR")
$Valeur12 = IniRead ($SettingsFile, 'NomMenu', 'SousMenu1.2', "ERROR")
$Valeur13 = IniRead ($SettingsFile, 'NomMenu', 'SousMenu1.3', "ERROR")
$Valeur14 = IniRead ($SettingsFile, 'NomMenu', 'SousMenu1.4', "ERROR")
$Valeur15 = IniRead ($SettingsFile, 'NomMenu', 'SousMenu1.5', "ERROR")

$Valeur21 = IniRead ($SettingsFile, 'NomMenu', 'SousMenu2.1', "ERROR")
$Valeur22 = IniRead ($SettingsFile, 'NomMenu', 'SousMenu2.2', "ERROR")
$Valeur23 = IniRead ($SettingsFile, 'NomMenu', 'SousMenu2.3', "ERROR")
$Valeur24 = IniRead ($SettingsFile, 'NomMenu', 'SousMenu2.4', "ERROR")
$Valeur25 = IniRead ($SettingsFile, 'NomMenu', 'SousMenu2.5', "ERROR")

$Valeur31 = IniRead ($SettingsFile, 'NomMenu', 'SousMenu3.1', "ERROR")
$Valeur32 = IniRead ($SettingsFile, 'NomMenu', 'SousMenu3.2', "ERROR")
$Valeur33 = IniRead ($SettingsFile, 'NomMenu', 'SousMenu3.3', "ERROR")
$Valeur34 = IniRead ($SettingsFile, 'NomMenu', 'SousMenu3.4', "ERROR")
$Valeur35 = IniRead ($SettingsFile, 'NomMenu', 'SousMenu3.5', "ERROR")

$Valeur41 = IniRead ($SettingsFile, 'NomMenu', 'SousMenu4.1', "ERROR")
$Valeur42 = IniRead ($SettingsFile, 'NomMenu', 'SousMenu4.2', "ERROR")
$Valeur43 = IniRead ($SettingsFile, 'NomMenu', 'SousMenu4.3', "ERROR")
$Valeur44 = IniRead ($SettingsFile, 'NomMenu', 'SousMenu4.4', "ERROR")
$Valeur45 = IniRead ($SettingsFile, 'NomMenu', 'SousMenu4.5', "ERROR")

$Message11 = IniRead ($SettingsFile, 'Messages', 'Message11', "ERROR")
$Message12 = IniRead ($SettingsFile, 'Messages', 'Message11', "ERROR")
$Message13 = IniRead ($SettingsFile, 'Messages', 'Message11', "ERROR")
$Message14 = IniRead ($SettingsFile, 'Messages', 'Message11', "ERROR")
$Message15 = IniRead ($SettingsFile, 'Messages', 'Message11', "ERROR")

$Message21 = IniRead ($SettingsFile, 'Messages', 'Message21', "ERROR")
$Message22 = IniRead ($SettingsFile, 'Messages', 'Message22', "ERROR")
$Message23 = IniRead ($SettingsFile, 'Messages', 'Message23', "ERROR")
$Message24 = IniRead ($SettingsFile, 'Messages', 'Message24', "ERROR")
$Message25 = IniRead ($SettingsFile, 'Messages', 'Message25', "ERROR")

$Message31 = IniRead ($SettingsFile, 'Messages', 'Message31', "ERROR")
$Message32 = IniRead ($SettingsFile, 'Messages', 'Message32', "ERROR")
$Message33 = IniRead ($SettingsFile, 'Messages', 'Message33', "ERROR")
$Message34 = IniRead ($SettingsFile, 'Messages', 'Message34', "ERROR")
$Message35 = IniRead ($SettingsFile, 'Messages', 'Message35', "ERROR")

$Message41 = IniRead ($SettingsFile, 'Messages', 'Message41', "ERROR")
$Message42 = IniRead ($SettingsFile, 'Messages', 'Message42', "ERROR")
$Message43 = IniRead ($SettingsFile, 'Messages', 'Message43', "ERROR")
$Message44 = IniRead ($SettingsFile, 'Messages', 'Message44', "ERROR")
$Message45 = IniRead ($SettingsFile, 'Messages', 'Message45', "ERROR")

BuildHiddenGUI()

While 1
    Sleep ( 10 )
    If _IsPressed("04", $dll) Then CallCustomContextMenu()
    $msg = GUIGetMsg()
    Switch $msg

;~ =====================================================

        Case $EnvoyerMess1Sub1
;~         MouseClick("left")

           Send(""&$Message11)

        Case $EnvoyerMess2Sub1
           Send(""&$Message12)

        Case $EnvoyerMess3Sub1
           Send(""&$Message13)

        Case $EnvoyerMess4Sub1
           Send(""&$Message14)

        Case $EnvoyerMess5Sub1
           Send(""&$Message15)

;~ ======================================================

        Case $EnvoyerMess1Sub2

        Case $EnvoyerMess2Sub2

        Case $EnvoyerMess3Sub2

        Case $EnvoyerMess4Sub2

        Case $EnvoyerMess5Sub2

;~ ======================================================

        Case $EnvoyerMess1Sub3

        Case $EnvoyerMess2Sub3

        Case $EnvoyerMess3Sub3

        Case $EnvoyerMess4Sub3

        Case $EnvoyerMess5Sub3


;~ =======================================================

        Case $EnvoyerMess1Sub4

        Case $EnvoyerMess2Sub4

        Case $EnvoyerMess3Sub4

        Case $EnvoyerMess4Sub4

        Case $EnvoyerMess5Sub4

;~ ======================================================

        Case $ConfigITEM

    EndSwitch

WEnd
DllClose($dll)

Func BuildHiddenGUI()
    Global $Contextmenu, $msg, $GUI, $aTSR
    Global $SubMenu1, $folderitem, $programitem, $fileitem, $ConfigITEM, $otheritem
    Global $folderitem1, $folderitem2, $programitem1, $programitem2
    $aTSR = _GetTotalScreenResolution()

    $GUI = GuiCreate("GUI Context Menu",1,1, $aTSR[0], 1,BitOR($WS_POPUP,$WS_BORDER),BitOr($WS_EX_TOPMOST,$WS_EX_TOOLWINDOW))
    WinSetTrans( $GUI, '', 1)

    GUISetState()

    $Contextmenu = GUICtrlCreateContextMenu()
    $SubMenu1 = GUICtrlCreateMenu(""&$Valeur1, $Contextmenu)
      $EnvoyerMess1Sub1 = GUICtrlCreateMenuItem(""&$Valeur11, $SubMenu1)
      $EnvoyerMess2Sub1 = GUICtrlCreateMenuItem(""&$Valeur12, $SubMenu1)
      $EnvoyerMess3Sub1 = GUICtrlCreateMenuItem(""&$Valeur13, $SubMenu1)
      $EnvoyerMess4Sub1 = GUICtrlCreateMenuItem(""&$Valeur14, $SubMenu1)
      $EnvoyerMess5Sub1 = GUICtrlCreateMenuItem(""&$Valeur15, $SubMenu1)
    $SubMenu2 = GUICtrlCreateMenu(""&$Valeur2, $Contextmenu)
      $EnvoyerMess1Sub2 = GUICtrlCreateMenuItem(""&$Valeur21, $SubMenu2)
      $EnvoyerMess2Sub2 = GUICtrlCreateMenuItem(""&$Valeur22, $SubMenu2)
      $EnvoyerMess3Sub2 = GUICtrlCreateMenuItem(""&$Valeur23, $SubMenu2)
      $EnvoyerMess4Sub2 = GUICtrlCreateMenuItem(""&$Valeur24, $SubMenu2)
      $EnvoyerMess5Sub2 = GUICtrlCreateMenuItem(""&$Valeur25, $SubMenu2)
    $SubMenu3 = GUICtrlCreateMenu(""&$Valeur3, $Contextmenu)
      $EnvoyerMess1Sub3 = GUICtrlCreateMenuItem(""&$Valeur31, $SubMenu3)
      $EnvoyerMess2Sub3 = GUICtrlCreateMenuItem(""&$Valeur32, $SubMenu3)
      $EnvoyerMess3Sub3 = GUICtrlCreateMenuItem(""&$Valeur33, $SubMenu3)
      $EnvoyerMess4Sub3 = GUICtrlCreateMenuItem(""&$Valeur34, $SubMenu3)
      $EnvoyerMess5Sub3 = GUICtrlCreateMenuItem(""&$Valeur35, $SubMenu3)
    $SubMenu4 = GUICtrlCreateMenu(""&$Valeur4, $Contextmenu)
      $EnvoyerMess1Sub4 = GUICtrlCreateMenuItem(""&$Valeur41, $SubMenu4)
      $EnvoyerMess2Sub4 = GUICtrlCreateMenuItem(""&$Valeur42, $SubMenu4)
      $EnvoyerMess3Sub4 = GUICtrlCreateMenuItem(""&$Valeur43, $SubMenu4)
      $EnvoyerMess4Sub4 = GUICtrlCreateMenuItem(""&$Valeur44, $SubMenu4)
      $EnvoyerMess5Sub4 = GUICtrlCreateMenuItem(""&$Valeur45, $SubMenu4)

    GUICtrlCreateMenuItem("", $contextmenu)     ; separator

   $ConfigITEM = GUICtrlCreateMenuItem("Configuration", $contextmenu)
EndFunc

Func CallCustomContextMenu()
    Local $contextmenu, $msg
    Global $newsubmenu, $folderitem, $programitem, $fileitem, $otheritem
    Global $folderitem1, $folderitem2, $programitem1, $programitem2
    Local $pos
    Global $GUI, $aTSR
    WinActivate ($GUI)
    ControlClick ( $GUI, "", "", "right", 1, $aTSR[0], 1)
EndFunc

Func _GetTotalScreenResolution()
    Local $aRet[2], $VirtualDesktopWidth, $VirtualDesktopHeight
    Global Const $SM_VIRTUALWIDTH = 78
    Global Const $SM_VIRTUALHEIGHT = 79
    $VirtualDesktopWidth = DllCall("user32.dll", "int", "GetSystemMetrics", "int", $SM_VIRTUALWIDTH)
    $aRet[0] = $VirtualDesktopWidth[0]
    $VirtualDesktopHeight = DllCall("user32.dll", "int", "GetSystemMetrics", "int", $SM_VIRTUALHEIGHT)
    $aRet[1] = $VirtualDesktopHeight[0]
    Return $aRet
EndFunc

Func WinGroupActive()
    AutoItSetOption("WinTitleMatchMode", 4)
    If WinActive("classname=ExploreWClass") _
        Or WinActive("classname=CabinetWClass") _
        Or WinActive("classname=#32770") _
        Or WinActive("classname=DV2ControlHost") _
        Or WinActive("classname=MMCMainFrame") _
        Or WinActive("[CLASS:Progman; Title:Program Manager]") Then
        Return True
    Else
        Return False
    EndIf
EndFunc

 

By this way the script is very more clear about the purpose. When i use middle mouse click i got a context menu that apear. Then i can send the preconfigured message in the ini file that will alow me to send particular message without spending much time on it. 

First question : 

When i push middle click on a particular windows how to get back focus on it ??

plz dont make attention on the declared fonction that are unused i am gonna clean that at the end. 

Edited by caramen

My video tutorials : HERE ( In construction )  || My Discord : https://discord.gg/S9AnwHw

How to Ask Help ||  UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote

Spoiler

 Water's UDFs:
Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Share this post


Link to post
Share on other sites

i thougth about 

$windows =  WinGetTitle("[active]")
            WinActivate (""&$windows)

but where tu put the function WinGetTitle? 


My video tutorials : HERE ( In construction )  || My Discord : https://discord.gg/S9AnwHw

How to Ask Help ||  UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote

Spoiler

 Water's UDFs:
Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Share this post


Link to post
Share on other sites

solution : 

Func CallCustomContextMenu()
    Global      $windows =  WinGetTitle("[active]")
    Local $contextmenu, $msg
    Global $newsubmenu, $folderitem, $programitem, $fileitem, $otheritem
    Global $folderitem1, $folderitem2, $programitem1, $programitem2
    Local $pos
    Global $GUI, $aTSR
    WinActivate ($GUI)
    ControlClick ( $GUI, "", "", "right", 1, $aTSR[0], 1)
EndFunc

thx.


My video tutorials : HERE ( In construction )  || My Discord : https://discord.gg/S9AnwHw

How to Ask Help ||  UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote

Spoiler

 Water's UDFs:
Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Share this post


Link to post
Share on other sites

Script is finish and work well but i got a new improvement but difficult for me again x)

 

Since i use Settings.ini file and i read all values at the start of the script and not in the gui loop

If i change any value in the ini file i need to Quit my script executable and luch it again 

 

Is there a way to close the script and start it again after changing a value automaticaly ? :blink:

Edited by caramen

My video tutorials : HERE ( In construction )  || My Discord : https://discord.gg/S9AnwHw

How to Ask Help ||  UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote

Spoiler

 Water's UDFs:
Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Share this post


Link to post
Share on other sites

Solution : 

 

Thx x)


My video tutorials : HERE ( In construction )  || My Discord : https://discord.gg/S9AnwHw

How to Ask Help ||  UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote

Spoiler

 Water's UDFs:
Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Share this post


Link to post
Share on other sites

It's possible without restarting. Just put all inireads in a func. This func has to be called at script start and on button click "ReRead INI". Therefor this "ReRead INI"-button has to be implementet in you GUI.

Edited by AutoBert

Share this post


Link to post
Share on other sites

I thougth about that and tryed with bad logic,

include made me add 3 line of code x) it s better :P 

 

THx

Edited by caramen

My video tutorials : HERE ( In construction )  || My Discord : https://discord.gg/S9AnwHw

How to Ask Help ||  UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote

Spoiler

 Water's UDFs:
Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Share this post


Link to post
Share on other sites

Now this is my problem :  

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

 AutoIt Version: 3.3.14.2
 Author:         myName

 Script Function:
    Template AutoIt script.

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

; Script Start - Add your code below here
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Misc.au3>
#Include <Restart.au3>


$dll = DllOpen("user32.dll")


Global $fInterrupt = False

Global $cButton = "NO"


Global    $Boucle
Global    $BoucleStop


Global Const $SettingsFile = @SCRIPTDIR & '\Settings.ini'
$Setting1 = IniRead ($SettingsFile, 'Stats', 'Utilisation', "ERROR")
IniWrite ($SettingsFile, 'Stats', 'Utilisation',$Setting1+1)


$MessageBoucle = IniRead ($SettingsFile, 'Messages', 'MessageBoucle', "ERROR")

BuildHiddenGUI()

While 1
    Sleep ( 10 )
    If _IsPressed("04", $dll) Then CallCustomContextMenu()
    $msg = GUIGetMsg()
    Switch $msg



        Case $Boucle
           GUICtrlSetData($cButton, "No")
                    _Running()

           WinActivate (""&$windows)
                    Sleep (5000)
           Send(""&$MessageBoucle)
                    Sleep (5000)

        Case $BoucleStop
           GUICtrlSetData($cButton, "Yes")


    EndSwitch

WEnd
DllClose($dll)

Func BuildHiddenGUI()
    Global $Contextmenu, $msg, $GUI, $aTSR
    Global $SubMenu1, $folderitem, $programitem, $fileitem, $ConfigITEM, $otheritem
    Global $folderitem1, $folderitem2, $programitem1, $programitem2
    $aTSR = _GetTotalScreenResolution()

    $GUI = GuiCreate("GUI Context Menu",1,1, $aTSR[0], 1,BitOR($WS_POPUP,$WS_BORDER),BitOr($WS_EX_TOPMOST,$WS_EX_TOOLWINDOW))
    WinSetTrans( $GUI, '', 1)

    GUISetState()

    $Contextmenu = GUICtrlCreateContextMenu()


    $Boucle = GUICtrlCreateMenuItem("Boucle", $contextmenu)
    $BoucleStop = GUICtrlCreateMenuItem("Boucle Stop", $contextmenu)

    GUICtrlCreateMenuItem("", $contextmenu)

    $Aide = GUICtrlCreateMenuItem("Aide", $contextmenu)



EndFunc

Func CallCustomContextMenu()
    Global      $windows =  WinGetTitle("[active]")
    Local $contextmenu, $msg
    Global $newsubmenu, $folderitem, $programitem, $fileitem, $otheritem
    Global $folderitem1, $folderitem2, $programitem1, $programitem2
    Local $pos
    Global $GUI, $aTSR
    WinActivate ($GUI)
    ControlClick ( $GUI, "", "", "right", 1, $aTSR[0], 1)
EndFunc

Func _GetTotalScreenResolution()
    Local $aRet[2], $VirtualDesktopWidth, $VirtualDesktopHeight
    Global Const $SM_VIRTUALWIDTH = 78
    Global Const $SM_VIRTUALHEIGHT = 79
    $VirtualDesktopWidth = DllCall("user32.dll", "int", "GetSystemMetrics", "int", $SM_VIRTUALWIDTH)
    $aRet[0] = $VirtualDesktopWidth[0]
    $VirtualDesktopHeight = DllCall("user32.dll", "int", "GetSystemMetrics", "int", $SM_VIRTUALHEIGHT)
    $aRet[1] = $VirtualDesktopHeight[0]
    Return $aRet
EndFunc

Func WinGroupActive()
    AutoItSetOption("WinTitleMatchMode", 4)
    If WinActive("classname=ExploreWClass") _
        Or WinActive("classname=CabinetWClass") _
        Or WinActive("classname=#32770") _
        Or WinActive("classname=DV2ControlHost") _
        Or WinActive("classname=MMCMainFrame") _
        Or WinActive("[CLASS:Progman; Title:Program Manager]") Then
        Return True
    Else
        Return False
    EndIf
 EndFunc

 Func _Running()

    ConsoleWrite("Running"  & @CRLF) ; Now we are here we can no longer read the main loop

    ; Here we run our loop checking every second if the flag has been set in the handler
    $nBegin = TimerInit()
    Do
        Sleep(1000)

        ; Here we look for the flag set in the handler
        If $fInterrupt = True Then
            ConsoleWrite("Interrupted" & @CRLF)
            ; Reset the flag
            $fInterrupt = False
            ; And return early
            Return
        EndIf
        ConsoleWrite("Still running!" & @CRLF)

    Until TimerDiff($nBegin) > 50000

    ; Now the loop has finished naturally

EndFunc   ;==>_Running

 Func _WM_COMMAND($hWnd, $Msg, $wParam, $lParam)

    ; The button was pressed
    If BitAND($wParam, 0x0000FFFF) = $cButton Then
        Switch GUICtrlRead($cButton)
            ; We only want to react if the function is already running
            Case "No"
                ; Set the flag
                $fInterrupt = True
        EndSwitch
    EndIf
    Return $GUI_RUNDEFMSG

EndFunc   ;==>_WM_COMMAND

(i made reproducer to make the script shorter) 

I added these case :

Case $Boucle
           GUICtrlSetData($cButton, "No")
                    _Running()

           WinActivate (""&$windows)
                    Sleep (5000)
           Send(""&$MessageBoucle)
                    Sleep (5000)

        Case $BoucleStop
           GUICtrlSetData($cButton, "Yes")

 

i whould like to make the loop and exit loop after Case

$BoucleStop

I tryed the help given in that post : 

 

but cant get it working. 


My video tutorials : HERE ( In construction )  || My Discord : https://discord.gg/S9AnwHw

How to Ask Help ||  UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote

Spoiler

 Water's UDFs:
Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Share this post


Link to post
Share on other sites

@caramen: please don't pm me, after the pm i remember this thread is only pseudo for 2 locked threads.

Quote

caramen,

When you asked via PM if you could post a thread about interrupting a loop I did not expect you to repost essentially the same code as in the thread I locked yesterday.

and in the other way, why needing help:

 

1 hour ago, caramen said:

include made me add 3 line of code x) it s better :P 

 

Share this post


Link to post
Share on other sites

I pm you to get faster answer* 

I did what melba requested (rework the code) (and explain the purpose ) (like i explained you in the PM :/ ) 

Edited by caramen

My video tutorials : HERE ( In construction )  || My Discord : https://discord.gg/S9AnwHw

How to Ask Help ||  UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote

Spoiler

 Water's UDFs:
Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Share this post


Link to post
Share on other sites

but your real attempt is still against forumrules, so please don't pm me. The way to solve is already showed:

1 hour ago, AutoBert said:

It's possible without restarting. Just put all inireads in a func. This func has to be called at script start and on button click "ReRead INI". Therefor this "ReRead INI"-button has to be implementet in you GUI.

but you find a better solution:

1 hour ago, caramen said:

I thougth about that and tryed with bad logic,

include made me add 3 line of code x) it s better :P 

 

THx

 

Edited by AutoBert

Share this post


Link to post
Share on other sites

I am sorry man. You are mistaking about the question. 

 

The first question is answered : how to restart the script ? 

 

The second question is an other probleme : How to stop the loop during the case execution ?

Or may the restart script is a solution ? (but i cant get the context menu again while i am in the loop)

 

Edited by caramen

My video tutorials : HERE ( In construction )  || My Discord : https://discord.gg/S9AnwHw

How to Ask Help ||  UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote

Spoiler

 Water's UDFs:
Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Share this post


Link to post
Share on other sites

And trust me i canT afford an other warning so be sure i took attention about not breaking any rule .... :sweating: 

 

Or maybe it s me mistaking ? In this case i am gonna retract any question and stop posting. 

Edited by caramen

My video tutorials : HERE ( In construction )  || My Discord : https://discord.gg/S9AnwHw

How to Ask Help ||  UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote

Spoiler

 Water's UDFs:
Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Share this post


Link to post
Share on other sites
3 minutes ago, caramen said:

And trust me i canT afford an other warning so be sure i took attention about not breaking any rule

Don't be too sure that isn't coming ... you are in the queue for review and zero credit left.. verdict will be there soon so better lay very low till then.


SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

When i say i cant afford i main : i must not have an other one. did i spelled whrong ?


My video tutorials : HERE ( In construction )  || My Discord : https://discord.gg/S9AnwHw

How to Ask Help ||  UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote

Spoiler

 Water's UDFs:
Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Share this post


Link to post
Share on other sites

caramen,

This time you have explained yourself clearly in the OP and not just spoken of a "spambot" (which is why the thread was locked last time), so we are going to leave the thread open.

However, the Forum rules clearly prohibit PMing others for help, so consider yourself suitably admonished for doing so - please do not make a habit of it in future.

M23

 


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

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

I am on the good way xD. Thanks melba i thougth i was mistaking again. Jos made me afraid a lot :sweating:.

 

So i repost a reworked Reproducer to try to get the while working. Can someone help me ?

 

I am trying to push middle click:

-Start loop by clicking : Boucle

Re push middle click 

-Stop loop if i click : Boucle Stop

This is for send msg on monitored server. 

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

 AutoIt Version: 3.3.14.2
 Author:         myName

 Script Function:
    Template AutoIt script.

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

; Script Start - Add your code below here
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Misc.au3>
#Include <Restart.au3>


$dll = DllOpen("user32.dll")


Global $fInterrupt = False

Global $Flag = "Yes"


Global    $Boucle
Global    $BoucleStop


Global Const $SettingsFile = @SCRIPTDIR & '\Settings.ini'
$Setting1 = IniRead ($SettingsFile, 'Stats', 'Utilisation', "ERROR")
IniWrite ($SettingsFile, 'Stats', 'Utilisation',$Setting1+1)
IniWrite ($SettingsFile, 'Messages', 'MessageBoucle','Message test')

$MessageBoucle = IniRead ($SettingsFile, 'Messages', 'MessageBoucle', "ERROR")

BuildHiddenGUI()

While 1
    Sleep ( 10 )
    If _IsPressed("04", $dll) Then CallCustomContextMenu()
    $msg = GUIGetMsg()
    Switch $msg



        Case $Boucle
           $Flag = "Yes"
                    _Running()

           WinActivate (""&$windows)
           Send(""&$MessageBoucle)
                    Sleep (5000)
        Case $BoucleStop
           $Flag= "Yes"


    EndSwitch

WEnd

DllClose($dll)

;~ =========================================GUI================================================


Func BuildHiddenGUI()
    Global $Contextmenu, $msg, $GUI, $aTSR
    Global $SubMenu1, $folderitem, $programitem, $fileitem, $ConfigITEM, $otheritem
    Global $folderitem1, $folderitem2, $programitem1, $programitem2
    $aTSR = _GetTotalScreenResolution()

    $GUI = GuiCreate("GUI Context Menu",1,1, $aTSR[0], 1,BitOR($WS_POPUP,$WS_BORDER),BitOr($WS_EX_TOPMOST,$WS_EX_TOOLWINDOW))
    WinSetTrans( $GUI, '', 1)

    GUISetState()

    $Contextmenu = GUICtrlCreateContextMenu()


    $Boucle = GUICtrlCreateMenuItem("Boucle", $contextmenu)
    $BoucleStop = GUICtrlCreateMenuItem("Boucle Stop", $contextmenu)

    GUICtrlCreateMenuItem("", $contextmenu)

    $Aide = GUICtrlCreateMenuItem("Aide", $contextmenu)



EndFunc



Func CallCustomContextMenu()
    Global      $windows =  WinGetTitle("[active]")
    Local $contextmenu, $msg
    Global $newsubmenu, $folderitem, $programitem, $fileitem, $otheritem
    Global $folderitem1, $folderitem2, $programitem1, $programitem2
    Local $pos
    Global $GUI, $aTSR
    WinActivate ($GUI)
    ControlClick ( $GUI, "", "", "right", 1, $aTSR[0], 1)
EndFunc

Func _GetTotalScreenResolution()
    Local $aRet[2], $VirtualDesktopWidth, $VirtualDesktopHeight
    Global Const $SM_VIRTUALWIDTH = 78
    Global Const $SM_VIRTUALHEIGHT = 79
    $VirtualDesktopWidth = DllCall("user32.dll", "int", "GetSystemMetrics", "int", $SM_VIRTUALWIDTH)
    $aRet[0] = $VirtualDesktopWidth[0]
    $VirtualDesktopHeight = DllCall("user32.dll", "int", "GetSystemMetrics", "int", $SM_VIRTUALHEIGHT)
    $aRet[1] = $VirtualDesktopHeight[0]
    Return $aRet
EndFunc

;~ =========================================================================================


;~ ========================================While attemp=================================================


 Func _Running()

    ConsoleWrite("Running"  & @CRLF) ; Now we are here we can no longer read the main loop

    ; Here we run our loop checking every second if the flag has been set in the handler
    $nBegin = TimerInit()
    Do
        Sleep(1000)

        ; Here we look for the flag set in the handler
        If $fInterrupt = True Then
            ConsoleWrite("Interrupted" & @CRLF)
            ; Reset the flag
            $fInterrupt = False
            ; And return early
            Return
        EndIf
        ConsoleWrite("Still running!" & @CRLF)

    Until TimerDiff($nBegin) > 50000

    ; Now the loop has finished naturally

EndFunc   ;==>_Running

 Func _WM_COMMAND($hWnd, $Msg, $wParam, $lParam)

    ; The button was pressed
    If BitAND($wParam, 0x0000FFFF) = $Flag Then
        Switch $cButton
            ; We only want to react if the function is already running
            Case $Msg
                ; Set the flag
                $fInterrupt = True
        EndSwitch
    EndIf
    Return $GUI_RUNDEFMSG

EndFunc   ;==>_WM_COMMAND

;~ =====================================================================================================

 

Edited by caramen

My video tutorials : HERE ( In construction )  || My Discord : https://discord.gg/S9AnwHw

How to Ask Help ||  UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote

Spoiler

 Water's UDFs:
Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Share this post


Link to post
Share on other sites

@Melba23 can you explain me how to do the trick you explained me but with that kinda script ?

 

I have to admite i cant realy understand that trick i dont realy want a posted script made by you but i whould prefer understand the trick to make my own script. 

 

I can read the tutorial about flags and try lot of things to introduce exemples.but  i am not getting anything working. what i am missing ?

 

Edited by caramen

My video tutorials : HERE ( In construction )  || My Discord : https://discord.gg/S9AnwHw

How to Ask Help ||  UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote

Spoiler

 Water's UDFs:
Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Share this post


Link to post
Share on other sites

I am still working on this and trying. But failing :/ 

Reworked reproducer : 

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Misc.au3>
#Include <Restart.au3>

Opt("GUIOnEventMode", 0)

$dll = DllOpen("user32.dll")


Global $fInterrupt = False

Global $Flag = "Yes"


Global    $Boucle
Global    $Reload
Global    $BoucleStop


Global Const $SettingsFile = @SCRIPTDIR & '\Settings.ini'
$Setting1 = IniRead ($SettingsFile, 'Stats', 'Utilisation', "ERROR")
IniWrite ($SettingsFile, 'Stats', 'Utilisation',$Setting1+1)
IniWrite ($SettingsFile, 'Messages', 'MessageBoucle','Message test')

$MessageBoucle = IniRead ($SettingsFile, 'Messages', 'MessageBoucle', "ERROR")

BuildHiddenGUI()

While 1
;~    Global        $windows =  WinGetTitle("[active]")
    Sleep ( 10 )
    If _IsPressed("04", $dll) Then CallCustomContextMenu()
    $msg = GUIGetMsg()
    Switch $msg



        Case $Boucle
           WinActivate (""&$windows)
           _Running()

        Case $BoucleStop

           WinActivate (""&$windows)

        Case $Reload
             _ScriptRestart()

    EndSwitch

WEnd

DllClose($dll)

;~ =========================================GUI================================================


Func BuildHiddenGUI()
    Global $Contextmenu, $msg, $GUI, $aTSR
    Global $SubMenu1, $folderitem, $programitem, $fileitem, $ConfigITEM, $otheritem
    Global $folderitem1, $folderitem2, $programitem1, $programitem2
    $aTSR = _GetTotalScreenResolution()

    $GUI = GuiCreate("GUI Context Menu",1,1, $aTSR[0], 1,BitOR($WS_POPUP,$WS_BORDER),BitOr($WS_EX_TOPMOST,$WS_EX_TOOLWINDOW))
    WinSetTrans( $GUI, '', 1)

    GUISetState()

    $Contextmenu = GUICtrlCreateContextMenu()


    $Boucle = GUICtrlCreateMenuItem("Boucle", $contextmenu)
     GUICtrlSetOnEvent($Boucle, "_Running")
    $BoucleStop = GUICtrlCreateMenuItem("Boucle Stop", $contextmenu)
     GUICtrlSetOnEvent($BoucleStop, "")
    $Reload = GUICtrlCreateMenuItem("Reload", $contextmenu)
     GUICtrlSetOnEvent($Reload, "_ScriptRestart")


    GUICtrlCreateMenuItem("", $contextmenu)

    $Aide = GUICtrlCreateMenuItem("Aide", $contextmenu)



EndFunc



Func CallCustomContextMenu()
    Global      $windows =  WinGetTitle("[active]")
    Local $contextmenu, $msg
    Global $newsubmenu, $folderitem, $programitem, $fileitem, $otheritem
    Global $folderitem1, $folderitem2, $programitem1, $programitem2
    Local $pos
    Global $GUI, $aTSR
    WinActivate ($GUI)
    ControlClick ( $GUI, "", "", "right", 1, $aTSR[0], 1)
EndFunc

Func _GetTotalScreenResolution()
    Local $aRet[2], $VirtualDesktopWidth, $VirtualDesktopHeight
    Global Const $SM_VIRTUALWIDTH = 78
    Global Const $SM_VIRTUALHEIGHT = 79
    $VirtualDesktopWidth = DllCall("user32.dll", "int", "GetSystemMetrics", "int", $SM_VIRTUALWIDTH)
    $aRet[0] = $VirtualDesktopWidth[0]
    $VirtualDesktopHeight = DllCall("user32.dll", "int", "GetSystemMetrics", "int", $SM_VIRTUALHEIGHT)
    $aRet[1] = $VirtualDesktopHeight[0]
    Return $aRet
EndFunc

;~ =========================================================================================


;~ ========================================While attemp=================================================


 Func _Running()

     For $i = 1 To 20
         ConsoleWrite("-Func 1 Running" & @CRLF)
         Sleep(100)
     Next
     ConsoleWrite(">Func 1 Ended" & @CRLF)

EndFunc   ;==>_Running

Some question apear... 

 

Why? 

If i use ("GUIOnEventMode", 1) my function is running but i cant open the GUI context menu anymore. this little script part make me so crazy. guess i am gonna give up :(

 


My video tutorials : HERE ( In construction )  || My Discord : https://discord.gg/S9AnwHw

How to Ask Help ||  UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote

Spoiler

 Water's UDFs:
Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Share this post


Link to post
Share on other sites

While your sample do "_Running()", the while is on the "Case $Boucle". So "CallCustomContextMenu()" can be done only after _Running() End.

While u do "For $i = 1 To 20 sleep(100)", "_IsPressed" is not fire.

You should look maybe arround AdlibRegister :

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Misc.au3>
;#Include <Restart.au3>

Opt("GUIOnEventMode", 0)

$dll = DllOpen("user32.dll")


Global $fInterrupt = False

Global $Flag = "Yes"


Global    $Boucle
Global    $Reload
Global    $BoucleStop


Global Const $SettingsFile = @SCRIPTDIR & '\Settings.ini'
$Setting1 = IniRead ($SettingsFile, 'Stats', 'Utilisation', "ERROR")
IniWrite ($SettingsFile, 'Stats', 'Utilisation',$Setting1+1)
IniWrite ($SettingsFile, 'Messages', 'MessageBoucle','Message test')

$MessageBoucle = IniRead ($SettingsFile, 'Messages', 'MessageBoucle', "ERROR")

BuildHiddenGUI()

While 1
;~    Global        $windows =  WinGetTitle("[active]")
    Sleep ( 10 )
    If _IsPressed("04", $dll) Then CallCustomContextMenu()
    $msg = GUIGetMsg()
    Switch $msg



        Case $Boucle
           WinActivate (""&$windows)
           ;_Running()
           AdlibRegister("_Running", 100); fire _Running all 100ms

        Case $BoucleStop

           WinActivate (""&$windows)
           AdlibUnRegister("_Running")
           ConsoleWrite(">Func 1 Ended" & @CRLF)

        Case $Reload
             ;_ScriptRestart()

    EndSwitch

WEnd

DllClose($dll)

;~ =========================================GUI================================================


Func BuildHiddenGUI()
    Global $Contextmenu, $msg, $GUI, $aTSR
    Global $SubMenu1, $folderitem, $programitem, $fileitem, $ConfigITEM, $otheritem
    Global $folderitem1, $folderitem2, $programitem1, $programitem2
    $aTSR = _GetTotalScreenResolution()

    $GUI = GuiCreate("GUI Context Menu",1,1, $aTSR[0], 1,BitOR($WS_POPUP,$WS_BORDER),BitOr($WS_EX_TOPMOST,$WS_EX_TOOLWINDOW))
    WinSetTrans( $GUI, '', 1)

    GUISetState()

    $Contextmenu = GUICtrlCreateContextMenu()


    $Boucle = GUICtrlCreateMenuItem("Boucle", $contextmenu)
     GUICtrlSetOnEvent($Boucle, "_Running")
    $BoucleStop = GUICtrlCreateMenuItem("Boucle Stop", $contextmenu)
     GUICtrlSetOnEvent($BoucleStop, "")
    $Reload = GUICtrlCreateMenuItem("Reload", $contextmenu)
     ;GUICtrlSetOnEvent($Reload, "_ScriptRestart")


    GUICtrlCreateMenuItem("", $contextmenu)

    $Aide = GUICtrlCreateMenuItem("Aide", $contextmenu)



EndFunc



Func CallCustomContextMenu()
    Global      $windows =  WinGetTitle("[active]")
    Local $contextmenu, $msg
    Global $newsubmenu, $folderitem, $programitem, $fileitem, $otheritem
    Global $folderitem1, $folderitem2, $programitem1, $programitem2
    Local $pos
    Global $GUI, $aTSR
    WinActivate ($GUI)
    ControlClick ( $GUI, "", "", "right", 1, $aTSR[0], 1)
EndFunc

Func _GetTotalScreenResolution()
    Local $aRet[2], $VirtualDesktopWidth, $VirtualDesktopHeight
    Global Const $SM_VIRTUALWIDTH = 78
    Global Const $SM_VIRTUALHEIGHT = 79
    $VirtualDesktopWidth = DllCall("user32.dll", "int", "GetSystemMetrics", "int", $SM_VIRTUALWIDTH)
    $aRet[0] = $VirtualDesktopWidth[0]
    $VirtualDesktopHeight = DllCall("user32.dll", "int", "GetSystemMetrics", "int", $SM_VIRTUALHEIGHT)
    $aRet[1] = $VirtualDesktopHeight[0]
    Return $aRet
EndFunc

;~ =========================================================================================


;~ ========================================While attemp=================================================


 Func _Running()

     ;For $i = 1 To 20
         ConsoleWrite("-Func 1 Running" & @CRLF)
         ;Sleep(100)
     ;Next
     ;ConsoleWrite(">Func 1 Ended" & @CRLF)

 EndFunc   ;==>_Running

 

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 nacerbaaziz
      hello evrybody
      here is an example about how to split your texts using a delimiter with the ability to select how much of delimiters shows in each colum  with $i_number
      e.g
      you have a long text and you want to split it in an array
      that evry colum have a number (n) of lines
      i made a function that do that for you
      just call it with a three params
      $s_text
      your text
      $i_number
      the number that you want to put in each col
      $s_siparator
      the siparator
      default is "|"
      here is the function with example
      i hope that it will be useful for you
       
      ****
       
      #include <Array.au3> $s_txt = "some text1some text2|some text3|some text4|some text5|some text6" $array = splitText($s_txt, 2) _ArrayDisplay($array) Func splitText($s_text, $i_number, $s_siparator = "|") Local $a_TXT = StringSplit($s_text, $s_siparator) Local $a_Return[$a_TXT[0] + 1] If ($a_TXT[0] <= $i_number) Or ($i_number <= 0) Then ReDim $a_Return[2] $a_Return[0] = 1 $a_Return[1] = $s_text Return $a_Return EndIf Local $i_Processed = 1, $i_arrayProcessed = 1 Do For $i = $i_Processed To ($i_Processed + $i_number) - 1 If ($a_TXT[0] < $i) Then ExitLoop If Not ($a_Return[$i_arrayProcessed]) Then $a_Return[$i_arrayProcessed] = $a_TXT[$i] Else $a_Return[$i_arrayProcessed] &= $s_siparator & $a_TXT[$i] EndIf $i_Processed += 1 Next $i_arrayProcessed += 1 Until ($a_TXT[0] < $i_Processed) ReDim $a_Return[$i_arrayProcessed] $a_Return[0] = $i_arrayProcessed - 1 Return $a_Return EndFunc ;==>splitText
      accept my greetings
      thanks to
      @Dan_555
      for his notes
       
    • By nacerbaaziz
      hello autoit team
      please i've a question for you.
      am creating a audio player
      and in this audio player i want to show the current trac info
      such as the total time and the position ... etc
      i know i can show it as label
      but the screen reader for the blind read the text every change
      because it have a screen scan
      what i want is to show this informations but such image or icon
      i mean i need to create
      GUICtrlCreatepic or GUICtrlCreateicon ....
      or some thing as that
      and show this informations as image on it
      i think that i can do that with the 
      _GDIPlus functions
      but i couldn't find the currect way to do it
      i tried the _GDIPlus_GraphicsDrawString
      but i couldn't know how it work
      what i need is a small example that create a GUI
      and add a multy line text to it as graphic or image.
      so i need a simple way because it will changed every sec
      i hope any one can help me to do that
      global $GUI = GUICreate("text", 400, 400) global $label = GUICtrlCreateLabel(GetText(), 10, 10, 380, 380) GUISetState() do sleep(100) until GUIGetMSG() = -3 exit func GetText() return StringFormat("file name is test.mp3 \r\n total time is 00:30:00 \r\n position is 00:05:50") endFunc  
    • By nacerbaaziz
      hello autoit group
      please i've a question
      i had make a function that put some thing into the clipBoard and paste it
      using the send function
      e.g
      ClipPut("hello")
      send("^v")
       
      when the keyboard is english all things work fine
      but when the keyboard is arabic the send command write the ltr v insted of the text in clipboard
      i was tryed to use
      send("{ctrldown}v{ctrlUp}")
      but the same
      please can any one help me
       
    • By Kiko745
      Hello!
      I am new to autoit so please if someone could help me. I am trying to combine multiple .txt files but I can't get it right. In every file are the exact amout of lines ( for example here are 2 ) ,            I don't want to make it for just 2 lines for each txt files but for all the lines the txt files contains. The thing I want to do is :
      Text File 1
      Hello my name
      I am a big
      ...
      Text File 2
      is Fred,
      Potato head for
      ...
      Text File 3
      and I like to eat pizza.
      Not getting this right.
      ...
      ------------------- Combine them all into one txt file like here ------------------------------
      Final Text file
      Hello my name is Fred, and I like to eat pizza.
      I am a big Potato head for Not getting this right.
      ...
       
      Thanks for any advice!
      P.S. Sorry for my English, not my first language.
       
    • By Kruxe
      Hello Everyone,
      I am very green when it comes to AutoIT, I have recently started using it to automate a job that i perform using MS Excel and that is working great. Recently I have been faced with a challenge I which i need to copy a specific set of lines from one .txt file and past them, overwriting a specific set of lines in a different .txt file. I honestly have no clue how I can copy the specified lines and transfer them. What functions / commands could I use and how could I lay them out I AutoIT? Any and all help will be appreciated. 
      Thanks!
      Kruxe
×
×
  • Create New...