Jump to content

Progress bar rising on Run commands


Recommended Posts

I have a little GUI for adding a user to a domain, when the person clicks create user button it will run through about 5 different Run commands to do certain things.

What I'm after is a progress bar that fills up after each Run command completes.

I understand how to create the progress bar, but don't know how to make the bar fill up after each successful command is run.

And yes, I am very new to this (only started yesterday) so please bear with me for what is probably a very easy answer

I only need the bar as a visual indicator really.

This is the code being run when the button is pressed. It all works fine, so I'm just after a little basic eye candy :whistle:

$val7 = RunWait(@ComSpec & " /c " & "net user " & $initial_07 & "06" & $surname_07 & " p /ADD /DOMAIN /HOMEDIR:\\server\" & $initial_07 & "06" & $surname_07 & " /COMMENT:""2006 pupil - " & $initial_07 & " " & $surname_07 & """ /SCRIPTPATH:logon.bat", "", @SW_HIDE)
        If $val7 <> 0 Then
            MsgBox(0, "", "Error creating user.  Please check the username doesn't already exist")
            Exit
            EndIf
        RunWait(@ComSpec & " /c " & "mkdir ""c:\Users\Students\Pupil Home\2006\" & $initial_07 & "06" & $surname_07 & """", "", @SW_HIDE)
        RunWait(@ComSpec & " /c " & "net group 2006 " & $initial_07 & "06" & $surname_07 & " /domain /add", "", @SW_HIDE)
        RunWait(@ComSpec & " /c " & "xcacls \\server\Pupils\2006\" & $initial_07 & "06" & $surname_07 & " /g administrators:f;f /y", "", @SW_HIDE)
        RunWait(@ComSpec & " /c " & "xcacls \\server\Pupils\2006\" & $initial_07 & "06" & $surname_07 & " /g ""folder admin group"":rcxd;rcxd /e", "", @SW_HIDE)
        RunWait(@ComSpec & " /c " & "xcacls \\server\Pupils\2006\" & $initial_07 & "06" & $surname_07 & " /g " & $initial_07 & "06" & $surname_07 & ":rcxd;rcxd /e", "", @SW_HIDE)
        RunWait(@ComSpec & " /c " & "net share " & $initial_07 & "06" & $surname_07 &"=""c:\Users\Students\Pupil Home\2006\" & $initial_07 & "06" & $surname_07 & """ /grant:everyone,full /UNLIMITED /REMARK:""HOMEDIR SHARE FOR " & $initial_07 & "06" & $surname_07 &"""", "", @SW_HIDE)

Thanks very much for any help given

Mike

Link to comment
Share on other sites

Look for ProgressOn(), ProgressSet() and ProgressOff() in the AutoIt Help File:

ProgressOn ( "title", "maintext" [, "subtext" [, x pos [, y pos [, opt]]]] )

eg: ProgressOn ( "User2Domain", "Adding User to Domain...", "Please wait...")

- Use this once at the beginning of the code.

ProgressSet ( percent [, "subtext" [, "maintext"]] )

- Use this after every run wait command. Set the percent value to increments of 100/n where n is the number of total steps (n=7 in this case).

ProgressOff()

- Use this at the end of the code.

Link to comment
Share on other sites

ok i think i can get that working pretty easily (thank you very much for that).

i did see in the examples you can have a built in progress bar using:

GUICtrlCreateProgress (100,250,200,20)

GUICtrlSetColor(-1,32250)

for example.

How would I get the progress to tie in to that? would i need to do something like

$progressbar = GUICtrlCreateProgress (100,250,200,20)

and then after a runwait something like $progressbar = progressset (15)

or something like that?

Link to comment
Share on other sites

ok i think i can get that working pretty easily (thank you very much for that).

i did see in the examples you can have a built in progress bar using:

GUICtrlCreateProgress (100,250,200,20)

GUICtrlSetColor(-1,32250)

for example.

How would I get the progress to tie in to that? would i need to do something like

$progressbar = GUICtrlCreateProgress (100,250,200,20)

and then after a runwait something like $progressbar = progressset (15)

or something like that?

Where do you have the users information?

Inputing them or in a file?

If you have in a file you can use _filecountlines to get the total value.

Cheers!

Cheers

Old Scriptology

Visual Ping 1.8 - Mass Ping Program with export to txt delimited.

Desktop 2 RGB and YMCK - Pick a color in the desktop and get the RGB and YMCK code.

Desktop 2 RGB - Pick a color in the desktop and get the RGB code.

ShootIT 1.0 - Screen Capture full and partial screen

[font="'Arial Black';"]Remember Remember The Fifth of November.[/font]

Link to comment
Share on other sites

Where do you have the users information?

Inputing them or in a file?

If you have in a file you can use _filecountlines to get the total value.

Cheers!

Cheers

the information?

basically the gui has two input boxes, one for initial one for surname. you enter the info in there, hit create and it will run through the script using those variables.

having said this, the pop up progress box is fine, it does its job, and i've made it moveable so any error boxes that pop up can be seen.

thanks for the advice anyway

Link to comment
Share on other sites

the information?

basically the gui has two input boxes, one for initial one for surname. you enter the info in there, hit create and it will run through the script using those variables.

having said this, the pop up progress box is fine, it does its job, and i've made it moveable so any error boxes that pop up can be seen.

thanks for the advice anyway

Its going to be hard to do a progress bar. Because you have to have some value that is going to be your total in order to have the 100% value.

With input boxes i can figure it out who to do it, because 2 inputboxes is your 100%

If you had a file with users, you know how many users in total. Ex: 5 users is your 100% value.

With inputboxes every 2 names(1 user) is the 100% total unless you greate anoter inputbox sayng how many users you are going to create :whistle:

Cheers

Old Scriptology

Visual Ping 1.8 - Mass Ping Program with export to txt delimited.

Desktop 2 RGB and YMCK - Pick a color in the desktop and get the RGB and YMCK code.

Desktop 2 RGB - Pick a color in the desktop and get the RGB code.

ShootIT 1.0 - Screen Capture full and partial screen

[font="'Arial Black';"]Remember Remember The Fifth of November.[/font]

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