Providing User Feedback In AutoIt

Trackback or

One of the most basic requirements for a programming or scripting language is to be able to communicate useful information back to the user. This information varies as much as the programs that are created.

AutoIt provides five basic ways of displaying information to the user. Which one you choose depends on the type of information that you are displayinig and how you want the user to interact with the program. We will be going through these five different ways of displaying information in this article.

Please note that this article does not cover using the new GUI that is available in AutoIt. It deserves an article to itself.

Message Box

The most basic way of displaying information is to use the MsgBox function. It is very flexible and allows you customize it’s message, title, icons, and buttons. Plus, it provides feedback to the program telling it which button was clicked by the user or it can disappear after a pre-determined amount of time.

Example of Message Box

;Feedback to user with MsgBox
 
Dim $Counter
Dim $Max
Dim $Pause
 
$Max = 10
$Pause = 1
 
For $Counter = 1 to $Max
	MsgBox(0,"Status","Completed " & $Counter & " of " & $Max,$Pause)
Next

Download this code: Feedback-Msg.au3

Progress Bar

If you’ve ever installed a program, you’ve see a progress bar. As the software gets closer to being completely installed, the bar moves closer to the right. This is exactly what the progress abr does in AutoIt.

The progress bar is really great for displaying how far along a task is. With a few calculations, you can create a really professional looking progress bar.

Example of Progress Bar

;Feedback to user with Progress Bar
 
Dim $Counter
Dim $Max
Dim $Pause
 
$Max = 10
$Pause = 1
 
ProgressOn("Status","","")
 
For $Counter = 1 to $Max
	ProgressSet(($Counter/$Max)*100,"","Completed " & $Counter & " of " & $Max)
	Sleep($Pause * 1000)
Next
 
ProgressOff()

Download this code: Feedback-PB.au3

Splash Box

A splash box can display either text or an image. It is very customizable, letting you display different fonts, font sizes, and text alignment. You can also specify the size of the box and how it looks.

A splash box is really great for displaying a rolling status log or a splash screen to provide the user with information as the program loads.

Example of Splash Box

;Feedback to user with SplashBoxes
 
Dim $Counter
Dim $Max
Dim $Pause
 
$Max = 10
$Pause = 1
 
SplashTextOn("Status","")
 
For $Counter = 1 to $Max
	ControlSetText("Status", "", "Static1", "Completed " & $Counter & " of " & $Max)
	Sleep($Pause * 1000)
Next
 
SplashOff()

Download this code: Feedback-Splash.au3

Tool Tip

A tool tip is a small yellow text box that pops up next to your cursor. It contains whatever information that you specify.

Tool tips grab the user’s attention but do not require user intervention. A great way to provide the user with a quick update.

Example of Tool Tip

;Feedback to user with ToolTips
 
Dim $Counter
Dim $Max
Dim $Pause
 
$Max = 10
$Pause = 1
 
For $Counter = 1 to $Max
	ToolTip("Completed " & $Counter & " of " & $Max)
	Sleep($Pause * 1000)
Next

Download this code: Feedback-ToolTips.au3

Tray Tip

Tray tips are similar to tool tips. The difference is that they appear as a little balloon above the system tray in the bottom right hand corner of your computer screen.

Tray tips also grab the user’s attention without requiring user intervention.

Example of Tray Tip

;Feedback to user with TrayTips
 
Dim $Counter
Dim $Max
Dim $Pause
 
$Max = 10
$Pause = 1
 
For $Counter = 1 to $Max
	TrayTip("Status","Completed " & $Counter & " of " & $Max,$Pause)
	Sleep($Pause * 1000)
Next

Download this code: Feedback-TrayTip.au3

Conclusion

Keeping the user informed about what is happening on inside your program or script is important. These five ways that AutoIt has provided give you several options.

If you found this post useful, why don't you buy me a cup of coffee to show your gratitude?

Trackback link - http://www.dailycupoftech.com/providing-user-feedback-in-autoit/trackback/
Tim Fehlman

3 Responses to “Providing User Feedback In AutoIt”

  1. gseller_jim Says:

    These are great!! I was wondering though, can autoit make an executable that would setup a permanent drive map. Instead of a non-technical user mapping a drive, the executable file would setup a predefined mapped drive. That would be cool..
    Thanks
    Jim

  2. Daily Cup of Tech Says:

    Installing Ubuntu Desktop Part 3 Is Internet Explorer 7 Spying on Me? Linux from Scratch, The Saga Modify Every Computer on the Network Monitor Your Website With Google Alerts Multiple Computer Setup Perform MD5 Using AutoIt Providing User Feedback In AutoIt Recovering Your Lost Passwords Reducing the USB Threat Remote Control Mac From Windows Setting Up FTP Access in FreeNAS Spam Filter Busters Stop Applications From Running Stop Bleeding Personal Information

  3. Coder Says:

    Hi I’m having trouble on how to copy all items in a listbox to my listview. Can anyone tell me how I could do this?

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>