Jump to content

How do I make this script exit so there is no Autoit Icon in the tray when it's done?


Go to solution Solved by BrewManNH,

Recommended Posts

Hi

I am hoping one of you can help me with a slight problem I am having. How do I make this script exit when complete, so there is no Autoit Icon in the system tray?

#cs ----------------------------------------------------------------------------

 AutoIt Version: 3.3.8.1
 Author:         CZ

 Script Function:
    Install the Sage 50 Accounting 2013-Canadian Edition software.

#ce ----------------------------------------------------------------------------

$pid = ProcessExists("TSProgressUI.exe")
If $pid Then ProcessClose($pid)

If $CmdLine[0] = 1 And StringIsDigit($CmdLine[1]) Then Sleep($CmdLine[1] * 1000)
If $CmdLine[0] = 1 And $CmdLine[1] = "/?" Then
   MsgBox(32, @ScriptName, "Usage:  """ & @ScriptName & """ [start-in-#-of-seconds]" & _
                          @CRLF & @CRLF & "Example:  """ & @ScriptName & """ 30" _
   )
   Exit
EndIf

$setupLogFile = "C:\setupSA2013.log"
FileWriteLine($setupLogFile, "INFO:  Currently in:  " & @WorkingDir)

$setupFile = @ScriptDir & "\setup\setup.exe"
If Not FileExists($setupFile) Then
    $setupFileErrMsg = "ERROR:  " & $setupFile & " not found."
    FileWriteLine($setupLogFile, $setupFileErrMsg)
    MsgBox(32, @ScriptName, $setupFileErrMsg & @CRLF & @CRLF & "(log file in C:\)")
    Exit
EndIf
Run($setupFile)

WinWaitActive("Sage 50 Accounting 2013 - InstallShield Wizard", "Select a language")
Send("{ENTER}")
WinWaitActive("Installing Sage 50 Accounting 2013 Release 2...", "Type of installation")
Send("{ENTER}")
WinWaitActive("Installing Sage 50 Accounting 2013 Release 2...", "serial number")
Send("252P1U28415294{ENTER}")
WinWaitActive("Installing Sage 50 Premium Accounting 2013 Release 2...", "End User License Agreement")
Send("{TAB 3}{SPACE}")
Send("!i")
WinWaitActive("Installing Sage 50 Premium Accounting 2013 Release 2...", "Installation successful")
Send("!f")

WinWaitActive("Sage 50 - Registration", "Product Registration")
Send("{SPACE}") ; Activate Now

WinWaitActive("Sage 50 - Product Activation", "Company Name")
Send("XX{TAB 3}")   ; Registered company name
Send("XXXXXX-XXXXX-XXXXX{TAB}{DOWN}")   ; Account I.D.
Send("XXXXXXXXXXXXXXXXXXXXXX{ENTER}")    ; Registration Code

WinWaitActive("Sage 50 - Product Activation", "Activation Successful")
Send("{ENTER}")
Exit
Edited by clivebuckwheat
Link to comment
Share on other sites

every autoit script exits when done and the icon disappears. i guess you are caught in a winwaitactive command and the script is still waiting and not done.

E.

[color=rgb(255,0,0);][font="'comic sans ms', cursive;"]FukuLeaks[/color][/font]

Link to comment
Share on other sites

Hi,

Put #NoTrayIcon on top of your script, see if it's help.

.

really ? then he doesn't know if the script is running ! i wouldn't recommend that.

Edited by Edano

[color=rgb(255,0,0);][font="'comic sans ms', cursive;"]FukuLeaks[/color][/font]

Link to comment
Share on other sites

He can see on task manager whenever he want :D

.

nono, the autoit icon is important and indicates that the script is still running, that's his problem, not the icon itself. ;)

come on, don't do that to the  OP.

Edited by Edano

[color=rgb(255,0,0);][font="'comic sans ms', cursive;"]FukuLeaks[/color][/font]

Link to comment
Share on other sites

  • Solution

Until you get this script working, I'd add a MsgBox after every WinWaitActive that tells you which one just finished. Once you get to the point that it's hanging you can determine which of your WinWaitActives isn't working correctly and modify your script accordingly. After it's working correctly, you can remove the debugging MsgBoxs.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

The icon staying in the system tray is a common problem and I have read that it is a WIndows problem rather than an AutoIt problem, which doesn't explain why it only happens to me with AutoIt scripts. If I run a script and close it 7 times I will usually get 7 AutoIt icons showing for scripts which are no longer running. The only ways I know to get rid of them are as a script Valik wrote some years ago to move the mouse over the dead icons. For every movement one will be removed. Then repeat until all the dead icons are gone, or, more extreme, close explorer and start it again.

It certainly isn't true to say that if the icon shows then the script is still running.

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

From what I can tell, it is not the script exiting properly that is the issue, it DOES exit properly, but the tray icon just happens to stay in the system tray until the mouse is moved over it. Maybe you can use a #OnAutoitExitRegister function and hide the icon before exiting the process. That might do the trick.

Link to comment
Share on other sites

From what I can tell, it is not the script exiting properly that is the issue, it DOES exit properly, but the tray icon just happens to stay in the system tray until the mouse is moved over it. Maybe you can use a #OnAutoitExitRegister function and hide the icon before exiting the process. That might do the trick.

How can you possibly know that unless you've installed the software using this script?

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

 

How can you possibly know that unless you've installed the software using this script?

 

I am speaking in general. This has always been an issue for my scripts and with many other AutoIt scripts that I have seen. The issue is for sure not limited only to this case.

Link to comment
Share on other sites

When my scripts end correctly, the icon isn't in the tray any longer. If it is on your computer then it's probably your computer that's  causing it. So, I stand by what I said, how can you possibly know what you said was accurate without running the script and installing the software.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

 

From what I can tell, it is not the script exiting properly that is the issue, it DOES exit properly, but the tray icon just happens to stay in the system tray until the mouse is moved over it.

 

Should have been:

In other scripts, <the rest here>

 

So, I stand by what I said, how can you possibly know what you said was accurate without running the script and installing the software.

 

I do not know that. What I said was not accurate for this case. Apologies if I caused confusion.

Link to comment
Share on other sites

Yes indeed it was one of the WinWaitActive commands, I used the msgbox after each to figure out the issue. Now it  works perfectly with SCCM and reports back success now that the script exits properly. Thanks all for the suggestions I do appreciate all the responses and your time.

Link to comment
Share on other sites

Yes indeed it was one of the WinWaitActive commands, I used the msgbox after each to figure out the issue. Now it  works perfectly with SCCM and reports back success now that the script exits properly. Thanks all for the suggestions I do appreciate all the responses and your time.

.

as i said from the beginning. instead this thread was spoiled by useless side-topic discussions. >_<

[color=rgb(255,0,0);][font="'comic sans ms', cursive;"]FukuLeaks[/color][/font]

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...