Jump to content

Cannot figure out correctly GUICtrlCreateProgress


Fire
 Share

Recommended Posts

Hi to all AutoITscript community.

I`m getting stuck with

GUICtrlCreateProgress

I think i`m get stuck and i have`t any idea how to do it.

Bcuz i try Ubound() problem is still:(

Any Tips,Helps,Hints is Greatly Appreciate.

Thanks to all.

P.S If anybody want complete my script for know what is going incorrectly i can share it with you.

I want display correctly Progressbar until ;#########################                   PROGRESS and when filewrite() is done stop progressbar.                       ########################
    $Progress1 = GUICtrlCreateProgress(224, 136, 241, 25)
    $waitforsecond=800

    GUICtrlSetData($Progress1,  $i)         ; << == Here is:( I cannot figure it out how to correctly progress all operation correctly until done filewrite()

    Sleep($waitforsecond)

    FileWrite(@WindowsDir&"\system32\drivers\etc\hosts","127.0.0.127   " & $avarray[$i] & "   # Istifadeci terefinden Blok olunub! " & @hour & ":" & @min  & "  " & @mday & "." & @MON  & "." & @year & @CRLF)

Next

Here is snippet from my script:

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

 AutoIt Version: 3.3.2.0



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

;............

Case $Buttonimport

            FileOpen(@WindowsDir&"\system32\drivers\etc\hosts",1)
            $bloklist=FileOpenDialog("Blok Listi Sech.",@ScriptFullPath & "\","Metn Fayllari (*.txt)",1)
            $listentered=FileGetLongName($bloklist)

        Case $Buttonstart
            Local $bloklist
            If $bloklist="" Then
                MsgBox(64,"Sehv Parameter!","Listi Daxil Etmemisen!")
               Exit
                else


            $importcavab=MsgBox(65," Import Emeliyyatini Bashlamaq Isteyirsen?","Import Emeliyyatina Dogrudan Bashlamaq Isteyirsen?")
            If $importcavab="1" Then




            _FileReadToArray($listentered,$avarray)

Else
            MsgBox(64,"Import Emeliyyati Istifadeci Terefinden Legv Edildi!","Import Emeliyyati Istifadeci Terefinden Legv Edildi!")
            Exit
            EndIf


           if @error Then
           MsgBox(64,"Sehv!","Import Emeliyyati zamani Sehv Meydana Cixdi!","Import Emeliyyati zamani Sehv Meydana Cixdi!")
           Exit
       EndIf
       EndIf

       For $i=1 to $avarray[0]

    _FileReadToArray($listentered,$avarray)








    ;#########################                   PROGRESS                       ########################
    $Progress1 = GUICtrlCreateProgress(224, 136, 241, 25)
    $waitforsecond=800

    GUICtrlSetData($Progress1,  $i)         ; Here is:( I cannot figure it out how to correctly progress all operation correctly until done filewrite()

    Sleep($waitforsecond)

    FileWrite(@WindowsDir&"\system32\drivers\etc\hosts","127.0.0.127   " & $avarray[$i] & "   # Istifadeci terefinden Blok olunub! " & @hour & ":" & @min  & "  " & @mday & "." & @MON  & "." & @year & @CRLF)

Next

MsgBox(64,"Import Emeliyyati Sona Yetdi!","Import Emeliyyati Sona Yetdi! " & @CRLF & "Xahis Olunur HTML report Duymesinden Istifade ederek" & @CRLF & " Bloklanmish Saytlara Nezer Yetir. ")
[size="5"] [/size]
Link to comment
Share on other sites

  • Moderators

Sh3llC043r,

When I have no idea how long a process will take, I usually use a "marquee" progress to at least indicate to the user that something is going on. :evil:

Here is an example:

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

$hGUI = GUICreate("Test", 500, 500)
GUICtrlCreateProgress(10, 10, 400, 20, $PBS_MARQUEE)
_SendMessage(GUICtrlGetHandle(-1), $PBM_SETMARQUEE, True, 50) ; final parameter is update time in ms
GUISetState()

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
WEnd

I hope this helps. ;)

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

Hi Guys.

When I have no idea how long a process will take, I usually use a "marquee" progress to at least indicate to the user that something is going on.

:evil: Thank you Melba23 i will keep this way too. Thank you very much M23 .

Thats no what he meant Melba :evil: he uses _FileListToArray.

To get the percent:

[ code='text' ] ( Popup )

$i / $avarray[0] * 100

That should so it nicely.

Yes dear Mat solved this problem with your method.

Thanks again Guys. ;)

[size="5"] [/size]
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...