Jump to content

Progressbar..


toming
 Share

Recommended Posts

hellow

i'm beginner..

i have meet some problems..

now i'm cording some run file .

the problems that when i runing run file, i want to move progressbar functions.

but, progressbar is waited util run file runing complete..

i wish to know, how do i cording .. at the same time, progressbar moving and run file command.

look at down.. my script..ㅜ_ㅜ

Opt("WinWaitDelay",5000)

Opt("WinTitleMatchMode",4)

Opt("WinDetectHiddenText",1)

Opt("MouseCoordMode",0)

OPT ("TrayIconHide",0)

$answer = MsgBox(4, "Auto IP Setting Start", "ok")

If $answer = 7 Then

MsgBox(0, "Auto IP Setting Cancel", "cancel")

Exit

EndIf

TestFunc1()

MsgBox(0, "TCP/IP Initializing..", "initialization ok")

Exit

Func TestFunc1()

ProgressOn("TCP/IP Initializing..", "now working", "0 percent")

Run("C:\Documents and Settings\lkh\desktop\Nasdetector.exe");,@SW_HIDE) ; this program has some spending time..

; so when the programs running, other command have to progress but. i don't know the method..

For $i = 0 to 100 step 4

sleep(1000)

ProgressSet( $i, $i & " percent")

; next command need to use "winactivate, Mouse move, and click , and keyboard control..." in the runing progrem.

Next

ProgressOff()

EndFunc

Edited by toming
Link to comment
Share on other sites

Hi. I see english is not your first language. I was also a little confused when I first used the Run() function. I had a similar problem. I have found if you use @comspec then the script keeps executing (instead of waiting). So the syntax would be something like:

$command=@comspec & " /c " & "C:\Documents and Settings\lkh\desktop\Nasdetector.exe"
Run($command)

Hope this helps. Just some other advice... At least try to use some punctuation - I think many people didn't realise you even asked a question (no question mark "?"). Also use the AutoIt format thing to make your stuff look pretty - shallow I know - but hey, that's the world we live in. ;)

... and keep on learning. :)

QED

Link to comment
Share on other sites

Well, is this just broken because of the stray ")" in it, or did you mean to comment it that way?

Run("C:\Documents and Settings\lkh\desktop\Nasdetector.exe");,@SW_HIDE); this program has some spending time..

Any way, Run() doesn't block (pause) the script, the way RunWait() would, so this is only about what you are doing AFTER the Run().

If you mean to do have the progress bar updated in the background, write the ProgressSet() as a function and call it from AdLibEnable() for the current Production version, or with AdLibRegister() in the current Beta version. Demo:

Global $iProgress = 0, $hWin, $iPID
Global $sWinTitle = "Untitled - Notepad"

$iPID = Run("Notepad.exe")
WinWait($sWinTitle, "")
$hWin = WinGetHandle($sWinTitle, "")
ControlSend($hWin, "", "Edit1", "Close Notepad to exit script..." & @CRLF)

ProgressOn("Demo", "AdLibEnable Demo", "", 100, 100)

; Change to AdLibRegister for AutoIt version greater than 3.3.0.0
AdLibEnable("_ProgressUpdate", 250) ; Run this function every 250msec

While ProcessExists($iPID)
    ControlSend($hWin, "", "Edit1", @Hour & ":" & @MIN & ":" & @SEC & "  $iProgress = " & $iProgress & @CRLF)
    Sleep(2000)
WEnd


Func _ProgressUpdate()
    $iProgress += 1
    If $iProgress > 100 Then $iProgress = 0
    ProgressSet($iProgress)
EndFunc

:)

Edit: Note this runs in Production version 3.3.0.0 as posted. Change AdLibEnable() to AdLibRegister() for Beta or later versions.

Edited by PsaltyDS
Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

Well, is this just broken because of the stray ")" in it, or did you mean to comment it that way?

Run("C:\Documents and Settings\lkh\desktop\Nasdetector.exe");,@SW_HIDE); this program has some spending time..

Any way, Run() doesn't block (pause) the script, the way RunWait() would, so this is only about what you are doing AFTER the Run().

If you mean to do have the progress bar updated in the background, write the ProgressSet() as a function and call it from AdLibEnable() for the current Production version, or with AdLibRegister() in the current Beta version. Demo:

Global $iProgress = 0, $hWin, $iPID
Global $sWinTitle = "Untitled - Notepad"

$iPID = Run("Notepad.exe")
WinWait($sWinTitle, "")
$hWin = WinGetHandle($sWinTitle, "")
ControlSend($hWin, "", "Edit1", "Close Notepad to exit script..." & @CRLF)

ProgressOn("Demo", "AdLibEnable Demo", "", 100, 100)

; Change to AdLibRegister for AutoIt version greater than 3.3.0.0
AdLibEnable("_ProgressUpdate", 250) ; Run this function every 250msec

While ProcessExists($iPID)
    ControlSend($hWin, "", "Edit1", @Hour & ":" & @MIN & ":" & @SEC & "  $iProgress = " & $iProgress & @CRLF)
    Sleep(2000)
WEnd


Func _ProgressUpdate()
    $iProgress += 1
    If $iProgress > 100 Then $iProgress = 0
    ProgressSet($iProgress)
EndFunc

;)

Edit: Note this runs in Production version 3.3.0.0 as posted. Change AdLibEnable() to AdLibRegister() for Beta or later versions.

Nice solution! :)

Molenoid Fan Girl! And fully fledged nerd-bird! And soon to be Cosplayer~

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