craigholohan Posted July 16, 2005 Posted July 16, 2005 Hi All, Stuck again, Please see screen shot, I would like to have the progress bar in the GUI to move from 0% to 100%, it should reach 100% once the script is complete. I would also like it to show a lable saying 0% - 10% - 20% etc ect. Is this possable and how do I do it? Thanks in advance, Craig expandcollapse popup; Script Start #include <GuiConstants.au3> #include <Array.au3> #include <Date.au3> ;AutoItSetOption ( "TrayIconHide", 1 ) Opt("GUIOnEventMode", 1) ; GUI ; === GuiCreate("FCPassword Tool Writer v3.0", 600, 520,-1,-1,-1,$LVS_SHOWSELALWAYS) GuiSetIcon("Icons\AppIcon.ico") ;;;$n1=GUICtrlCreateIcon (@windowsdir & "\cursors\horse.ani",-1, 20,200,32,32) ; PIC ; === GuiCtrlCreatePic("Icons\ZUDM.jpg",0,0, 160,76) ; GROUP Message ; ============= GuiCtrlCreateGroup("FC Password Tool Writer", 200 , 0 , 360, 0) GuiCtrlCreateLabel("This tool will help you create a new tool", 210, 20) GUICtrlCreateGroup ("",-99,-99,1,1) ;close group ; PROGRESS ; ======== GuiCtrlCreateLabel("Progress:", 5, 122) $progressbar1 = GUICtrlCreateProgress (60,120,500,20,$PBS_SMOOTH) ; INPUT ; ===== $IPAddress = GuiCtrlCreateInput("", 120, 170, 130, 20) GuiCtrlCreateLabel("IP-Address:", 5, 172) $FidUser = GuiCtrlCreateInput("", 120, 190, 130, 20) GuiCtrlCreateLabel("Fidelio User Name:", 5, 192) $FidPassword = GuiCtrlCreateInput("", 120, 210, 130, 20) GuiCtrlCreateLabel("Fidelio Password:", 5, 212) ; BUTTON ; ====== $button = GUICtrlCreateButton("Create Script", 280, 170, 100, 60, "") $buttonDone = GUICtrlCreateButton("Done/Exit", 400, 170, 100, 60, "") GUICtrlSetOnEvent($button, "button") GUISetState() GUICtrlSetOnEvent($buttonDone, "buttonDone") GUICtrlSetBkColor(-1,0x00ff00) WinSetOnTop ( "Date", "", 1 ) ; GUI MESSAGE LOOP ; ================ GUISetState() While 1 ; GUI Set Ctrl Read ; ================= $IPMessage = GUICtrlRead($IPAddress) $UserMessage = GUICtrlRead($FidUser) $PasswordMessage = GUICtrlRead($FidPassword) WEnd Func buttonDone() Exit EndFunc Func button() Run ("Notepad.exe") WinWaitActive("Untitled - Notepad") WinMove("Untitled -", "", 400, 260, 1, 1) ; Start of Script Writer ; ====================== Send ( "; ----------------------------------------------------------------------------{Enter}" , ) Send ( ";{Enter}" , ) Send ( "; Fidelio Password Changer 3.0.103 {Enter}" , ) Send ( "; Author: Craig Holohan <craigholohan@floatmail.com> {Enter}" , ) Send ( ";{Enter}" , ) Send ( "; Script Function:{Enter}" , ) Send ( "; This script changes the fidelio password for users.{Enter}" , ) Send ( ";{Enter}" , ) Send ( "; ----------------------------------------------------------------------------{Enter 2}" , ) Send ( "; Start of script proper{Enter}" , ) Send ( "; =============={Enter 3}" , ) Send ( "; Begin Splash{Enter}" , ) Send ( "SplashTextOn ( 'Fidelio update Utility', 'P L E A S E D O N O T T O U C H T H E K E Y B O A R D' & @LF & ' O R M O U S E D U R I N G T H E S C R I P T .', 500, 50 ){Enter}" , ) Send ( "Sleep ( 1 ){Enter 2}" , ) Send ( "; Info{Enter}" , ) Send ( "FileCopy ( '\\", ) Send ( $IPMessage & "\Programs\1FCUserPassword.exe' ,", ) Send ( " 'C:\Program Files\Fidelio Cruise\1FCUserPassword.exe'){ENTER}", ) Send ( "Sleep ( 100 ){Enter}" , ) Send ( "Run ( 'C:\Program Files\Fidelio Cruise\1FCUserPassword.exe' ){Enter}" , ) Send ( "Sleep ( 100 ){Enter}" , ) Send ( "Send ( ' " ,1 ) Send ( $UserMessage & "{TAB}')",1 ) Send ( "{Enter}" , ) Send ( "Send ( ' " ,1 ) Send ( $PasswordMessage & "{TAB}')",1 ) Send ( "{Enter}" , ) Send ( "Send ( '{ENTER 2}' )" , 1) Send ( "{Enter}" , ) Send ( "SplashOff ( ){Enter}" , ) Send ( "; End of script{Enter 2}" , ) Send ( "$__msgbox = MsgBox ( 0, 'Fidelio Update Utility', 'Thank you, Your Fidelio has now been updated and you can continue working on your computer.' ){Enter 2}" , ) Send ( "if NOT ( $__msgbox = 7 ) then{Enter}" , ) Send ( "endif ; IWantToQuit{Enter}" , ) ; Save File ; ========= Send ("!f") Send ("{DOWN 3}") Send ( "{Enter}") Send ( "C:\Fidelio_Password_Tool\0-PasswordTool.au3") Send ("{TAB 2}") Send ( "{Enter}") Send ("!f") Send ("{DOWN 6}") Send ( "{Enter}") ; Call EXE Converter ; ================== Run ( 'C:\Fidelio_Password_Tool\Aut2Exe.exe') Sleep (1000) Send ("{TAB}") Sleep (500) Send ( "{Enter}") Send ("C:\Fidelio_Password_Tool\0-PasswordTool.au3") Sleep (1000) Send ("{TAB 2}") Send ( "{Enter}") Send ("{TAB}") Sleep (1000) Send ( "{Enter}") Send ("C:\Fidelio_Password_Tool\0-PasswordTool.exe") Sleep (1000) Send ("{TAB 2}") Send ( "{Enter}") Send ("{TAB}") Sleep (1000) Send ( "{Enter}") Send ("C:\Fidelio_Password_Tool\Icons\FCPasswordTool.ico") Sleep (1000) Send ("{TAB 2}") Send ( "{Enter}") Sleep (1000) Send ("{TAB 3}") Send ( "{Enter}") Sleep (2000) Send ( "{Enter}") Sleep (1000) Send ("{ALT}") Send ("{DOWN 2}") Send ( "{Enter}") FileDelete("C:\Fidelio_Password_Tool\0-PasswordTool.au3") ; Copy Files to server ; ==================== Run("C:\WINNT\system32\cmd.exe", "", ) WinWaitActive("C:\WINNT\system32\cmd.exe") WinMove("C:\WINNT\system32\cmd.exe", "", 400, 260, 1, 1) Sleep (1000) Send ( "net use b: \\", ) Send ( $IPMessage & "\Programs") Send ( "{Enter}") Send ( "Del b:\0-PasswordTool.exe{Enter}") Send ( "Move C:\Fidelio_Password_Tool\0-PasswordTool.exe b:\{Enter}") Send ( 'nircmd.exe shortcut "b:\0-PasswordTool.exe" "b:\" "FCPassword Tool"{Enter}') Send ( "Exit{Enter}") ; Create Login Script ; =================== Run ("Notepad.exe") WinWaitActive("Untitled - Notepad") WinMove("Untitled -", "", -1000, -1000, 800, 600) Send ("::Copy FCPassword Tool to Programs >> FCruise{Enter}") Send ('if EXIST "C:\Documents and Settings\All Users\Start Menu\Programs\FCruise\FCPassword Tool.lnk" goto END{Enter}') Send ( 'Copy "\\', ) Send ( $IPMessage & '\Programs\FCPassword Tool.lnk" ') Send ('"C:\Documents and Settings\All Users\Start Menu\Programs\FCruise"{Enter}') Send (":END{Enter}") Send ("exit{Enter}") ; Save File Login Script ; ====================== FileDelete("C:\Fidelio_Password_Tool\Login Script.txt") Sleep (500) Send ("!f") Send ("{DOWN 3}") Send ( "{Enter}") Send ( "C:\Fidelio_Password_Tool\Login Script.txt") Send ("{TAB 2}") Send ( "{Enter}") Send ("!f") Send ("{DOWN 6}") Send ( "{Enter}") EndFunc
GaryFrost Posted July 16, 2005 Posted July 16, 2005 (edited) see below post. Edited July 16, 2005 by gafrost SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference.
craigholohan Posted July 16, 2005 Author Posted July 16, 2005 example of a progress bar with %, works with beta versioninclude file attached#include <GUIConstants.au3> #include "Progress.au3" GUICreate("My GUI Progressbar", 220, 100, 100, 200) _Progress_Create (10, 10, 200, 20); left,top,width,height $button = GUICtrlCreateButton("Start", 75, 70, 70, 20) GUISetState() $wait = 20; wait 20ms for next progressstep $s = 0; progressbar-saveposition Do $msg = GUIGetMsg() If $msg = $button Then GUICtrlSetData($button, "Stop") For $i = $s To 100 $m = GUIGetMsg() If $m = -3 Then ExitLoop If $m = $button Then GUICtrlSetData($button, "Next") $s = $i;save the current bar-position to $s ExitLoop Else $s = 0 _Progress_Update ($i) Sleep($wait) EndIf Next If $i > 100 Then GUICtrlSetData($button, "Start") EndIf EndIf Until $msg = $GUI_EVENT_CLOSE<{POST_SNAPBACK}>Hi Again gafrost,Thanks agian for the help, I did find something similar but included is what I am trying to get to. Only thing is I want it to run in my GUI and not open another window/GUI of its own.Any ideas?Cheers,CraigProgressOn("Progress Meter", "Increments every second", "0 percent") For $i = 10 to 100 step 10 sleep(1000) ProgressSet( $i, $i & " percent") Next ProgressSet(100 , "Done", "Complete") sleep(500) ProgressOff()
GaryFrost Posted July 16, 2005 Posted July 16, 2005 needs beta, the release version won't do the transparent label. expandcollapse popup; Script Start #include <GuiConstants.au3> #include <Array.au3> #include <Date.au3> ;AutoItSetOption ( "TrayIconHide", 1 ) Opt ("GUIOnEventMode", 1) Global $pb_progress1, $pb_plbl1 ; GUI ; === GUICreate("FCPassword Tool Writer v3.0", 600, 520, -1, -1, -1, $LVS_SHOWSELALWAYS) GUISetIcon("Icons\AppIcon.ico") ;;;$n1=GUICtrlCreateIcon (@windowsdir & "\cursors\horse.ani",-1, 20,200,32,32) ; PIC ; === GUICtrlCreatePic("Icons\ZUDM.jpg", 0, 0, 160, 76) ; GROUP Message ; ============= GUICtrlCreateGroup("FC Password Tool Writer", 200, 0, 360, 0) GUICtrlCreateLabel("This tool will help you create a new tool", 210, 20) GUICtrlCreateGroup("", -99, -99, 1, 1);close group ; PROGRESS ; ======== GUICtrlCreateLabel("Progress:", 5, 122) ;~ $progressbar1 = GUICtrlCreateProgress(60, 120, 500, 20, $PBS_SMOOTH) _Progress_Create(60,120,500,20) ; INPUT ; ===== $IPAddress = GUICtrlCreateInput("", 120, 170, 130, 20) GUICtrlCreateLabel("IP-Address:", 5, 172) $FidUser = GUICtrlCreateInput("", 120, 190, 130, 20) GUICtrlCreateLabel("Fidelio User Name:", 5, 192) $FidPassword = GUICtrlCreateInput("", 120, 210, 130, 20) GUICtrlCreateLabel("Fidelio Password:", 5, 212) ; BUTTON ; ====== $button = GUICtrlCreateButton("Create Script", 280, 170, 100, 60, "") $buttonDone = GUICtrlCreateButton("Done/Exit", 400, 170, 100, 60, "") GUICtrlSetOnEvent($button, "button") GUISetState() GUICtrlSetOnEvent($buttonDone, "buttonDone") GUICtrlSetBkColor(-1, 0x00ff00) WinSetOnTop("Date", "", 1) ; GUI MESSAGE LOOP ; ================ GUISetState() While 1 ; GUI Set Ctrl Read ; ================= $IPMessage = GUICtrlRead($IPAddress) $UserMessage = GUICtrlRead($FidUser) $PasswordMessage = GUICtrlRead($FidPassword) WEnd Func buttonDone() Exit EndFunc ;==>buttonDone Func button() Local $percent = 0 Run("Notepad.exe") WinWaitActive("Untitled - Notepad") WinMove("Untitled -", "", 400, 260, 1, 1) ; Start of Script Writer ; ====================== Send("; ----------------------------------------------------------------------------{Enter}") Send(";{Enter}") Send("; Fidelio Password Changer 3.0.103 {Enter}") Send("; Author: Craig Holohan <craigholohan@floatmail.com> {Enter}") Send(";{Enter}") Send("; Script Function:{Enter}") Send("; This script changes the fidelio password for users.{Enter}") Send(";{Enter}") $percent = 10 _Progress_Update($percent) Send("; ----------------------------------------------------------------------------{Enter 2}") Send("; Start of script proper{Enter}") Send("; =============={Enter 3}") Send("; Begin Splash{Enter}") Send("SplashTextOn ( 'Fidelio update Utility', 'P L E A S E D O N O T T O U C H T H E K E Y B O A R D' & @LF & ' O R M O U S E D U R I N G T H E S C R I P T .', 500, 50 ){Enter}") Send("Sleep ( 1 ){Enter 2}") Send("; Info{Enter}") Send("FileCopy ( '\\") $percent = 20 _Progress_Update($percent) Send($IPMessage & "\Programs\1FCUserPassword.exe' ,") Send(" 'C:\Program Files\Fidelio Cruise\1FCUserPassword.exe'){ENTER}") Send("Sleep ( 100 ){Enter}") Send("Run ( 'C:\Program Files\Fidelio Cruise\1FCUserPassword.exe' ){Enter}") Send("Sleep ( 100 ){Enter}") Send("Send ( ' ", 1) Send($UserMessage & "{TAB}')", 1) Send("{Enter}") Send("Send ( ' ", 1) $percent = 30 _Progress_Update($percent) Send($PasswordMessage & "{TAB}')", 1) Send("{Enter}") Send("Send ( '{ENTER 2}' )", 1) Send("{Enter}") Send("SplashOff ( ){Enter}") Send("; End of script{Enter 2}") Send("$__msgbox = MsgBox ( 0, 'Fidelio Update Utility', 'Thank you, Your Fidelio has now been updated and you can continue working on your computer.' ){Enter 2}") Send("if NOT ( $__msgbox = 7 ) then{Enter}") Send("endif ; IWantToQuit{Enter}") $percent = 40 _Progress_Update($percent) ; Save File ; ========= Send("!f") Send("{DOWN 3}") Send("{Enter}") Send("C:\Fidelio_Password_Tool\0-PasswordTool.au3") Send("{TAB 2}") Send("{Enter}") Send("!f") Send("{DOWN 6}") Send("{Enter}") $percent = 50 _Progress_Update($percent) ; Call EXE Converter ; ================== Run('C:\Fidelio_Password_Tool\Aut2Exe.exe') Sleep(1000) Send("{TAB}") Sleep(500) Send("{Enter}") Send("C:\Fidelio_Password_Tool\0-PasswordTool.au3") Sleep(1000) Send("{TAB 2}") Send("{Enter}") Send("{TAB}") Sleep(1000) Send("{Enter}") Send("C:\Fidelio_Password_Tool\0-PasswordTool.exe") Sleep(1000) Send("{TAB 2}") Send("{Enter}") Send("{TAB}") Sleep(1000) $percent = 60 _Progress_Update($percent) Send("{Enter}") Send("C:\Fidelio_Password_Tool\Icons\FCPasswordTool.ico") Sleep(1000) Send("{TAB 2}") Send("{Enter}") Sleep(1000) Send("{TAB 3}") Send("{Enter}") Sleep(2000) Send("{Enter}") Sleep(1000) Send("{ALT}") Send("{DOWN 2}") Send("{Enter}") FileDelete("C:\Fidelio_Password_Tool\0-PasswordTool.au3") $percent = 70 _Progress_Update($percent) ; Copy Files to server ; ==================== Run("C:\WINNT\system32\cmd.exe") WinWaitActive("C:\WINNT\system32\cmd.exe") WinMove("C:\WINNT\system32\cmd.exe", "", 400, 260, 1, 1) Sleep(1000) Send("net use b: \\") Send($IPMessage & "\Programs") Send("{Enter}") Send("Del b:\0-PasswordTool.exe{Enter}") Send("Move C:\Fidelio_Password_Tool\0-PasswordTool.exe b:\{Enter}") Send('nircmd.exe shortcut "b:\0-PasswordTool.exe" "b:\" "FCPassword Tool"{Enter}') Send("Exit{Enter}") $percent = 80 _Progress_Update($percent) ; Create Login Script ; =================== Run("Notepad.exe") WinWaitActive("Untitled - Notepad") WinMove("Untitled -", "", -1000, -1000, 800, 600) Send("::Copy FCPassword Tool to Programs >> FCruise{Enter}") Send('if EXIST "C:\Documents and Settings\All Users\Start Menu\Programs\FCruise\FCPassword Tool.lnk" goto END{Enter}') Send('Copy "\\') Send($IPMessage & '\Programs\FCPassword Tool.lnk" ') Send('"C:\Documents and Settings\All Users\Start Menu\Programs\FCruise"{Enter}') Send(":END{Enter}") Send("exit{Enter}") $percent = 90 _Progress_Update($percent) ; Save File Login Script ; ====================== FileDelete("C:\Fidelio_Password_Tool\Login Script.txt") Sleep(500) Send("!f") Send("{DOWN 3}") Send("{Enter}") Send("C:\Fidelio_Password_Tool\Login Script.txt") Send("{TAB 2}") Send("{Enter}") Send("!f") Send("{DOWN 6}") Send("{Enter}") $percent = 100 _Progress_Update($percent) EndFunc ;==>button Func _Progress_Create($i_x, $i_y, $i_width, $i_height) $pb_progress1 = GUICtrlCreateProgress($i_x, $i_y, $i_width, $i_height, $PBS_SMOOTH) GUICtrlSetColor(-1, 32250); not working with Windows XP Style $pb_plbl1 = GUICtrlCreateLabel("0%", ($i_width / 2) + ($i_x / 2), $i_y + 2, 35, $i_height - 4, -1, $WS_EX_TRANSPARENT) GUICtrlSetFont(-1, -1, 400) EndFunc ;==>_Progress_Create Func _Progress_Update($i_percent) GUICtrlSetData($pb_progress1, $i_percent) GUICtrlSetData($pb_plbl1, $i_percent & "%") EndFunc ;==>_Progress_Update SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference.
Lord_Doominik Posted July 16, 2005 Posted July 16, 2005 ahhm, can you please attach the include file again?
GaryFrost Posted July 16, 2005 Posted July 16, 2005 it's in the scripts and scrapes heres the link for the file itselfhttp://www.autoitscript.com/forum/index.ph...pe=post&id=3250 SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now