Jump to content

Recommended Posts

Hey guys, I've the intro to my GUI below just so you would know what I have right now.. what I am wondering is it there's a way to change the left click behavior of the tray icon to activate the GUI. Right click having the normal menu is fine, or just right click to exit. I have seen plenty of examples of changing the tray icon functionality but don't know how to combine it with my current GUI.. I guess my question is if I have to setup OnEvent stuff or is there another way to do it that is easier?

 

 

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Icon=Crome Icons\Google Black.ico
#AutoIt3Wrapper_Res_Fileversion=0.0.0.186
#AutoIt3Wrapper_Res_Fileversion_AutoIncrement=y
#AutoIt3Wrapper_AU3Check_Stop_OnWarning=y
#AutoIt3Wrapper_Run_Stop_OnError=y
#AutoIt3Wrapper_Run_Tidy=y
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****


#include "UIAWrappers.au3"
#include <Array.au3>
#include <Excel.au3>
#include <MsgBoxConstants.au3>
#include <File.au3>
#include <ButtonConstants.au3>
#include <GUIConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <Clipboard.au3>
#include <ComboConstants.au3>
#include <sqlite.au3>
#include "C:\Users\x\Documents\SampleDueSheetExports\Sorter.au3"
#include "CUIAutomation2.au3"
#include <GuiImageList.au3>
#include <GuiListView.au3>
#include <Misc.au3>


;~ Opt("TrayIconDebug", 1)

Global $g_hListView, $chosenone
Global $sIDBP[1] = ["SampleID's"]
Global $chosen = 0

;~ #AutoIt3Wrapper_UseX64=Y  ;Should be used for stuff like tagpoint having right struct etc. when running on a 64 bits os
;~ ############################################# COMPILE IN 32bitONLY -- SQL Sort Breaks x64bit Compiling! #################################################


Global $vRemoteDir = "\\public\MacroShare\" ;Remote Directory for saving of Loader Files
Global $TestCodesForPrepBatch[12] = ["", "PR218.6_W", "PR218.6_DW", "PR300.0_S", "PRCr6LL_TTLC", "PR314_W", "PRSULFITE300_W", "PR300.1SPE_W", "PR218.7_W", "PR300.1LL_W", "PRCR6_N7605", "PRSulfite300_S"]
Global $WhichMachine = "0" ; Assign Dummy Value
Global $sFileName = $vRemoteDir & "IC3.txt" ; FileToWorkOn




#Region ### START Koda GUI section ### Form=c:\users\x\documents\sampleduesheetexports\omegahelper.kxf
$Form1_1 = GUICreate("OmegaHelper", 221, 361, 200, 124)
$Button1 = GUICtrlCreateButton("Load All Samples from Due Sheet", 8, 8, 209, 41)
$Button2 = GUICtrlCreateButton("Sample Due Sheet", 8, 56, 209, 41)
$Button3 = GUICtrlCreateButton("CLEAR ALL LISTS!", 8, 104, 209, 41)
$Button4 = GUICtrlCreateButton("Prep Batch Loader", 8, 152, 209, 41)
$Button5 = GUICtrlCreateButton("Go to Prep Batch", 8, 232, 209, 41)
$Button6 = GUICtrlCreateButton("Make New Prep Batch", 8, 280, 209, 41)
$Combo1 = GUICtrlCreateCombo("PR300.1_W", 8, 200, 209, 25, BitOR($CBS_DROPDOWN, $CBS_AUTOHSCROLL))

For $i = 1 To UBound($TestCodesForPrepBatch) - 1
    GUICtrlSetData($Combo1, $TestCodesForPrepBatch[$i])
Next
$Button7 = GUICtrlCreateButton("Source", 8, 328, 41, 25)
$Button8 = GUICtrlCreateButton(".txt Files", 56, 328, 49, 25)
$Button9 = GUICtrlCreateButton("LaunchLims", 112, 328, 49, 25)
$Button10 = GUICtrlCreateButton("TEST", 168, 328, 49, 25)

$pos = WinGetPos($Form1_1)
WinMove($Form1_1, "", @DesktopWidth - $pos[2], @DesktopHeight - $pos[3] - 30) ;30 = START task/tray menu


GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

        Case $Button1
            Isitrunning() ; First - Checks to see if LIMS is running, goes to main screen if it is.
            GoToSampleDueSheet() ;Second - Get to SampleDueSheet
            SaveList() ; Save Sheet for Excel - Save List From SampleDueSheet
            ExcelLoadAndSum() ; Load the Data From Columns One and Two and Display Both
            ConsoleWrite(@CRLF & "Close Crap")
            AddAllTestCodes()
            ConsoleWrite(@CRLF & "Add All TestCodes")
            Knownornot()
            ConsoleWrite(@CRLF & "Known Or Not")
            Addtolistifknownfunction()
            ConsoleWrite(@CRLF & "Add to list if known")
            FindAndReplace("<", "", $sFileName) ; Change First Two Patterns to go go!
            FindAndReplace(">", "", $sFileName) ; Change First Two Patterns to go go!
            FindAndReplace("; ", "/", $sFileName) ; Change First Two Patterns to go go!
            FindAndReplace("NO3/NO3_1/", "NO3/", $sFileName) ; Change First Two Patterns to go go!
            FindAndReplace("NO2/NO2_1/", "NO2/", $sFileName) ; Change First Two Patterns to go go!
            FindAndReplace("NO2_1/", "NO2/", $sFileName) ; Change First Two Patterns to go go!
            FindAndReplace("NO3_1/", "NO3/", $sFileName) ; Change First Two Patterns to go go!
            FindAndReplace("PO4_1/", "PO4/", $sFileName) ; Change First Two Patterns to go go!
            FindAndReplace("PO4/PO4/", "PO4/", $sFileName)
            FindAndReplace("NO3/NO2/", "N/N/", $sFileName)
            FindAndReplace("Br/Cl/F/N/N/PO4/SO4", "ALL7", $sFileName) ; Change First Two Patterns to go go!
            ConsoleWrite(@CRLF & "FindAndReplace")
            ProcessAndCleanFiles($vRemoteDir & "IC3.txt")
            ConsoleWrite(@CRLF & "Process Cleaning")
            SortEverything()
            ConsoleWrite(@CRLF & "Sort")
            CheckForDupsOnlyLookingAtSampleID("3")
            ConsoleWrite(@CRLF & "Dup And Clean")
            TrayTip("Samples Loaded", "Samples Loaded From Due Sheet!", 5)
            WinActivate("OmegaHelper")


        Case $Button2 ; Go To Sample Due Sheet
            Isitrunning()
            GoToSampleDueSheet()
            TrayTip("Sample Sheet Loaded", "Samples Sheet Loaded!", 5)
            Sleep(100)
            WinWait("OmegaHelper")
            WinActivate("OmegaHelper")

        Case $Button3 ; Clear My Files
            ClearAllMyFiles()
            TrayTip("Files Cleared", "Files Cleared", 5)

        Case $Button4 ; Prep Batch Loader
            Isitrunning()
            AddAllTestCodes()
            LoadPrepBatchOnly()
            SortEverything()
            TrayTip("Prep Batch Loaded!", "Batch Loaded!", 5)
            WinActivate("OmegaHelper")

        Case $Button5 ; Go to prep batch but don't load
            Isitrunning()
            $PrepBatchForMe = GUICtrlRead($Combo1)
            Gotopreponly($PrepBatchForMe)
            TrayTip("Ready to load prep batch", "Ready to load prep batch", 5)
            WinActivate("OmegaHelper")


        Case $Button6 ; Open New Batch
            Isitrunning()
            $PrepBatchForMe = GUICtrlRead($Combo1)
            PrepBatch($PrepBatchForMe)
            TrayTip("New Batch Loaded!", "New Batch Loaded: " & $PrepBatchForMe, 5)
            LoadMyMSMSD()
            WinActivate("OmegaHelper")


        Case $Button7 ; Open IC Test Files
            Run("Explorer.exe " & "C:\Users\Ash\Documents\SampleDueSheetExports\SampleDueLoader.au3")
            WinActivate("OmegaHelper")

        Case $Button8 ; Launch Source Code
            Run("Explorer.exe " & "X:\MacroShare")
            WinActivate("OmegaHelper")

        Case $Button9
            Isitrunning()
            WinActivate("OmegaHelper")

        Case $Button10 ;For Testing Mainly.
            LoadMyMSMSD()

    EndSwitch
WEnd
Link to post
Share on other sites
16 minutes ago, corz said:

Check the help file for AutoItSetOption(). Start with "TrayMenuMode".

;o) Cor

Yeah.. I actually understand what commands to use.. but when I set those up.. my GUI doesn't run, but they tray icon acts like I want it to? Soo.. I guess I'm just using it wrong but that's why I posted.. I don't understand how to mix tray interactions and gui's.. my program has multiple GUI's too (it switches between them).

Link to post
Share on other sites
On 4/6/2018 at 9:05 PM, kylomas said:

BatMan22,

Look at TraySetOnEvent ($TRAY_EVENT_PRIMARYDOWN) in the Help file.

kylomas

Genius! Thank you, that's exactly what I needed, TraySetOnEvent($TRAY_EVENT_PRIMARYDOUBLE, "TrayEvent"). 15 minutes total fix. 

Link to post
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
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...