Jump to content

Recommended Posts

Posted

Hello all,

Im still quite new to AutoIT scripting and so Ive probably overlooked something really simple but I wondered if there was a way of having a window display what stage the script was at? Sort of like a live feedback rather than a constant stream of msgbox's popping up each time.

Thanks for any help or information.

Posted (edited)

Hello all,

Im still quite new to AutoIT scripting and so Ive probably overlooked something really simple but I wondered if there was a way of having a window display what stage the script was at? Sort of like a live feedback rather than a constant stream of msgbox's popping up each time.

Thanks for any help or information.

You could use SplashTextOn() to display status while the script runs:
For $n = 1 To 3
    SplashTextOn("Progress", "Performing step " & $n & " of 3...")
    Sleep(1000)
Next
SplashTextOn("Progress", "Process complete.")
Sleep(1000)

You could also use a progress bar. See the example script for ProgressOn() in the help file.

Or create a GUI of your own with GuiCreate() and just update the text in it:

#include <GuiConstantsEx.au3>

Global $hGUI = GUICreate("Status", 300, 300)
Global $ctrlLabel = GUICtrlCreateLabel("Click START", 20, 20, 260)
Global $ctrlButton1 = GUICtrlCreateButton("START", 100, 250, 100, 30)
GUISetState()

While 1
    Switch GUIGetMsg()
        Case $ctrlButton1
            For $n = 1 To 3
                GUICtrlSetData($ctrlLabel, "Performing step " & $n & " of 3...")
                Sleep(1000)
            Next
            GUICtrlSetData($ctrlLabel, "Process complete.")
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
WEnd

:D

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
Posted

By coincidence, i wanted to ask almost the same question. I am also new to AutoIt

I understand about the splashtexton(), but I'm worried about the sleep 1000 part beneath it in the example code given. Does this mean the program will freeze during that time?

I am writing a program which will probably take a long time to execute. I wanted to display "X% completed" on screen without requiring the user to click OK over and over again.

I had hoped that "X% completed" would be displayed on screen while the computer got on with its calculations. Will this in fact happen, or does AutoIt close the display box as soon as it moves on to the next command please?

I miss the days of good old GWBasic, when everything happened in the same window.

Posted (edited)

I understand about the splashtexton(), but I'm worried about the sleep 1000 part beneath it in the example code given. Does this mean the program will freeze during that time?

- Yes, script will paused in every loop. Instead of it, for example, you can use AdlibEnable(read in help file) to periodically check needed values and update progress_bar without pausing script. Edited by Godless

_____________________________________________________________________________

Posted

By coincidence, i wanted to ask almost the same question. I am also new to AutoIt

I understand about the splashtexton(), but I'm worried about the sleep 1000 part beneath it in the example code given. Does this mean the program will freeze during that time?

I am writing a program which will probably take a long time to execute. I wanted to display "X% completed" on screen without requiring the user to click OK over and over again.

I had hoped that "X% completed" would be displayed on screen while the computer got on with its calculations. Will this in fact happen, or does AutoIt close the display box as soon as it moves on to the next command please?

I miss the days of good old GWBasic, when everything happened in the same window.

No Sleep() is actually required. The only reason it's there in my demo is so you have time to read the output. Take the Sleep's out and it will still run fine, but it will flash by so fast you can't read it.

You should be looking more at ProgressOn(). Just have your script update it with ProgressSet() on occasion.

:D

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

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...