Jump to content
Sign in to follow this  
anhyeuem

[GUICtrlCreateProgress]: Doesn't work

Recommended Posts

anhyeuem

[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

Share this post


Link to post
Share on other sites
Melba23

anhyeuem,

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

M23

  • Like 1

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 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
anhyeuem

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.

Share this post


Link to post
Share on other sites
Melba23

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

  • Like 1

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 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
anhyeuem

I know.
...
Mr Melba23
huhuhu
cry....
can you help me
Please
I will die if i don't finish this homework.
Process, help...
I love you. :*

Edited by anhyeuem

Share this post


Link to post
Share on other sites
Melba23

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
  • Like 1

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 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
anhyeuem

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

Share this post


Link to post
Share on other sites
anhyeuem

oh, that icon :x
what's happen? i think it is a kiss
:*
Dear Mr Melba23,
you're my super hero.
i complete my homeword,
thank you so much

Share this post


Link to post
Share on other sites
anhyeuem

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

 

Share this post


Link to post
Share on other sites
Melba23

anhyeuem,

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

M23

  • Like 1

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 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
anhyeuem

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

Share this post


Link to post
Share on other sites
Melba23

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

  • Like 1

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 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
anhyeuem

Dear my teacher,
Oh, this is very very perfect. it is easy for me.
I don't need compare % like example before.
This example is easy for me, it is: A++
Thank alot

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  

×