3mustgetbeers Posted August 7, 2010 Share Posted August 7, 2010 Hi Guys, I have createad a remote support tool and am just starting to make it pretty As the tool connects using uVNC it opens a GUI with a menu at the top, one of which is downloads - FireFox, CCleaner, mbam etc. Initially I was literally using autoit to automate keystrokes (e.g. Start>Run type mbam site, click downloa.... etc) however as I have read into autoit I came accross InetGet - which looks much better. What I want to do now is to add a progress bar to the GUI that is already there. Here is the complete code so far:: expandcollapse popup#include <GUIConstants.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include "constants.au3" $path = "C:\Program Files\Andys Little Tool\" Sleep(500) TrayTip("Connecting to Andy's PC", "Your desktop appearence may alter but will be restored at the end of this session", 10) ShellExecute($path & "winvnc.exe", "-autoreconnect -connect W.X.Y.Z:123 -run", $path) AutoItSetOption("TrayAutoPause", 0) AutoItSetOption("TrayIconHide", 0) Sleep(5000) $AndysLittleTool = GUICreate("Andys Little Tool!", 230, 150, 1030, 565) $Actions = GUICtrlCreateMenu("&Actions") $Ipconfig = GUICtrlCreateMenuItem("IPConfig", $Actions) $PrinterFix = GUICtrlCreateMenuItem("Printer Fix", $Actions) $TaskMgr = GUICtrlCreateMenuItem("Task Manager", $Actions) $IE = GUICtrlCreateMenuItem("IE no-addons", $Actions) $ControlPanel = GUICtrlCreateMenuItem("Control Panel", $Actions) $MyComputer = GUICtrlCreateMenuItem("My Computer", $Actions) $Desktop = GUICtrlCreateMenuItem("Desktop", $Actions) $Search = GUICtrlCreateMenuItem("Search", $Actions) $Downloads = GUICtrlCreateMenu("&Downloads") $Firefox = GUICtrlCreateMenuItem("Firefox", $Downloads) $CCleaner = GUICtrlCreateMenuItem("CCleaner", $Downloads) $Malwarebytes = GUICtrlCreateMenuItem("Malwarebytes", $Downloads) $Spybot = GUICtrlCreateMenuItem("Spybot", $Downloads) $AVG = GUICtrlCreateMenuItem("AVG", $Downloads) $Crucial = GUICtrlCreateMenuItem("Crucial Scan", $Downloads) $Belarc = GUICtrlCreateMenuItem("Belarc", $Downloads) $Shutdown = GUICtrlCreateMenu("&Shutdown") $LogOff = GUICtrlCreateMenuItem("Log Off", $Shutdown) $Restart = GUICtrlCreateMenuItem("Restart", $Shutdown) $RestartReCon = GUICtrlCreateMenuItem("Restart and Reconnect", $Shutdown) $Shutdown = GUICtrlCreateMenuItem("Shutdown", $Shutdown) $Title = GUICtrlCreateLabel("Andys Little Tool©", 46, 8, 185, 27) GUICtrlSetFont(-1, 14, 800, 0, "Calibri") $Copyright = GUICtrlCreateLabel("Designed and Implemented by Andy Lee.", 5, 40, 235, 19) GUICtrlSetFont(-1, 10, 400, 0, "Calibri") $Rights = GUICtrlCreateLabel("All Rights Reserved", 60, 55, 185, 19) GUICtrlSetFont(-1, 10, 400, 0, "Calibri") $reconnect = GUICtrlCreateButton("Reconnet", 34, 80, 75, 25) $Disconnect = GUICtrlCreateButton("Disconnect", 122, 80, 75, 25) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE If FileExists (@StartupCommonDir & "\Andys Little Tool.lnk") Then FileDelete (@StartupCommonDir & "\Andys Little Tool.lnk") EndIf if ProcessExists("winvnc.exe") Then ProcessClose ("winvnc.exe") EndIf If ProcessExists("Andys_Tool.exe") Then ProcessClose ("Andys_Tool.exe") EndIf Exit ;~~~~~~~The following are all in the Actions Menu~~~~~~ Case $Ipconfig Run(@ComSpec & " /k " & "ipconfig /all", @SystemDir, @SW_SHOW) Case $PrinterFix Run(@ComSpec & " /c " & "net stop spooler", @SystemDir, @SW_SHOW) Sleep(3000) Run(@ComSpec & " /c " & "del /s /q C:\Windows\System32\spool\PRINTERS\*.*", @SystemDir, @SW_SHOW) Sleep(300) Run(@ComSpec & " /c " & "net start spooler", @SystemDir, @SW_SHOW) Case $TaskMgr Run("taskmgr.exe") Case $IE Run("C:\Program Files\Internet Explorer\iexplore.exe -extoff") Case $ControlPanel Send("#r") WinWaitActive("Run","") Send("Control{ENTER}") Case $MyComputer Send("#e") Case $Desktop Send("#d") Case $Search Send("#f") ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ;~~~~~~~The following are all in the Downloads Menu~~~~~~ Case $Firefox If Not FileExists (@ProgramFilesDir & "\Mozilla Firefox\firefox.exe") Then Local $hFirefox = InetGet("http://download.mozilla.org/?product=firefox-3.6.8&os=win&lang=en-GB", "C:\Firefox.exe", 1, 1) do sleep(500) Until InetGetInfo($hFirefox, 2) InetClose($hFirefox) FileMove("C:\Firefox.exe",$path & "\Tools\Firefox.exe", 9) sleep(100) ShellExecute($path & "\Tools\Firefox.exe") Else MsgBox(4096, "Notification", "Mozilla Firefox is already installed on this computer" & @CRLF & @CRLF & "Please check 'C:\Program Files\Mozilla Firefox'",5) EndIf Case $CCleaner If FileExists (@ProgramFilesDir & "\CCleaner\CCleaner.exe") Then Local $hCCleaner = InetGet("http://download.piriform.com/ccsetup232.exe", "C:\CCleaner.exe", 1, 1) do sleep(500) Until InetGetInfo($hCCleaner, 2) InetClose($hCCleaner) FileMove("C:\CCleaner.exe",$path & "\Tools\CCleaner.exe", 9) sleep(100) ShellExecute($path & "\Tools\CCleaner.exe") endif Case $Malwarebytes Send("#r") Sleep(500) Send("http://download.cnet.com/3001-8022_4-10804572.html?spi=176dfe0ecd02fdc7ad1ac6e08f7ec44b&part=dl-10804572") Send("{ENTER}") Case $Spybot Send("#r") Sleep(500) Send("http://www.spybotupdates.com/files/spybotsd162.exe") Send("{ENTER}") Case $AVG Send("#r") Sleep(500) Send("http://download.cnet.com/3001-2239_4-10320142.html?spi=da43e7f03de2b32aafb88ffc4b8981ff") Send("{ENTER}") Case $Crucial Send("#r") Sleep(500) Send("http://www.crucial.com/uk/systemscanner/index.aspx") Send("{ENTER}") Case $Belarc Send("#r") Sleep(500) Send("http://www.belarc.com/Programs/advisor.exe") Send("{ENTER}") ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ;~~~~~~~The following are all in the Shutdown Menu~~~~~~ Case $LogOff Run("cmd.exe") sleep(500) send("shutdown /l /f{ENTER}") Case $Restart Run("cmd.exe") sleep(500) send("shutdown /r /t 10{ENTER}") If FileExists (@StartupCommonDir & "\Andys Little Tool.lnk") Then FileDelete (@StartupCommonDir & "\Andys Little Tool.lnk") EndIf Case $RestartReCon FileCreateShortcut($path & "Andys_Tool.exe",@StartupCommonDir & "\Andys Little Tool.lnk") Sleep(250) Run("cmd.exe") sleep(500) send("shutdown /r /t 0{ENTER}") Case $Shutdown Run("cmd.exe") sleep(500) send("shutdown /s /t0 /f{ENTER}") ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ;~~~~~~~The following are the Buttons~~~~~~ Case $reconnect ShellExecute($path & "winvnc.exe", "-autoreconnect -connect andyspc.mine.nu:443", $path) Case $Disconnect Run($path & "winvnc.exe -kill") Run(@ComSpec & " /c taskkill /F /PID aero_disable.exe /T", @SystemDir, @SW_HIDE) GUIDelete($AndysLittleTool) DirRemove($path) If FileExists (@StartupCommonDir & "\Andys Little Tool.lnk") Then FileDelete (@StartupCommonDir & "\Andys Little Tool.lnk") EndIf MsgBox(4096, "Disconnecting...", "Thanks for trying My Little Tool. Press OK to Exit", 10) WinWaitActive("Disonnecting...") if ProcessExists("winvnc.exe") Then ProcessClose ("winvnc.exe") EndIf If ProcessExists("Andys_Tool.exe") Then ProcessClose ("Andys_Tool.exe") EndIf EndSwitch WEnd Exit Thats just to put the following into context: Case $Firefox If Not FileExists (@ProgramFilesDir & "\Mozilla Firefox\firefox.exe") Then Local $hFirefox = InetGet("http://download.mozilla.org/?product=firefox-3.6.8&os=win&lang=en-GB", "C:\Firefox.exe", 1, 1) do sleep(500) Until InetGetInfo($hFirefox, 2) InetClose($hFirefox) FileMove("C:\Firefox.exe",$path & "\Tools\Firefox.exe", 9) sleep(100) ShellExecute($path & "\Tools\Firefox.exe") Else MsgBox(4096, "Notification", "Mozilla Firefox is already installed on this computer" & @CRLF & @CRLF & "Please check 'C:\Program Files\Mozilla Firefox'",5) EndIf What I want to do is have this download - which does work - but to show a progress bar on the exisiting GUI. I have read the help file and understand the concept of ProgressOn, Set and Off however I just don't understand how I would embed this on to an exisiting GUI??? Thanks for all and any replies - even if its just a url to a helpfull site! Andy Link to comment Share on other sites More sharing options...
somdcomputerguy Posted August 7, 2010 Share Posted August 7, 2010 (edited) Maybe a link in here will help. oh hell, I can't get the link to paste in correctly, just search on download and progress bar. Edited August 7, 2010 by somdcomputerguy - Bruce /*somdcomputerguy */ If you change the way you look at things, the things you look at change. Link to comment Share on other sites More sharing options...
3mustgetbeers Posted August 7, 2010 Author Share Posted August 7, 2010 somdcomputerguy As conveyed in the original post, not quite sure what it all means matey!! However battled through and it is now working; here is the FF script I have now: Case $Firefox If Not FileExists (@ProgramFilesDir & "\Mozilla Firefox\firefox.exe") Then $Progress_Bar = GUICtrlCreateProgress(12,105,207,12) $Status = GUICtrlCreateLabel("Downloading Mozilla Firefox", 12, 86, 185, 19) GUICtrlSetFont(-1,9,800,2,"calibri") $FileSize = InetGetSize("http://download.mozilla.org/?product=firefox-3.6.8&os=win&lang=en-GB") Local $hFirefox = InetGet("http://download.mozilla.org/?product=firefox-3.6.8&os=win&lang=en-GB", "C:\Firefox.exe", 1, 1) do $BytesDownloaded = INetGetInfo($hFirefox, 0) $SoFar = Floor(($BytesDownloaded / $FileSize) * 100) GUICtrlSetData($Progress_Bar, $SoFar) Until InetGetInfo($hFirefox, 2) InetClose($hFirefox) FileMove("C:\Firefox.exe",$path & "\Tools\Firefox.exe", 9) sleep(100) ShellExecute($path & "\Tools\Firefox.exe") Else MsgBox(4096, "Notification", "Mozilla Firefox is already installed on this computer" & @CRLF & @CRLF & "Please check 'C:\Program Files\Mozilla Firefox'",5) EndIf cheers! Link to comment Share on other sites More sharing options...
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