surreal Posted September 3, 2008 Share Posted September 3, 2008 (edited) i cannot get the minimize and maximize to work at the same time as the installer script part. this script will or should if working install a bundle of software with progress bar. it also has a minimize button, with a maximize balloon tip. i cannot get them to functions to work at the same time, if i get one to work the other one does not. thank you very much for your help. CODE#include <Constants.au3> #include <GUIConstantsEx.au3> #include <ProgressConstants.au3> #include <WindowsConstants.au3> Opt('GUIEventOptions',1) Opt('TrayOnEventMode',1) Opt('TrayMenuMode',1) TraySetOnEvent($TRAY_EVENT_PRIMARYUP, 'FNC_MAXIMISE') $GUI_COMPANY = 'Company Name' $GUI_DISPLAY = 'Software Package' $GUI_VERSION = '8.0' $GUI_APP = 'ONE' $RUN = 1 $GUI_GUIWNDW = GUICreate($GUI_COMPANY, 365, 150, -1, -1, -1, $WS_EX_TOPMOST) $GUI_FNTNAME = 'Arial' GUISetBkColor(0xEEEEEE) GUISetFont(10, 800, 0, $GUI_FNTNAME) $GUI_LABEL = GUICtrlCreateLabel( $GUI_DISPLAY & ' ' & $GUI_VERSION, 10, 10, 345) GUISetFont(8.5, 800, 0, $GUI_FNTNAME) $GUI_GRAPHIC = GUICtrlCreateGraphic(10, 35, 345, 1) GUICtrlSetBkColor(-1, 0x999999) $GUI_SUB = GUICtrlCreateLabel('Installing ' & $GUI_APP & ', please wait...', 15, 45, 305) GUICtrlSetColor($GUI_SUB, 0X666666) GUISetFont(8, 400, 0, $GUI_FNTNAME) $GUI_STAT = GUICtrlCreateLabel('Status: Installing... - ', 25, 95, 109) GUICtrlSetColor($GUI_STAT, 0X666666) $GUI_PROGBAR = GUICtrlCreateProgress (10, 70, 345, 15,$PBS_SMOOTH) $GUI_BUTTON = GUICtrlCreateButton("Minimise to System Tray", 100, 117, 163, 25, 0) GUISetState(@SW_SHOW) While 1 $MSG = GUIGetMsg() Select Case $RUN = 1 $RUN = 0 Case $MSG = $GUI_EVENT_MINIMIZE FNC_MINIMISE() Case $MSG = $GUI_EVENT_CLOSE Exit Case $MSG = $GUI_BUTTON FNC_MINIMISE() EndSelect Wend Func FNC_MINIMISE() GuiSetState(@SW_MINIMIZE) GuiSetState(@SW_HIDE) TraySetState(1) If @OSVersion = 'WIN_NT4' or @OSVersion = 'WIN_ME' or @OSVersion = 'WIN_98' or @OSVersion = 'WIN_95' then TraySetToolTip ($GUI_DISPLAY & 'Click here to Restore') Else Traytip ($GUI_DISPLAY, 'Click here to Restore', 5) EndIf EndFunc $PROGRESSBARSTARTATZERO = GuiCtrlSetData ($GUI_PROGBAR, 0) $PERCENTAGE = 10 GuiCtrlSetData($GUI_PROGBAR, $PERCENTAGE) RunWait('silent_package_1.exe') $GUI_APP = 'ONE' $PERCENTAGE = $PERCENTAGE + 30 GuiCtrlSetData($GUI_PROGBAR, $PERCENTAGE) RunWait('silent_package_2.exe') $GUI_APP = 'TWO' $PERCENTAGE = $PERCENTAGE + 30 GuiCtrlSetData($GUI_PROGBAR, $PERCENTAGE) RunWait('silent_package_3.exe') $GUI_APP = 'THREE' $PERCENTAGE = $PERCENTAGE + 30 Func FNC_MAXIMISE() GuiSetState(@SW_RESTORE) GuiSetState(@SW_Show) TraySetState(2) EndFunc Edited September 3, 2008 by surreal Link to comment Share on other sites More sharing options...
martin Posted September 3, 2008 Share Posted September 3, 2008 i cannot get the minimize and maximize to work at the same time as the installer script part. this script will or should if working install a bundle of software with progress bar. it also has a minimize button, with a maximize balloon tip. i cannot get them to functions to work at the same time, if i get one to work the other one does not. thank you very much for your help. CODE#include <Constants.au3> #include <GUIConstantsEx.au3> #include <ProgressConstants.au3> #include <WindowsConstants.au3> Opt('GUIEventOptions',1) Opt('TrayOnEventMode',1) Opt('TrayMenuMode',1) TraySetOnEvent($TRAY_EVENT_PRIMARYUP, 'FNC_MAXIMISE') $GUI_COMPANY = 'Company Name' $GUI_DISPLAY = 'Software Package' $GUI_VERSION = '8.0' $GUI_APP = 'ONE' $RUN = 1 $GUI_GUIWNDW = GUICreate($GUI_COMPANY, 365, 150, -1, -1, -1, $WS_EX_TOPMOST) $GUI_FNTNAME = 'Arial' GUISetBkColor(0xEEEEEE) GUISetFont(10, 800, 0, $GUI_FNTNAME) $GUI_LABEL = GUICtrlCreateLabel( $GUI_DISPLAY & ' ' & $GUI_VERSION, 10, 10, 345) GUISetFont(8.5, 800, 0, $GUI_FNTNAME) $GUI_GRAPHIC = GUICtrlCreateGraphic(10, 35, 345, 1) GUICtrlSetBkColor(-1, 0x999999) $GUI_SUB = GUICtrlCreateLabel('Installing ' & $GUI_APP & ', please wait...', 15, 45, 305) GUICtrlSetColor($GUI_SUB, 0X666666) GUISetFont(8, 400, 0, $GUI_FNTNAME) $GUI_STAT = GUICtrlCreateLabel('Status: Installing... - ', 25, 95, 109) GUICtrlSetColor($GUI_STAT, 0X666666) $GUI_PROGBAR = GUICtrlCreateProgress (10, 70, 345, 15,$PBS_SMOOTH) $GUI_BUTTON = GUICtrlCreateButton("Minimise to System Tray", 100, 117, 163, 25, 0) GUISetState(@SW_SHOW) While 1 $MSG = GUIGetMsg() Select Case $RUN = 1 $RUN = 0 Case $MSG = $GUI_EVENT_MINIMIZE FNC_MINIMISE() Case $MSG = $GUI_EVENT_CLOSE Exit Case $MSG = $GUI_BUTTON FNC_MINIMISE() EndSelect Wend Func FNC_MINIMISE() GuiSetState(@SW_MINIMIZE) GuiSetState(@SW_HIDE) TraySetState(1) If @OSVersion = 'WIN_NT4' or @OSVersion = 'WIN_ME' or @OSVersion = 'WIN_98' or @OSVersion = 'WIN_95' then TraySetToolTip ($GUI_DISPLAY & 'Click here to Restore') Else Traytip ($GUI_DISPLAY, 'Click here to Restore', 5) EndIf EndFunc $PROGRESSBARSTARTATZERO = GuiCtrlSetData ($GUI_PROGBAR, 0) $PERCENTAGE = 10 GuiCtrlSetData($GUI_PROGBAR, $PERCENTAGE) RunWait('silent_package_1.exe') $GUI_APP = 'ONE' $PERCENTAGE = $PERCENTAGE + 30 GuiCtrlSetData($GUI_PROGBAR, $PERCENTAGE) RunWait('silent_package_2.exe') $GUI_APP = 'TWO' $PERCENTAGE = $PERCENTAGE + 30 GuiCtrlSetData($GUI_PROGBAR, $PERCENTAGE) RunWait('silent_package_3.exe') $GUI_APP = 'THREE' $PERCENTAGE = $PERCENTAGE + 30 Func FNC_MAXIMISE() GuiSetState(@SW_RESTORE) GuiSetState(@SW_Show) TraySetState(2) EndFunc Try this expandcollapse popup#include <Constants.au3> #include <GUIConstantsEx.au3> #include <ProgressConstants.au3> #include <WindowsConstants.au3> Opt('GUIEventOptions', 1) Opt('TrayOnEventMode', 1) Opt('TrayMenuMode', 1) Opt("guioneventmode",1);<-------------changed to on event mode TraySetOnEvent($TRAY_EVENT_PRIMARYUP, 'FNC_MAXIMISE') $GUI_COMPANY = 'Company Name' $GUI_DISPLAY = 'Software Package' $GUI_VERSION = '8.0' $GUI_APP = 'ONE' $GUI_GUIWNDW = GUICreate($GUI_COMPANY, 365, 150, -1, -1, -1, $WS_EX_TOPMOST) $GUI_FNTNAME = 'Arial' GUISetBkColor(0xEEEEEE) GUISetFont(10, 800, 0, $GUI_FNTNAME) $GUI_LABEL = GUICtrlCreateLabel($GUI_DISPLAY & ' ' & $GUI_VERSION, 10, 10, 345) GUISetFont(8.5, 800, 0, $GUI_FNTNAME) $GUI_GRAPHIC = GUICtrlCreateGraphic(10, 35, 345, 1) GUICtrlSetBkColor(-1, 0x999999) $GUI_SUB = GUICtrlCreateLabel('Installing ' & $GUI_APP & ', please wait...', 15, 45, 305) GUICtrlSetColor($GUI_SUB, 0X666666) GUISetFont(8, 400, 0, $GUI_FNTNAME) $GUI_STAT = GUICtrlCreateLabel('Status: Installing... - ', 25, 95, 109) GUICtrlSetColor($GUI_STAT, 0X666666) $GUI_PROGBAR = GUICtrlCreateProgress(10, 70, 345, 15, $PBS_SMOOTH) $GUI_BUTTON = GUICtrlCreateButton("Minimise to System Tray", 100, 117, 163, 25, 0) GUISetState(@SW_SHOW) GUISetOnEvent($GUI_EVENT_MINIMIZE,"FNC_MINIMISE") GUISetOnEvent($GUI_EVENT_CLOSE,"ExitNow") GUIctrlSetOnEvent($GUI_BUTTON,"FNC_MINIMISE") $PROGRESSBARSTARTATZERO = GUICtrlSetData($GUI_PROGBAR, 0) $PERCENTAGE = 10 GUICtrlSetData($GUI_PROGBAR, $PERCENTAGE) runwait("silent_package_1.exe") $GUI_APP = 'ONE' $PERCENTAGE = $PERCENTAGE + 30 GUICtrlSetData($GUI_PROGBAR, $PERCENTAGE) runwait("silent_package_2.exe") $GUI_APP = 'TWO' $PERCENTAGE = $PERCENTAGE + 30 GUICtrlSetData($GUI_PROGBAR, $PERCENTAGE) runwait("silent_package_3.exe") $GUI_APP = 'THREE' $PERCENTAGE = $PERCENTAGE + 30 Func FNC_MINIMISE() ConsoleWrite("minimizing" & @CRLF) GUISetState(@SW_MINIMIZE) GUISetState(@SW_HIDE) TraySetState(1) If @OSVersion = 'WIN_NT4' Or @OSVersion = 'WIN_ME' Or @OSVersion = 'WIN_98' Or @OSVersion = 'WIN_95' Then TraySetToolTip($GUI_DISPLAY & 'Click here to Restore') Else TrayTip($GUI_DISPLAY, 'Click here to Restore', 5) EndIf EndFunc ;==>FNC_MINIMISE Func FNC_MAXIMISE() GUISetState(@SW_RESTORE) GUISetState(@SW_SHOW) TraySetState(2) EndFunc ;==>FNC_MAXIMISE func ExitNow() Exit EndFunc 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 More sharing options...
surreal Posted September 3, 2008 Author Share Posted September 3, 2008 nice catch martin, and that was a real quick reply. thanks so much for your help. should i have the software install parts, setup as func as well? for future code error checking. at this time it does not seem to grab and change the $GUI_APP name. Link to comment Share on other sites More sharing options...
surreal Posted September 3, 2008 Author Share Posted September 3, 2008 (edited) alright i tried to correct the $GUI_APP problem, but im not sure what im doing wrong, and i also broke the progress bar function. i would like to replace the $GUI_APP & $GUI_APP_STAT to the program and action that is running at the time. below is the new script, and thank you very very much for the help... CODE#include <Constants.au3> #include <GUIConstantsEx.au3> #include <ProgressConstants.au3> #include <WindowsConstants.au3> Opt('GUIEventOptions', 1) Opt('TrayOnEventMode', 1) Opt('TrayMenuMode', 1) Opt("guioneventmode",1) TraySetOnEvent($TRAY_EVENT_PRIMARYUP, 'FNC_MAXIMISE') $GUI_COMPANY = 'Company Name' $GUI_DISPLAY = 'Software Name' $GUI_VERSION = '8.0' $GUI_APP = 'Package Name' $GUI_APP_STAT = 'Installing' $GUI_GUIWNDW = GUICreate($GUI_COMPANY, 365, 185, -1, -1, $WS_EX_TOPMOST) $GUI_FNTNAME = 'Arial' GUISetBkColor(0xEEEEEE) GUISetFont(10, 800, 0, $GUI_FNTNAME) $GUI_LABEL = GUICtrlCreateLabel($GUI_DISPLAY & ' ' & $GUI_VERSION, 10, 10, 345) GUISetFont(8.5, 800, 0, $GUI_FNTNAME) $GUI_GRAPHIC = GUICtrlCreateGraphic(10, 35, 345, 1) GUICtrlSetBkColor(-1, 0x999999) $GUI_SUB = GUICtrlCreateLabel($GUI_APP_STAT & ' ' & $GUI_APP & ', please wait...', 15, 45, 305) GUICtrlSetColor($GUI_SUB, 0X666666) GUISetFont(8, 400, 0, $GUI_FNTNAME) $GUI_STAT = GUICtrlCreateLabel('Status:' & ' ' & $GUI_APP_STAT & '... - ', 25, 95, 109) GUICtrlSetColor($GUI_STAT, 0X666666) $GUI_PROGBAR = GUICtrlCreateProgress(10, 70, 345, 15, $PBS_SMOOTH) $GUI_BUTTON = GUICtrlCreateButton("Minimise to System Tray", 100, 117, 163, 25, 0) GUISetState(@SW_SHOW) GUISetOnEvent($GUI_EVENT_MINIMIZE,"FNC_MINIMISE") GUISetOnEvent($GUI_EVENT_CLOSE,"ExitNow") GUIctrlSetOnEvent($GUI_BUTTON,"FNC_MINIMISE") $PKG_RUNCMND1 = RunWait('PACKAGE_1.exe /q') $PKG_RUNCMND2 = RunWait('PACKAGE_2.exe /q') $PKG_RUNCMND3 = RunWait('PACKAGE_3.exe /q') $PKG_RUNCMND4 = RunWait('PACKAGE_4.exe /q') $PKG_RUNCMND5 = RunWait('PACKAGE_5.exe /q') $PROGRESSBARSTARTATZERO = GUICtrlSetData($GUI_PROGBAR, 0) $PERCENTAGE = 5 Func PACKAGE_1($hWnd, $Msg, $wParam, $lParam) If ProcessExists($PKG_RUNCMND1) Then GUICtrlSetData($GUI_PROGBAR, $PERCENTAGE) $PERCENTAGE = $PERCENTAGE + 20 $GUI_APP = 'PACKAGE_1' $GUI_APP_STAT = 'Installing' EndIf EndFunc Func PACKAGE_2($hWnd, $Msg, $wParam, $lParam) If ProcessExists($PKG_RUNCMND2) Then GUICtrlSetData($GUI_PROGBAR, $PERCENTAGE) $PERCENTAGE = $PERCENTAGE + 20 $GUI_APP = 'PACKAGE_2' $GUI_APP_STAT = 'Uninstalling' EndIf EndFunc Func PACKAGE_3($hWnd, $Msg, $wParam, $lParam) If ProcessExists($PKG_RUNCMND3) Then GUICtrlSetData($GUI_PROGBAR, $PERCENTAGE) $PERCENTAGE = $PERCENTAGE + 20 $GUI_APP = 'PACKAGE_3' $GUI_APP_STAT = 'Installing' EndIf EndFunc Func PACKAGE_4($hWnd, $Msg, $wParam, $lParam) If ProcessExists($PKG_RUNCMND4) Then GUICtrlSetData($GUI_PROGBAR, $PERCENTAGE) $PERCENTAGE = $PERCENTAGE + 20 $GUI_APP = 'PACKAGE_4' $GUI_APP_STAT = 'Installing' EndIf EndFunc Func PACKAGE_5($hWnd, $Msg, $wParam, $lParam) If ProcessExists($PKG_RUNCMND5) Then GUICtrlSetData($GUI_PROGBAR, $PERCENTAGE) $PERCENTAGE = $PERCENTAGE + 20 $GUI_APP = 'PACKAGE_5' $GUI_APP_STAT = 'Installing' EndIf EndFunc Func FNC_MINIMISE() ConsoleWrite("minimizing" & @CRLF) GUISetState(@SW_MINIMIZE) GUISetState(@SW_HIDE) TraySetState(1) If @OSVersion = 'WIN_NT4' Or @OSVersion = 'WIN_ME' Or @OSVersion = 'WIN_98' Or @OSVersion = 'WIN_95' Then TraySetToolTip($GUI_DISPLAY & 'Double click icon in System Tray to Restore') Else TrayTip($GUI_DISPLAY, 'Double click icon in System Tray to Restore', 5) EndIf EndFunc Func FNC_MAXIMISE() GUISetState(@SW_RESTORE) GUISetState(@SW_SHOW) TraySetState(2) EndFunc func ExitNow() Exit EndFunc Edited September 3, 2008 by surreal Link to comment Share on other sites More sharing options...
surreal Posted September 4, 2008 Author Share Posted September 4, 2008 i have tried many things, searched this forum, and read the help file, i still cannot get this to work. if it would be easier to incorporate an ini file read for software and gui text input i would have nothing wrong with that, however my knowledge at this time is not high enough to fix it or incorporate an ini process. any help would be greatly appreciated. i will keep reading and trying, hopefully i can get up to par. thanks again in advance everyone for your help. Link to comment Share on other sites More sharing options...
surreal Posted September 4, 2008 Author Share Posted September 4, 2008 after some more and more research maybe an ini read is not the answer, if it is i have now clue on how to add this fuction. should i be using a case instead on a func within each package? thanks again. Link to comment Share on other sites More sharing options...
surreal Posted September 4, 2008 Author Share Posted September 4, 2008 (edited) i have made a few changes, if someone could let me know if im on the right track that would be great. thanks again for your help. CODE#include <Constants.au3> #include <GUIConstantsEx.au3> #include <ProgressConstants.au3> #include <WindowsConstants.au3> Opt('GUIEventOptions', 1) Opt('TrayOnEventMode', 1) Opt('TrayMenuMode', 1) Opt("guioneventmode",1) TraySetOnEvent($TRAY_EVENT_PRIMARYUP, 'FNC_MAXIMISE') $GUI_COMPANY = 'Company Name' $GUI_DISPLAY = 'Software Package' $GUI_VERSION = '8.0' $SUR = 0 If $SUR = 0 Then ;--------- i thought this would work, but i may be missing something $GUI_APP = "" ElseIf $SUR = 1 Then $GUI_APP = "Package1" ElseIf $SUR = 2 Then $GUI_APP = "Package2" ElseIf $SUR = 3 Then $GUI_APP = "Package3" EndIf $GUI_GUIWNDW = GUICreate($GUI_COMPANY, 365, 185, -1, -1, $WS_EX_TOPMOST) $GUI_FNTNAME = 'Arial' GUISetBkColor(0xEEEEEE) GUISetFont(10, 800, 0, $GUI_FNTNAME) $GUI_LABEL = GUICtrlCreateLabel($GUI_DISPLAY & ' ' & $GUI_VERSION, 10, 10, 345) GUISetFont(8.5, 800, 0, $GUI_FNTNAME) $GUI_GRAPHIC = GUICtrlCreateGraphic(10, 35, 345, 1) GUICtrlSetBkColor(-1, 0x999999) $GUI_SUB = GUICtrlCreateLabel('Installing ' & $GUI_APP & ', please wait...', 15, 45, 305) GUICtrlSetColor($GUI_SUB, 0X666666) GUISetFont(8, 400, 0, $GUI_FNTNAME) $GUI_STAT = GUICtrlCreateLabel('Status: Installing... - ', 25, 95, 109) GUICtrlSetColor($GUI_STAT, 0X666666) $GUI_PROGBAR = GUICtrlCreateProgress(10, 70, 345, 15, $PBS_SMOOTH) $GUI_BUTTON = GUICtrlCreateButton("Minimise to System Tray", 100, 117, 163, 25, 0) GUISetState(@SW_SHOW) GUISetOnEvent($GUI_EVENT_MINIMIZE,"FNC_MINIMISE") GUISetOnEvent($GUI_EVENT_CLOSE,"ExitNow") GUIctrlSetOnEvent($GUI_BUTTON,"FNC_MINIMISE") $PROGRESSBARSTARTATZERO = GUICtrlSetData($GUI_PROGBAR, 0) $PERCENTAGE = 5 GUICtrlSetData($GUI_PROGBAR, $PERCENTAGE) sleep(3000) ;-------------to simulate an install, will be replaced with software package $SUR = 1 ;------included this code $PERCENTAGE = $PERCENTAGE + 35 GUICtrlSetData($GUI_PROGBAR, $PERCENTAGE) sleep(3000) ;-------------to simulate an install, will be replaced with software package $SUR = 2 ;------included this code $PERCENTAGE = $PERCENTAGE + 35 GUICtrlSetData($GUI_PROGBAR, $PERCENTAGE) sleep(3000) ;-------------to simulate an install, will be replaced with software package $SUR = 3 ;------included this code $PERCENTAGE = $PERCENTAGE + 35 Func FNC_MINIMISE() ConsoleWrite("minimizing" & @CRLF) GUISetState(@SW_MINIMIZE) GUISetState(@SW_HIDE) TraySetState(1) If @OSVersion = 'WIN_NT4' Or @OSVersion = 'WIN_ME' Or @OSVersion = 'WIN_98' Or @OSVersion = 'WIN_95' Then TraySetToolTip($GUI_DISPLAY & 'Double click icon in System Tray to Restore') Else TrayTip($GUI_DISPLAY, 'Double click icon in System Tray to Restore', 5) EndIf EndFunc Func FNC_MAXIMISE() GUISetState(@SW_RESTORE) GUISetState(@SW_SHOW) TraySetState(2) EndFunc func ExitNow() Exit EndFunc Edited September 4, 2008 by surreal Link to comment Share on other sites More sharing options...
martin Posted September 4, 2008 Share Posted September 4, 2008 i have made a few changes, if someone could let me know if im on the right track that would be great. thanks again for your help. CODE#include <Constants.au3> #include <GUIConstantsEx.au3> #include <ProgressConstants.au3> #include <WindowsConstants.au3> Opt('GUIEventOptions', 1) Opt('TrayOnEventMode', 1) Opt('TrayMenuMode', 1) Opt("guioneventmode",1) TraySetOnEvent($TRAY_EVENT_PRIMARYUP, 'FNC_MAXIMISE') $GUI_COMPANY = 'Company Name' $GUI_DISPLAY = 'Software Package' $GUI_VERSION = '8.0' $SUR = 0 If $SUR = 0 Then ;--------- i thought this would work, but i may be missing something $GUI_APP = "" ElseIf $SUR = 1 Then $GUI_APP = "Package1" ElseIf $SUR = 2 Then $GUI_APP = "Package2" ElseIf $SUR = 3 Then $GUI_APP = "Package3" EndIf $GUI_GUIWNDW = GUICreate($GUI_COMPANY, 365, 185, -1, -1, $WS_EX_TOPMOST) $GUI_FNTNAME = 'Arial' GUISetBkColor(0xEEEEEE) GUISetFont(10, 800, 0, $GUI_FNTNAME) $GUI_LABEL = GUICtrlCreateLabel($GUI_DISPLAY & ' ' & $GUI_VERSION, 10, 10, 345) GUISetFont(8.5, 800, 0, $GUI_FNTNAME) $GUI_GRAPHIC = GUICtrlCreateGraphic(10, 35, 345, 1) GUICtrlSetBkColor(-1, 0x999999) $GUI_SUB = GUICtrlCreateLabel('Installing ' & $GUI_APP & ', please wait...', 15, 45, 305) GUICtrlSetColor($GUI_SUB, 0X666666) GUISetFont(8, 400, 0, $GUI_FNTNAME) $GUI_STAT = GUICtrlCreateLabel('Status: Installing... - ', 25, 95, 109) GUICtrlSetColor($GUI_STAT, 0X666666) $GUI_PROGBAR = GUICtrlCreateProgress(10, 70, 345, 15, $PBS_SMOOTH) $GUI_BUTTON = GUICtrlCreateButton("Minimise to System Tray", 100, 117, 163, 25, 0) GUISetState(@SW_SHOW) GUISetOnEvent($GUI_EVENT_MINIMIZE,"FNC_MINIMISE") GUISetOnEvent($GUI_EVENT_CLOSE,"ExitNow") GUIctrlSetOnEvent($GUI_BUTTON,"FNC_MINIMISE") $PROGRESSBARSTARTATZERO = GUICtrlSetData($GUI_PROGBAR, 0) $PERCENTAGE = 5 GUICtrlSetData($GUI_PROGBAR, $PERCENTAGE) sleep(3000) ;-------------to simulate an install, will be replaced with software package $SUR = 1 ;------included this code $PERCENTAGE = $PERCENTAGE + 35 GUICtrlSetData($GUI_PROGBAR, $PERCENTAGE) sleep(3000) ;-------------to simulate an install, will be replaced with software package $SUR = 2 ;------included this code $PERCENTAGE = $PERCENTAGE + 35 GUICtrlSetData($GUI_PROGBAR, $PERCENTAGE) sleep(3000) ;-------------to simulate an install, will be replaced with software package $SUR = 3 ;------included this code $PERCENTAGE = $PERCENTAGE + 35 Func FNC_MINIMISE() ConsoleWrite("minimizing" & @CRLF) GUISetState(@SW_MINIMIZE) GUISetState(@SW_HIDE) TraySetState(1) If @OSVersion = 'WIN_NT4' Or @OSVersion = 'WIN_ME' Or @OSVersion = 'WIN_98' Or @OSVersion = 'WIN_95' Then TraySetToolTip($GUI_DISPLAY & 'Double click icon in System Tray to Restore') Else TrayTip($GUI_DISPLAY, 'Double click icon in System Tray to Restore', 5) EndIf EndFunc Func FNC_MAXIMISE() GUISetState(@SW_RESTORE) GUISetState(@SW_SHOW) TraySetState(2) EndFunc func ExitNow() Exit EndFunc I made a guess at what that code was meant to do expandcollapse popup#include <Constants.au3> #include <GUIConstantsEx.au3> #include <ProgressConstants.au3> #include <WindowsConstants.au3> Opt('GUIEventOptions', 1) Opt('TrayOnEventMode', 1) Opt('TrayMenuMode', 1) Opt("guioneventmode", 1) TraySetOnEvent($TRAY_EVENT_PRIMARYUP, 'FNC_MAXIMISE') $GUI_COMPANY = 'Company Name' $GUI_DISPLAY = 'Software Package' $GUI_VERSION = '8.0' $SUR = 1 $GUI_GUIWNDW = GUICreate($GUI_COMPANY, 365, 185, -1, -1, $WS_EX_TOPMOST) $GUI_FNTNAME = 'Arial' GUISetBkColor(0xEEEEEE) GUISetFont(10, 800, 0, $GUI_FNTNAME) $GUI_LABEL = GUICtrlCreateLabel($GUI_DISPLAY & ' ' & $GUI_VERSION, 10, 10, 345) GUISetFont(8.5, 800, 0, $GUI_FNTNAME) $GUI_GRAPHIC = GUICtrlCreateGraphic(10, 35, 345, 1) GUICtrlSetBkColor(-1, 0x999999) $GUI_SUB = GUICtrlCreateLabel('Installing ' & $GUI_APP & ', please wait...', 15, 45, 305) GUICtrlSetColor($GUI_SUB, 0X666666) GUISetFont(8, 400, 0, $GUI_FNTNAME) $GUI_STAT = GUICtrlCreateLabel('Status: Installing... - ', 25, 95, 109) GUICtrlSetColor($GUI_STAT, 0X666666) $GUI_PROGBAR = GUICtrlCreateProgress(10, 70, 345, 15, $PBS_SMOOTH) $GUI_BUTTON = GUICtrlCreateButton("Minimise to System Tray", 100, 117, 163, 25, 0) GUISetState(@SW_SHOW) GUISetOnEvent($GUI_EVENT_MINIMIZE, "FNC_MINIMISE") GUISetOnEvent($GUI_EVENT_CLOSE, "ExitNow") GUICtrlSetOnEvent($GUI_BUTTON, "FNC_MINIMISE") $PROGRESSBARSTARTATZERO = GUICtrlSetData($GUI_PROGBAR, 0) $PERCENTAGE = 5 $GUI_APP = SetApp ($SUR) GUICtrlSetData($GUI_PROGBAR, $PERCENTAGE) Sleep(3000);-------------to simulate an install, will be replaced with software package $SUR = 1;------included this code $PERCENTAGE = $PERCENTAGE + 35 $GUI_APP = SetApp ($SUR) GUICtrlSetData($GUI_PROGBAR, $PERCENTAGE) Sleep(3000);-------------to simulate an install, will be replaced with software package $SUR = 2;------included this code $PERCENTAGE = $PERCENTAGE + 35 $GUI_APP = SetApp ($SUR) GUICtrlSetData($GUI_PROGBAR, $PERCENTAGE) Sleep(3000);-------------to simulate an install, will be replaced with software package $SUR = 3;------included this code $PERCENTAGE = $PERCENTAGE + 35 Func FNC_MINIMISE() ConsoleWrite("minimizing" & @CRLF) GUISetState(@SW_MINIMIZE) GUISetState(@SW_HIDE) TraySetState(1) If @OSVersion = 'WIN_NT4' Or @OSVersion = 'WIN_ME' Or @OSVersion = 'WIN_98' Or @OSVersion = 'WIN_95' Then TraySetToolTip($GUI_DISPLAY & 'Double click icon in System Tray to Restore') Else TrayTip($GUI_DISPLAY, 'Double click icon in System Tray to Restore', 5) EndIf EndFunc ;==>FNC_MINIMISE Func FNC_MAXIMISE() GUISetState(@SW_RESTORE) GUISetState(@SW_SHOW) TraySetState(2) EndFunc ;==>FNC_MAXIMISE Func ExitNow() Exit EndFunc ;==>ExitNow Func SetApppp($par) If $par = 0 Then Return "" ElseIf $par = 1 Then Return "Package1" ElseIf $par = 2 Then Return "Package2" ElseIf $par = 3 Then Return "Package3" EndIf EndFunc ;==>SetApppp 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 More sharing options...
surreal Posted September 4, 2008 Author Share Posted September 4, 2008 (edited) well, i got it to work, i dont think the way i did it is the best or cleanest way. any help would still be appreciated. either way this is now a work script that others can use, or can learn from. thanks again martin for your help. CODE#include <Constants.au3> #include <GUIConstantsEx.au3> #include <ProgressConstants.au3> #include <WindowsConstants.au3> Opt('GUIEventOptions', 1) Opt('TrayOnEventMode', 1) Opt('TrayMenuMode', 1) Opt("guioneventmode",1) TraySetOnEvent($TRAY_EVENT_PRIMARYUP, 'FNC_MAXIMISE') $GUI_COMPANY = 'Company Name' $GUI_DISPLAY = 'Package Name' $GUI_VERSION = 'Verison' $GUI_NOTE = 'Package Notes' $GUI_FNTNAME = 'Arial' $GUI_GUIWNDW = GUICreate($GUI_COMPANY, 370, 185, -1, -1, $WS_EX_TOPMOST) GUISetBkColor(0xEEEEEE) GUISetFont(10, 800, 0, $GUI_FNTNAME) $GUI_LABEL = GUICtrlCreateLabel($GUI_DISPLAY & ' ' & $GUI_VERSION, 10, 10, 345) $GUI_GRAPHIC = GUICtrlCreateGraphic(10, 35, 345, 1) GUISetFont(8, 400, 0, $GUI_FNTNAME) $GUI_STAT = GUICtrlCreateLabel($GUI_NOTE, 25, 90, 305) GUICtrlSetColor($GUI_STAT, 0X666666) $GUI_PROGBAR = GUICtrlCreateProgress(10, 65, 345, 15, $PBS_SMOOTH) $GUI_BUTTON = GUICtrlCreateButton("Minimise to System Tray", 102, 117, 150, 25, 0) GUISetState(@SW_SHOW) GUISetOnEvent($GUI_EVENT_MINIMIZE,"FNC_MINIMISE") GUISetOnEvent($GUI_EVENT_CLOSE,"ExitNow") GUIctrlSetOnEvent($GUI_BUTTON,"FNC_MINIMISE") $PROGRESSBARSTARTATZERO = GUICtrlSetData($GUI_PROGBAR, 0) $PERCENTAGE = 5 GUICtrlSetData($GUI_PROGBAR, $PERCENTAGE) GUISetFont(8.5, 800, 0, $GUI_FNTNAME) $GUI_SUB = GUICtrlCreateLabel('Status: Uninstalling PACKAGE-1', 20, 35, 305) GUICtrlSetColor($GUI_SUB, 0X666666) sleep(3000) ;--------------------------to simulate an install, will be replaced with runwait package name $PERCENTAGE = $PERCENTAGE + 35 GUICtrlSetData($GUI_PROGBAR, $PERCENTAGE) GUISetFont(8.5, 800, 0, $GUI_FNTNAME) $GUI_SUB = GUICtrlCreateLabel('Status: Installing PACKAGE-2', 20, 35, 305) GUICtrlSetColor($GUI_SUB, 0X666666) sleep(3000) ;--------------------------to simulate an install, will be replaced with runwait package name $PERCENTAGE = $PERCENTAGE + 35 GUICtrlSetData($GUI_PROGBAR, $PERCENTAGE) GUISetFont(8.5, 800, 0, $GUI_FNTNAME) $GUI_SUB = GUICtrlCreateLabel('Status: Installing PACKAGE-3', 20, 35, 305) GUICtrlSetColor($GUI_SUB, 0X666666) sleep(3000) ;--------------------------to simulate an install, will be replaced with runwait package name $PERCENTAGE = $PERCENTAGE + 35 Func FNC_MINIMISE() ConsoleWrite("minimizing" & @CRLF) GUISetState(@SW_MINIMIZE) GUISetState(@SW_HIDE) TraySetState(1) If @OSVersion = 'WIN_NT4' Or @OSVersion = 'WIN_ME' Or @OSVersion = 'WIN_98' Or @OSVersion = 'WIN_95' Then TraySetToolTip($GUI_DISPLAY & 'Double click icon in System Tray to Restore') Else TrayTip($GUI_DISPLAY, 'Double click icon in System Tray to Restore', 5) EndIf EndFunc Func FNC_MAXIMISE() GUISetState(@SW_RESTORE) GUISetState(@SW_SHOW) TraySetState(2) EndFunc func ExitNow() Exit EndFunc Edited September 4, 2008 by surreal 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