Jump to content

[GUICtrlCreateProgress]: Doesn't work


Recommended Posts

[GUICtrlCreateProgress]: Doesn't work
-I create a GUICtrlCreateProgress but it doesn't work. It word but very bad.

-I want my process: start when Run("Notepad") and finished when ControlSend complete.

-Code:
 

#include <GuiConstants.au3>
#include <ProgressConstants.au3>

$Form1 = GUICreate("test", 619, 250, -1, -1)
$Edit1 = GUICtrlCreateEdit("", 8, 8, 601, 153)
$Button = GUICtrlCreateButton("Run", 310, 176, 290, 33)
$Button1 = GUICtrlCreateButton("About", 20, 176, 70, 33)
$progressbar = GUICtrlCreateProgress(100, 176, 200, 33)
GUISetState(@SW_SHOW)

While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button
a()
Case $Button1
about()
EndSwitch
WEnd

Func a()
        For $A = 1 To 100
        GUICtrlSetData($progressbar, $A)
        Sleep(50)
    Next
Run("Notepad")
WinWaitActive("Untitled - Notepad")
ControlSend("Untitled - Notepad", "", "[CLASS:Edit; INSTANCE:1]", "fdsfdsfdsdgfdddddddddddddddddrrrrrrrrrrrrrryyyyyyyyyyyyyhhhhhhhhhhhhhhhhhdụgdfgfdgdfgdfgregdfgdfgffffffffffffffaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaattttttttttttttttttttyyyyyyyyyyyyyyyyyy")
EndFunc

Func about()
EndFunc 

My friends, my teachers...
please take the time and read my thread
And help me, please.

 

Edited by anhyeuem
Link to comment
Share on other sites

  • Moderators

anhyeuem,

Please stop hijacking other threads by posting this question in them - stick to this one. :naughty:

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

 

Link to comment
Share on other sites

anhyeuem,

Please stop hijacking other threads by posting this question in them - stick to this one. :naughty:

M23

Dear Mr Melba23

Melba23

No no no.  :naughty:

These threads is connected with my thread: GUICtrlCreateProgress

And they are professional and they have knowledge so i will learn from them.

Okay, Do you try answer my question above thread.

I will hear you.

Link to comment
Share on other sites

  • Moderators

anhyeuem,

 

No no no.

These threads is connected with my thread: GUICtrlCreateProgress

Yes, yes, yes. :naughty:

Those other threads are only tenously connected - and you have already asked the question in this one. As I said above, please stick to just the one thread at a time. :)

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

 

Link to comment
Share on other sites

  • Moderators

anhyeuem,

As far as I can see you cannot reliably determine the time it will take to send the various letters to Notepad, so you cannot use a timer. I suggest something along these lines: :)

#include <GuiConstantsEx.au3>
#include <ProgressConstants.au3>

Global $sText = "fdsfdsfdsdgfdddddddddddddddddrrrrrrrrrrrrrryyyyyyyyyyyyyhhhhhhhhhhhhhhhhhd?gdfgfdgdfgdfgregdfgdfgffffffffffffffaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaattttttttttttttttttttyyyyyyyyyyyyyyyyyy"
Global $iTextLen = StringLen($sText)

$Form1 = GUICreate("test", 619, 250, -1, -1)
$Edit1 = GUICtrlCreateEdit("", 8, 8, 601, 153)
$Button = GUICtrlCreateButton("Run", 310, 176, 290, 33)
$Button1 = GUICtrlCreateButton("About", 20, 176, 70, 33)
$progressbar = GUICtrlCreateProgress(100, 176, 200, 33)
GUISetState(@SW_SHOW)

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button
            a()
        Case $Button1
            about()
    EndSwitch
WEnd

Func a()
    Run("Notepad")
    ; Move progress 10% while Notepad loads
    GUICtrlSetData($progressbar, 10)
    WinWaitActive("Untitled - Notepad")
    ; Now send 1 letter at a time
    For $i = 1 To $iTextLen
        ControlSend("Untitled - Notepad", "", "[CLASS:Edit; INSTANCE:1]", StringMid($sText, $i, 1))
        ; And advance progress a little for each letter sent
        Sleep(50)
        GUICtrlSetData($progressbar, 10 + 90 * ($i / 90))
    Next
EndFunc   ;==>a

Func about()
EndFunc   ;==>about
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

 

Link to comment
Share on other sites

anhyeuem,

As far as I can see you cannot reliably determine the time it will take to send the various letters to Notepad, so you cannot use a timer. I suggest something along these lines: :)

#include <GuiConstantsEx.au3>
#include <ProgressConstants.au3>

Global $sText = "fdsfdsfdsdgfdddddddddddddddddrrrrrrrrrrrrrryyyyyyyyyyyyyhhhhhhhhhhhhhhhhhd?gdfgfdgdfgdfgregdfgdfgffffffffffffffaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaattttttttttttttttttttyyyyyyyyyyyyyyyyyy"
Global $iTextLen = StringLen($sText)

$Form1 = GUICreate("test", 619, 250, -1, -1)
$Edit1 = GUICtrlCreateEdit("", 8, 8, 601, 153)
$Button = GUICtrlCreateButton("Run", 310, 176, 290, 33)
$Button1 = GUICtrlCreateButton("About", 20, 176, 70, 33)
$progressbar = GUICtrlCreateProgress(100, 176, 200, 33)
GUISetState(@SW_SHOW)

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button
            a()
        Case $Button1
            about()
    EndSwitch
WEnd

Func a()
    Run("Notepad")
    ; Move progress 10% while Notepad loads
    GUICtrlSetData($progressbar, 10)
    WinWaitActive("Untitled - Notepad")
    ; Now send 1 letter at a time
    For $i = 1 To $iTextLen
        ControlSend("Untitled - Notepad", "", "[CLASS:Edit; INSTANCE:1]", StringMid($sText, $i, 1))
        ; And advance progress a little for each letter sent
        Sleep(50)
        GUICtrlSetData($progressbar, 10 + 90 * ($i / 90))
    Next
EndFunc   ;==>a

Func about()
EndFunc   ;==>about
M23

 

oh, this is perfect my teacher.

it is useful. I live it very much,

thanks.

now, i will repair with a my new script.

because this thread is example script

kiss you, :x

Link to comment
Share on other sites

anhyeuem,

As far as I can see you cannot reliably determine the time it will take to send the various letters to Notepad, so you cannot use a timer. I suggest something along these lines: :)

#include <GuiConstantsEx.au3>
#include <ProgressConstants.au3>

Global $sText = "fdsfdsfdsdgfdddddddddddddddddrrrrrrrrrrrrrryyyyyyyyyyyyyhhhhhhhhhhhhhhhhhd?gdfgfdgdfgdfgregdfgdfgffffffffffffffaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaattttttttttttttttttttyyyyyyyyyyyyyyyyyy"
Global $iTextLen = StringLen($sText)

$Form1 = GUICreate("test", 619, 250, -1, -1)
$Edit1 = GUICtrlCreateEdit("", 8, 8, 601, 153)
$Button = GUICtrlCreateButton("Run", 310, 176, 290, 33)
$Button1 = GUICtrlCreateButton("About", 20, 176, 70, 33)
$progressbar = GUICtrlCreateProgress(100, 176, 200, 33)
GUISetState(@SW_SHOW)

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button
            a()
        Case $Button1
            about()
    EndSwitch
WEnd

Func a()
    Run("Notepad")
    ; Move progress 10% while Notepad loads
    GUICtrlSetData($progressbar, 10)
    WinWaitActive("Untitled - Notepad")
    ; Now send 1 letter at a time
    For $i = 1 To $iTextLen
        ControlSend("Untitled - Notepad", "", "[CLASS:Edit; INSTANCE:1]", StringMid($sText, $i, 1))
        ; And advance progress a little for each letter sent
        Sleep(50)
        GUICtrlSetData($progressbar, 10 + 90 * ($i / 90))
    Next
EndFunc   ;==>a

Func about()
EndFunc   ;==>about
M23

 

Hello Mr.Melba23

I've just gotten good mark: A+

Thank you again.

And i have a new idea: 'Progressbar always run' when Run("Notepad") and finished when ControlSend complete.

Example link .gif: 'Progressbar always run'

'>

or:

'>

or:

'>

or:

https://documentation.devexpress.com/windowsforms/HelpResource.ashx?help=windowsforms&document=img5228.jpg

 

Link to comment
Share on other sites

  • Moderators

anhyeuem,

Search the forum for "marquee progress" - there are lots of examples. :)

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

 

Link to comment
Share on other sites

anhyeuem,

Search the forum for "marquee progress" - there are lots of examples. :)

M23

Oh my god,

my teacher, here you are:

 

#include <GuiConstants.au3>
#include <ProgressConstants.au3>
#include <GuiConstantsEx.au3>
#include <ProgressConstants.au3>
#Include <SendMessage.au3>
$Form1 = GUICreate("test", 619, 250, -1, -1)
$Edit1 = GUICtrlCreateEdit("", 8, 8, 601, 153)
$Button = GUICtrlCreateButton("Run", 310, 176, 290, 33)
$Button1 = GUICtrlCreateButton("About", 20, 176, 70, 33)
$progressbar = GUICtrlCreateProgress(100, 176, 200, 33, $PBS_MARQUEE)

GUISetState(@SW_SHOW)

While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button
a()
Case $Button1
about()
EndSwitch
WEnd

Func a()

Run("Notepad")
GUICtrlSendMsg(-1, $PBM_SETMARQUEE, True, 50)
WinWaitActive("Untitled - Notepad")
ControlSend("Untitled - Notepad", "", "[CLASS:Edit; INSTANCE:1]", "fdsfdsfdsdgfdddddddddddddddddrrrrrrrrrrrrrryyyyyyyyyyyyyhhhhhhhhhhhhhhhhhdụgdfgfdgdfgdfgregdfgdfgffffffffffffffaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaattttttttttttttttttttyyyyyyyyyyyyyyyyyy")
EndFunc

Func about()
EndFunc

It only always run after ControlSend complete and it can't stop when ControlSend complete

Link to comment
Share on other sites

  • Moderators

anhyeuem,

You need to give the marquee time to display by sending the letters separately: :)

#include <ProgressConstants.au3>
#include <GuiConstantsEx.au3>
#include <SendMessage.au3>

Global $sText = "fdsfdsfdsdgfdddddddddddddddddrrrrrrrrrrrrrryyyyyyyyyyyyyhhhhhhhhhhhhhhhhhd?gdfgfdgdfgdfgregdfgdfgffffffffffffffaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaattttttttttttttttttttyyyyyyyyyyyyyyyyyy"
Global $iTextLen = StringLen($sText)


$Form1 = GUICreate("test", 619, 250, -1, -1)
$Edit1 = GUICtrlCreateEdit("", 8, 8, 601, 153)
$Button = GUICtrlCreateButton("Run", 310, 176, 290, 33)
$Button1 = GUICtrlCreateButton("About", 20, 176, 70, 33)
$progressbar = GUICtrlCreateProgress(100, 176, 200, 33, $PBS_MARQUEE)

GUISetState(@SW_SHOW)

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button
            a()
        Case $Button1
            about()
    EndSwitch
WEnd

Func a()

    GUICtrlSendMsg($progressbar, $PBM_SETMARQUEE, True, 50) ; Marquee on
    Run("Notepad")
    WinWaitActive("Untitled - Notepad")
    ; Now send 1 letter at a time
    For $i = 1 To $iTextLen
        ControlSend("Untitled - Notepad", "", "[CLASS:Edit; INSTANCE:1]", StringMid($sText, $i, 1))
        Sleep(10)
    Next
    GUICtrlSendMsg($progressbar, $PBM_SETMARQUEE, False, 50) ; Marquee off

EndFunc   ;==>a

Func about()
EndFunc   ;==>about
And that is all the homework help you get from me today - try and solve the next problem yourself. ;)

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

 

Link to comment
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
 Share

  • Recently Browsing   0 members

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