Jump to content

Close to System Tray


grimmlock
 Share

Recommended Posts

I have been looking at many forums and have not found a way, that works for me, to have the app that I working on, close to the Task Bar instead of the minimizing (_) or closing by pressing the close button (Red X).

After doing some long searches I found this script which seems to work as a stand alone, however I would like some help on either incorporating it into my existing script or create a new piece my script to accomplish the same thing.

[/color][/font]
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <Constants.au3>
#include <GUIConstantsEx.au3>
#include <GUIListBox.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>

_main()
Func _Main()
Local $sUsername = @UserName ; User Name
Local $sComputername = @ComputerName ; Computer Name
Local $sText1 = ""; Output text for message box.
Local $sText2 = ""; Output text for message box.
Local $combo1 = ""; Output text for combo box.
Local Const $sDomain = 'domain.com'
Local Const $sServer = "email" & '.' & $sDomain
Local Const $sSupportEmail = "helpdesk" & '@' & $sDomain
ClipPut($sServer)
$sText1 = "Username = " & $sUsername & @CRLF ; The & character concentrates (joins) two values together.
$sText2 = "Computer Name = " & $sComputername & @CRLF ; The &= adds to the variable. The same as doing $var = $var & "extra stuff"

Local $hMainwindow = GUICreate("HelpDesk App", 300, 600)
GUICtrlCreateLabel("Helpdesk App", 30, 10, 290, 40)
GUICtrlSetFont(-1, 20, 800); bold

GUICtrlCreateLabel($sText1, 25, 60)
GUICtrlCreateLabel($sText2, 25, 78)
;$resetbutton = GUICtrlCreateButton("Reset", 115, 565, 80) *Commented Out; Would like to learn how to create a form and clear the data
Local $hOkButton = GUICtrlCreateButton("&Send", 200, 565, 80)

;GUICtrlSetOnEvent($resetbutton, "RESETButton") *Commented Out: Would really like to have a button to reset all fields.
GUISetState()

; _AddHorzSep(10, 40, 290)
_AddHorzSep(10, 105, 280)
_AddHorzSep(10, 210, 280)




GUICtrlCreateLabel("*Please provide the above information when you contact the Help Desk for any hardware or software problems.", 20, 120, 250, 50)
GUICtrlCreateLabel("Helpdesk #: (555) 555-5555", 85, 173)
GUICtrlCreateLabel("&Helpdesk Email:", 70, 188)
$hEmail = GUICtrlCreateLabel($sSupportEmail, 148, 188);helpdesk@domain.com"
GUICtrlSetFont($hEmail, 8.5, -1, 4) ; underlined
GUICtrlSetColor($hEmail, 0x0000ff)
GUICtrlSetCursor($hEmail, 0)



GUICtrlCreateLabel("Helpdesk Request Form", 30, 220, 270, 50)
GUICtrlSetFont(-1, 15, 800); bold

GUICtrlCreateLabel("&Request Type:", 25, 273, 75)
local $hCombo=GUICtrlCreateCombo("", 100, 270, 160) ; create first item
GUICtrlSetData(-1, "Keyboard/Mouse|Monitor|Other|EbscoHost|OneClick Digital|OverDrive|Project Gutenberg|Tumblebooks|General|Firefox|Google Chrome|Website Announcements|Board Web Posting|General Web Postings|Home Page Web Postings|HR Web Postings|Login Trouble|HVAC|Web Filtering|J Drive Permissions|Polaris Permissions|Phones|Polaris Client|OPAC|Patron Accounts|Printers|Self-Checks|Adobe Flash|Adobe Reader|Adobe Sockwave Player|Envisionware LPTOne|Envisionware PCRes|MS Office|Other Software|SharePoint|Springbrook|TimeClock|Windows 7|Windows XP", "Keyboard/Mouse") ; add other item snd set a new default

GUICtrlCreateLabel("&Subject:", 25, 303, 75)
local $hInputText = GUICtrlCreateInput("", 100, 300, 160)

GUICtrlCreateLabel("&Details:", 25, 330, 75)
local $hInputText2 = GUICtrlCreateInput("", 25, 345, 235, 200)

While 1
Switch GUIGetMsg()
Case $hOkButton
$msg = "Subject: " & GUICtrlRead($hInputText) & @CRLF & @CRLF & "Details: " & GUICtrlRead($hInputText2) & @CRLF & @CRLF & "" & $sText1 & $sText2 & _wmigetcompinfo()

OKButton($sServer, $sUsername, $sUsername & '@' & $sDomain, $sSupportEmail, "Issue: "&GUICtrlRead($hCombo), $msg)


Case $hEmail
OnEmail($sSupportEmail)
Case $GUI_EVENT_CLOSE
Exit

;~ Send()
EndSwitch
WEnd

EndFunc ;==>_Main



Func _AddHorzSep($iX, $iY, $iW)

GUICtrlCreateLabel("", $iX, $iY, $iW, 1)
GUICtrlSetBkColor(-1, 0x000000)


EndFunc ;==>_AddHorzSep

Func _wmigetcompinfo($strComputer = "localhost")
; Generated by AutoIt Scriptomatic November 30, 2012
$wbemFlagReturnImmediately = 0x10
$wbemFlagForwardOnly = 0x20
$colItems = ""
$sOutput = ""
;- $sOutput &= "Computer: " & $strComputer & @CRLF
$sOutput &= ""
$objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\CIMV2")
$colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_ComputerSystem", "WQL", _
$wbemFlagReturnImmediately + $wbemFlagForwardOnly)


If IsObj($colItems) Then
For $objItem In $colItems
$sOutput &= "Computer Status: " & $objItem.Status & @CRLF


Next
Else
Return ("WMI not functional")
EndIf

$colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_ComputerSystemProduct", "WQL", _
$wbemFlagReturnImmediately + $wbemFlagForwardOnly)


If IsObj($colItems) Then
For $objItem In $colItems
MsgBox(0,"","SerialNumber" & $objItem.IdentifyingNumber)
$sOutput &= "SerialNumber: " & $objItem.IdentifyingNumber & @CRLF
Next

Return ($sOutput)

EndIf

EndFunc ;==>_wmigetcompinfo

Func WMIDateStringToDate($dtmDate)

Return (StringMid($dtmDate, 5, 2) & "/" & _
StringMid($dtmDate, 7, 2) & "/" & StringLeft($dtmDate, 4) _
& " " & StringMid($dtmDate, 9, 2) & ":" & StringMid($dtmDate, 11, 2) & ":" & StringMid($dtmDate, 13, 2))
EndFunc ;==>WMIDateStringToDate

Func OKButton($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject, $s_Body)

$rc = _INetSmtpMailCom($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject, $s_Body)
ProgressOn("Progress", "Submitting your ticket", "0 percent")
For $i = 0 to 100 step 20
sleep(500)
ProgressSet( $i, $i & " percent")
Next
ProgressSet(100 , "Done", "Complete")
sleep(500)
ProgressOff()
If @error Then
MsgBox(0, "Error sending message", "Error code:" & @error & " Description:" & $rc)
Else
MsgBox(0, "HelpDesk App", "Your ticket has been submitted successfully")

;~ else
EndIf

EndFunc ;==>OKButton

Func OnEmail($sSupportEmail)
Run(@ComSpec & " /c " & 'start mailto:' & $sSupportEmail, "", @SW_HIDE)
EndFunc ;==>OnEmail

Func CLOSEClicked()
;Note: at this point @GUI_CTRLID would equal $GUI_EVENT_CLOSE,
;and @GUI_WINHANDLE would equal $hMainwindow

Exit
EndFunc ;==>CLOSEClicked

;
; The UDF
Func _INetSmtpMailCom($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject = "", $sBody = "", $s_AttachFiles = "", $s_CcAddress = "", $s_BccAddress = "", $s_Importance = "Normal", $s_Username = "", $s_Password = "", $IPPort = 25, $ssl = 0)
Global $oMyRet[2]
Global $oMyError = ObjEvent("AutoIt.Error", "MyErrFunc")
Local $objEmail = ObjCreate("CDO.Message")
$objEmail.From = '"' & $s_FromName & '" <' & $s_FromAddress & '>'
$objEmail.To = $s_ToAddress
Local $i_Error = 0
Local $i_Error_desciption = ""
If $s_CcAddress <> "" Then $objEmail.Cc = $s_CcAddress
If $s_BccAddress <> "" Then $objEmail.Bcc = $s_BccAddress
$objEmail.Subject = $s_Subject
If StringInStr($sBody, "<") And StringInStr($sBody, ">") Then
$objEmail.HTMLBody = $sBody
Else
$objEmail.Textbody = $sBody & @CRLF
EndIf
If $s_AttachFiles <> "" Then
Local $S_Files2Attach = StringSplit($s_AttachFiles, ";")
For $x = 1 To $S_Files2Attach[0]
$S_Files2Attach[$x] = _PathFull($S_Files2Attach[$x])
;~ ConsoleWrite('@@ Debug : $S_Files2Attach[$x] = ' & $S_Files2Attach[$x] & @LF & '>Error code: ' & @error & @LF) ;### Debug Console
If FileExists($S_Files2Attach[$x]) Then
ConsoleWrite('+> File attachment added: ' & $S_Files2Attach[$x] & @LF)
$objEmail.AddAttachment($S_Files2Attach[$x])
Else
ConsoleWrite('!> File not found to attach: ' & $S_Files2Attach[$x] & @LF)
SetError(1)
Return 0
EndIf
Next
EndIf
$objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
$objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = $s_SmtpServer
If Number($IPPort) = 0 Then $IPPort = 25
$objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = $IPPort
;Authenticated SMTP
If $s_Username <> "" Then
$objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
$objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = $s_Username
$objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = $s_Password
EndIf
If $ssl Then
$objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = True
EndIf
;Update settings
$objEmail.Configuration.Fields.Update
; Set Email Importance
Switch $s_Importance
Case "High"
$objEmail.Fields.Item("urn:schemas:mailheader:Importance") = "High"
Case "Normal"
$objEmail.Fields.Item("urn:schemas:mailheader:Importance") = "Normal"
Case "Low"
$objEmail.Fields.Item("urn:schemas:mailheader:Importance") = "Low"
EndSwitch
$objEmail.Fields.Update
; Sent the Message
$objEmail.Send
If @error Then
SetError(2)
Return $oMyRet
EndIf
$objEmail = ""
EndFunc ;==>_INetSmtpMailCom
;
;
; Com Error Handler
Func MyErrFunc()
$HexNumber = Hex($oMyError.number, 8)
$oMyRet[0] = $HexNumber
$oMyRet = StringStripWS($oMyError.description, 3)
ConsoleWrite("### COM Error ! Number: " & $HexNumber & " ScriptLine: " & $oMyError.scriptline & " Description:" & $oMyRet & @LF)
SetError(1); something to check for when this function returns
Return
EndFunc ;==>MyErrFunc

Thanks!

Thanks

Grimm

Link to comment
Share on other sites

Is this what you are looking for?

#include <File.au3>

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <Constants.au3>
#include <GUIConstantsEx.au3>
#include <GUIListBox.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
    Global $goMyRet[2]
    Global $goMyError = ObjEvent("AutoIt.Error", "MyErrFunc")
_main()
Func _Main()
    while 1
        _GUI()
        WEnd
EndFunc   ;==>_Main

Func _gui()
    Local $sUsername = @UserName ; User Name
    Local $sComputername = @ComputerName ; Computer Name
    Local $sText1 = ""; Output text for message box.
    Local $sText2 = ""; Output text for message box.
    Local $combo1 = ""; Output text for combo box.
    Local Const $sDomain = 'domain.com'
    Local Const $sServer = "email" & '.' & $sDomain
    Local Const $sSupportEmail = "helpdesk" & '@' & $sDomain
    ClipPut($sServer)
    $sText1 = "Username = " & $sUsername & @CRLF ; The & character concentrates (joins) two values together.
    $sText2 = "Computer Name = " & $sComputername & @CRLF ; The &= adds to the variable. The same as doing $var = $var & "extra stuff"

    Local $hMainwindow = GUICreate("HelpDesk App", 300, 620, Default, Default, BitAND($WS_CAPTION, $WS_POPUP, $WS_SYSMENU), $WS_EX_CONTEXTHELP)
;~ GUISetStyle
    GUICtrlCreateLabel("Helpdesk App", 30, 10, 290, 40)
    GUICtrlSetFont(-1, 20, 800); bold

    GUICtrlCreateLabel($sText1, 25, 60)
    GUICtrlCreateLabel($sText2, 25, 78)
    local $hShinkButton = GUICtrlCreateButton("&Hide", 30, 565, 80) ;*Commented Out; Would like to learn how to create a form and clear the data
    local $hResetbutton = GUICtrlCreateButton("&Reset", 115, 565, 80) ;*Commented Out; Would like to learn how to create a form and clear the data
    Local $hOkButton = GUICtrlCreateButton("&Send", 200, 565, 80)


    GUISetState()

    ; _AddHorzSep(10, 40, 290)
    _AddHorzSep(10, 105, 280)
    _AddHorzSep(10, 210, 280)




    GUICtrlCreateLabel("*Please provide the above information when you contact the Help Desk for any hardware or software problems.", 20, 120, 250, 50)
    GUICtrlCreateLabel("Helpdesk #: (555) 555-5555", 85, 173)
    GUICtrlCreateLabel("&Helpdesk Email:", 70, 188)
    $hEmail = GUICtrlCreateLabel($sSupportEmail, 148, 188);helpdesk@domain.com"
    GUICtrlSetFont($hEmail, 8.5, -1, 4) ; underlined
    GUICtrlSetColor($hEmail, 0x0000ff)
    GUICtrlSetCursor($hEmail, 0)



    GUICtrlCreateLabel("Helpdesk Request Form", 30, 220, 270, 50)
    GUICtrlSetFont(-1, 15, 800); bold

    GUICtrlCreateLabel("Request &Type:", 25, 273, 75)
    Local $hCombo = GUICtrlCreateCombo("", 100, 270, 160) ; create first item
    GUICtrlSetData(-1, "Keyboard/Mouse|Monitor|Other|EbscoHost|OneClick Digital|OverDrive|Project Gutenberg|Tumblebooks|General|Firefox|Google Chrome|Website Announcements|Board Web Posting|General Web Postings|Home Page Web Postings|HR Web Postings|Login Trouble|HVAC|Web Filtering|J Drive Permissions|Polaris Permissions|Phones|Polaris Client|OPAC|Patron Accounts|Printers|Self-Checks|Adobe Flash|Adobe Reader|Adobe Sockwave Player|Envisionware LPTOne|Envisionware PCRes|MS Office|Other Software|SharePoint|Springbrook|TimeClock|Windows 7|Windows XP", "Keyboard/Mouse") ; add other item snd set a new default

    GUICtrlCreateLabel("&Subject:", 25, 303, 75)
    Local $hInputText = GUICtrlCreateInput("", 100, 300, 160)

    GUICtrlCreateLabel("&Details:", 25, 330, 75)
    Local $hInputText2 = GUICtrlCreateInput("", 25, 345, 235, 200)

    While 1
        Switch GUIGetMsg()
            Case $hOkButton
                $msg = "Subject: " & GUICtrlRead($hInputText) & @CRLF & @CRLF & "Details: " & GUICtrlRead($hInputText2) & @CRLF & @CRLF & "" & $sText1 & $sText2 & _wmigetcompinfo()

                OKButton($sServer, $sUsername, $sUsername & '@' & $sDomain, $sSupportEmail, "Issue: " & GUICtrlRead($hCombo), $msg)

                case $hResetbutton
                    ExitLoop
            Case $hEmail
                OnEmail($sSupportEmail)
            Case $GUI_EVENT_CLOSE
                GUISetState(@SW_MINIMIZE, $hMainwindow)
            case $hShinkButton
                GUISetState(@SW_MINIMIZE, $hMainwindow)

;~ Send()
        EndSwitch
    WEnd

EndFunc


Func _AddHorzSep($iX, $iY, $iW)

    GUICtrlCreateLabel("", $iX, $iY, $iW, 1)
    GUICtrlSetBkColor(-1, 0x000000)


EndFunc   ;==>_AddHorzSep

Func _wmigetcompinfo($strComputer = "localhost")
    ; Generated by AutoIt Scriptomatic November 30, 2012
    $wbemFlagReturnImmediately = 0x10
    $wbemFlagForwardOnly = 0x20
    $colItems = ""
    $sOutput = ""
    ;- $sOutput &= "Computer: " & $strComputer & @CRLF
    $sOutput &= ""
    $objWMIService = ObjGet("winmgmts:" & $strComputer & "rootCIMV2")
    $colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_ComputerSystem", "WQL", _
            $wbemFlagReturnImmediately + $wbemFlagForwardOnly)


    If IsObj($colItems) Then
        For $objItem In $colItems
            $sOutput &= "Computer Status: " & $objItem.Status & @CRLF


        Next
    Else
        Return ("WMI not functional")
    EndIf

    $colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_ComputerSystemProduct", "WQL", _
            $wbemFlagReturnImmediately + $wbemFlagForwardOnly)


    If IsObj($colItems) Then
        For $objItem In $colItems
            MsgBox(0, "", "SerialNumber" & $objItem.IdentifyingNumber)
            $sOutput &= "SerialNumber: " & $objItem.IdentifyingNumber & @CRLF
        Next

        Return ($sOutput)

    EndIf

EndFunc   ;==>_wmigetcompinfo

Func WMIDateStringToDate($dtmDate)

    Return (StringMid($dtmDate, 5, 2) & "/" & _
            StringMid($dtmDate, 7, 2) & "/" & StringLeft($dtmDate, 4) _
             & " " & StringMid($dtmDate, 9, 2) & ":" & StringMid($dtmDate, 11, 2) & ":" & StringMid($dtmDate, 13, 2))
EndFunc   ;==>WMIDateStringToDate

Func OKButton($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject, $s_Body)

    $rc = _INetSmtpMailCom($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject, $s_Body)
    ProgressOn("Progress", "Submitting your ticket", "0 percent")
    For $i = 0 To 100 Step 20
        Sleep(500)
        ProgressSet($i, $i & " percent")
    Next
    ProgressSet(100, "Done", "Complete")
    Sleep(500)
    ProgressOff()
    If @error Then
        MsgBox(0, "Error sending message", "Error code:" & @error & " Description:" & $rc)
    Else
        MsgBox(0, "HelpDesk App", "Your ticket has been submitted successfully")

;~ else
    EndIf

EndFunc   ;==>OKButton

Func OnEmail($sSupportEmail)
    Run(@ComSpec & " /c " & 'start mailto:' & $sSupportEmail, "", @SW_HIDE)
EndFunc   ;==>OnEmail

Func CLOSEClicked()
    ;Note: at this point @GUI_CTRLID would equal $GUI_EVENT_CLOSE,
    ;and @GUI_WINHANDLE would equal $hMainwindow

    Exit
EndFunc   ;==>CLOSEClicked

;
; The UDF
Func _INetSmtpMailCom($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject = "", $sBody = "", $s_AttachFiles = "", $s_CcAddress = "", $s_BccAddress = "", $s_Importance = "Normal", $s_Username = "", $s_Password = "", $IPPort = 25, $ssl = 0)

    Local $objEmail = ObjCreate("CDO.Message")
    $objEmail.From = '"' & $s_FromName & '" <' & $s_FromAddress & '>'
    $objEmail.To = $s_ToAddress
    Local $i_Error = 0
    Local $i_Error_desciption = ""
    If $s_CcAddress <> "" Then $objEmail.Cc = $s_CcAddress
    If $s_BccAddress <> "" Then $objEmail.Bcc = $s_BccAddress
    $objEmail.Subject = $s_Subject
    If StringInStr($sBody, "<") And StringInStr($sBody, ">") Then
        $objEmail.HTMLBody = $sBody
    Else
        $objEmail.Textbody = $sBody & @CRLF
    EndIf
    If $s_AttachFiles <> "" Then
        Local $S_Files2Attach = StringSplit($s_AttachFiles, ";")
        For $x = 1 To $S_Files2Attach[0]
            $S_Files2Attach[$x] = _PathFull($S_Files2Attach[$x])
;~ ConsoleWrite('@@ Debug : $S_Files2Attach[$x] = ' & $S_Files2Attach[$x] & @LF & '>Error code: ' & @error & @LF) ;### Debug Console
            If FileExists($S_Files2Attach[$x]) Then
                ConsoleWrite('+> File attachment added: ' & $S_Files2Attach[$x] & @LF)
                $objEmail.AddAttachment($S_Files2Attach[$x])
            Else
                ConsoleWrite('!> File not found to attach: ' & $S_Files2Attach[$x] & @LF)
                SetError(1)
                Return 0
            EndIf
        Next
    EndIf
    $objEmail.Configuration.Fields.Item("[url="http://schemas.microsoft.com/cdo/configuration/sendusing"]http://schemas.microsoft.com/cdo/configuration/sendusing"[/url]) = 2
    $objEmail.Configuration.Fields.Item("[url="http://schemas.microsoft.com/cdo/configuration/smtpserver"]http://schemas.microsoft.com/cdo/configuration/smtpserver"[/url]) = $s_SmtpServer
    If Number($IPPort) = 0 Then $IPPort = 25
    $objEmail.Configuration.Fields.Item("[url="http://schemas.microsoft.com/cdo/configuration/smtpserverport"]http://schemas.microsoft.com/cdo/configuration/smtpserverport"[/url]) = $IPPort
    ;Authenticated SMTP
    If $s_Username <> "" Then
        $objEmail.Configuration.Fields.Item("[url="http://schemas.microsoft.com/cdo/configuration/smtpauthenticate"]http://schemas.microsoft.com/cdo/configuration/smtpauthenticate"[/url]) = 1
        $objEmail.Configuration.Fields.Item("[url="http://schemas.microsoft.com/cdo/configuration/sendusername"]http://schemas.microsoft.com/cdo/configuration/sendusername"[/url]) = $s_Username
        $objEmail.Configuration.Fields.Item("[url="http://schemas.microsoft.com/cdo/configuration/sendpassword"]http://schemas.microsoft.com/cdo/configuration/sendpassword"[/url]) = $s_Password
    EndIf
    If $ssl Then
        $objEmail.Configuration.Fields.Item("[url="http://schemas.microsoft.com/cdo/configuration/smtpusessl"]http://schemas.microsoft.com/cdo/configuration/smtpusessl"[/url]) = True
    EndIf
    ;Update settings
    $objEmail.Configuration.Fields.Update
    ; Set Email Importance
    Switch $s_Importance
        Case "High"
            $objEmail.Fields.Item("urn:schemas:mailheader:Importance") = "High"
        Case "Normal"
            $objEmail.Fields.Item("urn:schemas:mailheader:Importance") = "Normal"
        Case "Low"
            $objEmail.Fields.Item("urn:schemas:mailheader:Importance") = "Low"
    EndSwitch
    $objEmail.Fields.Update
    ; Sent the Message
    $objEmail.Send
    If @error Then
        SetError(2)
        Return $goMyRet
    EndIf
    $objEmail = ""
EndFunc   ;==>_INetSmtpMailCom
;
;
; Com Error Handler
Func MyErrFunc()
    $HexNumber = Hex($goMyError.number, 8)
    $goMyRet[0] = $HexNumber
    $goMyRet = StringStripWS($goMyError.description, 3)
    ConsoleWrite("### COM Error ! Number: " & $HexNumber & " ScriptLine: " & $goMyError.scriptline & " Description:" & $goMyRet & @LF)
    SetError(1); something to check for when this function returns
    Return
EndFunc   ;==>MyErrFunc
Edited by DicatoroftheUSA
Link to comment
Share on other sites

Thank you, one more thing that I would like to add is when the Send button is pressed I have a progress bar msgbox appears then another msgbox appears with either "error" or "sent successfully". When the sent successfully msgbox appears there is an ok button and when pressed, I would like the same thing to happen where is minimizes to the taskbar. Any ideas?

Thanks again!

Thanks

Grimm

Link to comment
Share on other sites

Thank you, one more thing that I would like to add is when the Send button is pressed I have a progress bar msgbox appears then another msgbox appears with either "error" or "sent successfully". When the sent successfully msgbox appears there is an ok button and when pressed, I would like the same thing to happen where is minimizes to the taskbar. Any ideas?

Thanks again!

I don't understand, you want to to send a message if they choose to minimise it?

Link to comment
Share on other sites

I have been doing some testing and when you take the script you gave me it works except when the reset button is pressed. At that point a new window is created and you cannot get rid of the first window. Any way to fix that?

I guess I am not following. Reset will "reset" the function, it will destroy the first window. The only thing I can think of is two instances of the application were launced. It can be exited through the tray icon. At least that is how it behaves when I test it.

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