Jump to content

how to make labels appear or disappear


madmorgan
 Share

Recommended Posts

Hello all,

im new to auto it ive been using it for a few weeks now and i have found i love it. sad to say lol. but i need help i have faily made a very simple GUI with a button and a few labels. what i want to do is add a proguress bar to the gui.

GUI window shows list of software to install i want the process bar to move once each app has installed but i also want a big tick image to appear next to each app that has been just installed.

i know im probely asking to much but it would be grate if this could be done.

ps i have all the files in the same folder as the script and the tick icon.

thanks for your help. i look forward to your help.

Edited by madmorgan
Link to comment
Share on other sites

Hello all,

im new to auto it ive been using it for a few weeks now and i have found i love it. sad to say lol. but i need help i have faily made a very simple GUI with a button and a few labels. what i want to do is add a proguress bar to the gui.

GUI window shows list of software to install i want the process bar to move once each app has installed but i also want a big tick image to appear next to each app that has been just installed.

i know im probely asking to much but it would be grate if this could be done.

ps i have all the files in the same folder as the script and the tick icon.

thanks for your help. i look forward to your help.

Welcome to the AutoIt forums madmorgan :)

You can create the icon with GuiCtrlCreateIcon, and you can show or hide it with GuiCtrlSetState. Read up about them in the help (and then read some more, especially the contents which would have let you find these things yourself.)

If you have any problems then post the code you're stuck with and you'll soon get help. But to learn you need to struggle before you ask for help IMO.

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

here is what im trying to get done. this is the code of the menu and i dont know how to make the process bar to work or even how to make the green tick appear on and off at the give time when the software has installed.

#include <ButtonConstants.au3>

#include <GUIConstantsEx.au3>

#include <ProgressConstants.au3>

#include <StaticConstants.au3>

#include <WindowsConstants.au3>

$app = ("avg9")

$app1 = ("ashampoo")

$app2 = ("ECT...")

#Region ### START Koda GUI section ### Form=

$Form1 = GUICreate("Form1", 222, 252, 210, 122)

$Label1 = GUICtrlCreateLabel("Software Installer", 48, 8, 146, 24)

GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")

$Label2 = GUICtrlCreateLabel("AVG 9", 16, 56, 35, 17)

$Label3 = GUICtrlCreateLabel("Ashampoo Buring Studio 9", 16, 88, 129, 17)

$Pic1 = GUICtrlCreatePic("C:\Documents and Settings\Susan\Local Settings\Temporary Internet Files\Content.IE5\EV1DD0K8\Green%20Tick[1].jpg", 64, 40, 36, 36, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))

GUICtrlSetState(-1, $GUI_HIDE)

$Pic2 = GUICtrlCreatePic("C:\Documents and Settings\Susan\Local Settings\Temporary Internet Files\Content.IE5\EV1DD0K8\Green%20Tick[1].jpg", 160, 72, 36, 36, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))

GUICtrlSetState(-1, $GUI_HIDE)

$Button1 = GUICtrlCreateButton("Install", 16, 192, 75, 25, $WS_GROUP)

$Button2 = GUICtrlCreateButton("Exit", 120, 192, 75, 25, $WS_GROUP)

$Progress1 = GUICtrlCreateProgress(40, 152, 150, 17)

GUISetState(@SW_SHOW)

#EndRegion ### END Koda GUI section ###

While 1

$nMsg = GUIGetMsg()

Switch $nMsg

Case $GUI_EVENT_CLOSE

Exit

case $Button2

Exit

Case $Button1

install apps and update process bar and make green tick show after each app.

EndSwitch

WEnd

hop some one can look at this code and fill in the missing gaps.

thanks.

Link to comment
Share on other sites

here is what im trying to get done. this is the code of the menu and i dont know how to make the process bar to work or even how to make the green tick appear on and off at the give time when the software has installed.

#include <ButtonConstants.au3>

#include <GUIConstantsEx.au3>

#include <ProgressConstants.au3>

#include <StaticConstants.au3>

#include <WindowsConstants.au3>

$app = ("avg9")

$app1 = ("ashampoo")

$app2 = ("ECT...")

#Region ### START Koda GUI section ### Form=

$Form1 = GUICreate("Form1", 222, 252, 210, 122)

$Label1 = GUICtrlCreateLabel("Software Installer", 48, 8, 146, 24)

GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")

$Label2 = GUICtrlCreateLabel("AVG 9", 16, 56, 35, 17)

$Label3 = GUICtrlCreateLabel("Ashampoo Buring Studio 9", 16, 88, 129, 17)

$Pic1 = GUICtrlCreatePic("C:\Documents and Settings\Susan\Local Settings\Temporary Internet Files\Content.IE5\EV1DD0K8\Green%20Tick[1].jpg", 64, 40, 36, 36, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))

GUICtrlSetState(-1, $GUI_HIDE)

$Pic2 = GUICtrlCreatePic("C:\Documents and Settings\Susan\Local Settings\Temporary Internet Files\Content.IE5\EV1DD0K8\Green%20Tick[1].jpg", 160, 72, 36, 36, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))

GUICtrlSetState(-1, $GUI_HIDE)

$Button1 = GUICtrlCreateButton("Install", 16, 192, 75, 25, $WS_GROUP)

$Button2 = GUICtrlCreateButton("Exit", 120, 192, 75, 25, $WS_GROUP)

$Progress1 = GUICtrlCreateProgress(40, 152, 150, 17)

GUISetState(@SW_SHOW)

#EndRegion ### END Koda GUI section ###

While 1

$nMsg = GUIGetMsg()

Switch $nMsg

Case $GUI_EVENT_CLOSE

Exit

case $Button2

Exit

Case $Button1

install apps and update process bar and make green tick show after each app.

EndSwitch

WEnd

hop some one can look at this code and fill in the missing gaps.

thanks.

This sort of thing would do what you want

Case $Button1
            $NumberofApps = 2
            $AppsInstalled = 0
            guictrlsetstate($Button1,$GUI_DISABLE)
            RunWait($fullpathToAVGexe)
            $AppsInstalled += 1
            GUICtrlSetState($Pic1,$GUI_SHOW)
            GUICtrlSetData($Progress1,100*$AppsInstalled/$NumberofApps)
;next app etc

But it's a bit long winded. It would be better to have the app information in an array so that you could loop through them all in a few lines. Then when you have to add another app you only need to add the extra info to the array and there is no extra code to write.

It is easier to read code in a post if you enclose it in tags; either [aito it]..[/auto it] or [c ode]..[/c ode] but without the space I added to stop the tags working.

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

thanks for the help but there is still a probelm.

the process bar now works grate but the image i want to appear dos not show up when app has installed.

can some on look over my code again and see were the probel is.

[auto it]

#include <ButtonConstants.au3>

#include <GUIConstantsEx.au3>

#include <ProgressConstants.au3>

#include <StaticConstants.au3>

#include <WindowsConstants.au3>

$app = ("avg9")

$app1 = ("ashampoo")

$app2 = ("ECT...")

#Region ### START Koda GUI section ### Form=

$Form1 = GUICreate("Form1", 222, 252, 210, 122)

$Label1 = GUICtrlCreateLabel("Software Installer", 48, 8, 146, 24)

GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")

$Label2 = GUICtrlCreateLabel("AVG 9", 16, 56, 35, 17)

$Label3 = GUICtrlCreateLabel("Ashampoo Buring Studio 9", 16, 88, 129, 17)

$Pic1 = GUICtrlCreatePic("http://www.australiangamer.com/images/stuff/Green_0020_Tick.jpg", 64, 40, 36, 36, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))

GUICtrlSetState(-1, $GUI_HIDE)

$Pic2 = GUICtrlCreatePic("http://www.australiangamer.com/images/stuff/Green_0020_Tick.jpg", 160, 72, 36, 36, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))

GUICtrlSetState(-1, $GUI_HIDE)

$Button1 = GUICtrlCreateButton("Install", 16, 192, 75, 25, $WS_GROUP)

$Button2 = GUICtrlCreateButton("Exit", 120, 192, 75, 25, $WS_GROUP)

$Progress1 = GUICtrlCreateProgress(40, 152, 150, 17)

GUISetState(@SW_SHOW)

#EndRegion ### END Koda GUI section ###

While 1

$nMsg = GUIGetMsg()

Switch $nMsg

Case $GUI_EVENT_CLOSE

Exit

case $Button2

Exit

Case $Button1

$NumberofApps = 1

$AppsInstalled = 0

guictrlsetstate($Button1,$GUI_DISABLE)

RunWait("notepad.exe")

$AppsInstalled += 1

GUICtrlSetState($Pic1,$GUI_SHOW)

GUICtrlSetData($Progress1,100*$AppsInstalled/$NumberofApps)

EndSwitch

WEnd

[/auto it]

Link to comment
Share on other sites

hello all again just to let you all know the code from Martin dos work it was my failt i forgot to put the image in the right folder.

So thanks to Martin i got my program to work grate.

That's good.

BTW, you missed the last part of this line

It is easier to read code in a post if you enclose it in tags; either [aito it]..[/auto it] or [c ode]..[/c ode] but without the space I added to stop the tags working.

That is, I put a space in so that you would be able to see what I wrote, but you need to leave the space out.
Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
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...