Jump to content

Progress GUI


TheRunner
 Share

Recommended Posts

Hello again!

I've been working on building a GUI to display how much longer my script needs to run.

Right now the code isn't how it should be for sure, so I was wondering if anyone has examples or idea's that I could try. I can post what I did so far if needed.

Thanks

-Runner

Link to comment
Share on other sites

  • Moderators

TheRunner,

I can post what I did so far if needed

Please do. ;)

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

My code does something like this

"start"

call Step 0 (progress bar is 0%)

do stuff

call Step 1 (progress bar is 45%)

do stuff

call Step 2 (progress bar is 75%)

do stuff

call Step 3 (progress bar is 100%)

done

What I would like to be able to do this in one function, I couldn't figure out how to do it better (still learning) so thought i would ask ;).

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

 AutoIt Version: 3.3.6.1
 Author:       Runner

 Script Function:
    Remove oracle from registry then add new version to registry and update the environment variable

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

; Script Start - Add your code below here
#RequireAdmin
#Include <Array.au3>
#include <StaticConstants.au3>
#include <Crypt.au3>
#include <GUIConstantsEx.au3>

dim $a1[25]
dim $string = ""
dim $regFile = ""
dim $txtFile = ""
dim $hashData = ""
dim $count = 0

$regFile = IniRead("Test.ini", "Registry", "regFile", "NotFound")
$txtFile = IniRead("Test.ini", "Path", "txtFile", "NotFound")
$hashData = IniRead("Test.ini", "Hash", "hashData", "NotFound")
$blockInput = IniRead("Test.ini", "Block", "blockInput", "NotFound") ; 1 to Block all input, 0 to turn off.

Step0()

If DriveMapGet("A:") = "" Then ; checks to see if S: drive is map
    DriveMapAdd("A:","\\mapping\stuff") 
EndIf

$bDigest=_Crypt_HashFile($regFile,$CALG_SHA1)

$var = RegRead ("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment","Path") ; Path for environment variable
; MsgBox(4096, "Path variable is:", $var) - in case something in the path is wrong. Was thinking about putting this to a file incase of error.


; Delete Oracle from Registry
if $hashData = $bDigest Then

if $blockInput = 1 Then
    BlockInput(1)
EndIf   

$Reg = RegDelete("HKEY_LOCAL_MACHINE\SOFTWARE\Oracle")
if $Reg = 1 Then
    ;MsgBox(4096,"Delete","Oracle has been deleted",2)
Else
    ;MsgBox(4096,"Delete Failed", "Oracle does not exist",2)
EndIf

; Put Oracle back in with correct version
; Shows the CMD

do stuff here 

sleep(250)

Step1()

; Get the string from the Env Var then parse it (;) 

$a1 = StringSplit($var, ';', 1)

for $j = 1 to $a1[0]
    $count = $count + 1
Next
    

For $i = 1 to $a1[0]
    ; Search the string to check if it contains "A:","Oracle_9", or "Oracle_8" returns 0 if not found.
    $results1 = StringInStr($a1[$i], "A:")
    $results2 = StringInStr($a1[$i], "ORACLE_9")
    $results3 = StringInStr($a1[$i], "ORACLE_8")
    if $results1 <> 0 Then
        $a1[$i] = ""        
    ElseIf $results2 <> 0 Then
        $a1[$i] = ""
    ElseIf $results3 <> 0 Then
        $a1[$i] = ""
    ElseIf $a1[$i] = "" Or $a1[$i] = " " Then
        $a1[$i] = ""
    Else        
        $string = $string  & $a1[$i]
        $string = $string & ";" ; This is so it doesn't keep adding a semi-colon everytime you run the script.
    EndIf               
Next


$file = FileOpen($txtFile,0) ; Gets the new UNC path and opens the file
$data = FileReadLine($file)

$string = $string & $data ; Adds this data to the end of the file, the data must have a semi-colon at the end of it.

FileClose($file)

; Writes it to your Registry File - Environment 
$result = RegWrite("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment", "Path", "REG_EXPAND_SZ", $string)
If $result = 1 Then
    EnvUpdate()
EndIf

Step2()

; Do stuff and increase progress bar...

Step3()

sleep(2000)

Else
    Exit
EndIf


If $blockInput = 1 Or BlockInput(1) Then
    BlockInput(0)
EndIf

; Methods for progress bar


Func Step0()

EndFunc   ;==>Step0

Func Step1()

EndFunc   ;==>Step1

Func Step2()

EndFunc   ;==>Step2

Func Step3()

EndFunc   ;==>Step3
Link to comment
Share on other sites

  • Moderators

TheRunner,

I would like to be able to do this in one function

Perhaps like this: ;)

; Initialisation stuff

ProgressOn ( "How we are getting on", "This tells you how far through we are")

; Do step 1
_SetProgress(20, "We are doing Step 1")
; Simulate doing Step1
Sleep(5000)
; Do step 2
_SetProgress(40 , "We are doing Step 2")
; Simulate doing Step2
Sleep(5000)
; Do step 3
_SetProgress(60 , "We are doing Step 3")
; Simulate doing Step3
Sleep(5000)
; Do step 4
_SetProgress(80 , "We are doing Step 4")
; Simulate doing Step4
Sleep(5000)
; And we get to the end
ProgressSet (100 , "We are all done here!")
Sleep(2000)

Func _SetProgress($iSet, $sText)
    ProgressSet($iSet , $sText)
EndFunc

Ask if anything is unclear. :)

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

TheRunner,

Glad I could help! ;)

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