Jump to content

Close Evernote Control


Recommended Posts

What are you hoping to close?

You could use a HotKey

;~ Example 1
HotKeySet("{PAUSE}", "Pause")

While 1
    Sleep(100)
WEnd

Func Pause()
;~ When Pause key is pressed and Evernote Window is open
    If WinActive('[CLASS:ENMainFrame]') Then
        ;~ Checks to see if the Left Pane is expanded or hidden and hide it if true
        If ControlCommand('[CLASS:ENMainFrame]', '', 'ENNavPaneCtrl1', 'IsVisible', '') Then Send('{F10}')
    EndIf
EndFunc

Or you can start EverNote using the following

;~ Example 2
;~ Evernote File Path
Global $sREG_EVERNOTE = RegRead('HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\AppPaths\Evernote.exe', '')
    If FileExists($sREG_EVERNOTE) = 0 Then Exit
Run($sREG_EVERNOTE)
;~ Wait 5 seconds for Evernote Window to open 
WinWaitActive('[CLASS:ENMainFrame]', 5)
    ;~ Checks to see if the Left Pane is expanded or hidden and hide it if true
    If ControlCommand('[CLASS:ENMainFrame]', '', 'ENNavPaneCtrl1', 'IsVisible', '') Then Send('{F10}')

 

Edited by Subz
Link to comment
Share on other sites

Are you able to send through Au3Info information on Class, ClassNameNN?  I have Evernote on my system (I haven't used it for ages, but can't find the ENMainFrameNotification notification window you're describing are you able to give us instructions on how to get the notification to appear (preferred), however if not a screenshot.

Link to comment
Share on other sites

Try:

Global $sREG_EVERNOTE = RegRead('HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\Evernote.exe', '')
    If $sREG_EVERNOTE = '' Then $sREG_EVERNOTE = RegRead('HKLM64\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\Evernote.exe', '')
    If $sREG_EVERNOTE = '' Then $sREG_EVERNOTE = RegRead('HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\Evernote.exe', '')
    If FileExists($sREG_EVERNOTE) = 0 Then Exit
Global $hRUN_EVERNOTE = Run($sREG_EVERNOTE)
    AdlibRegister('EN_Notification')
While 1
    Sleep(100)
WEnd

Func EN_Notification()
    ;~ Checks to see if Notification Bar is visible
    If WinActive('[CLASS:ENMainFrame]') And ControlCommand('[CLASS:ENMainFrame]', '', 'ENMainFrameNotification1', 'IsVisible', '') Then
        Sleep(5000) ;~ Wait for 5 seconds
        ;~ Get the position of Notification Bar
        $hEN_Notification = ControlGetPos('[CLASS:ENMainFrame]', '', 'ENMainFrameNotification1')
        ;~ Left mouse click
        ;~ x = Notification Bar Width - Notification Height/2
        ;~ y = Notification Bar Height/2
        ControlClick('[CLASS:ENMainFrame]', '', 'ENMainFrameNotification1', 'left', 1, $hEN_Notification[2] - ($hEN_Notification[3]/2), ($hEN_Notification[3]/2))
    EndIf
    If ProcessExists($hRUN_EVERNOTE) = 0 Then Exit
EndFunc

 

Edited by Subz
Added Sleep for 5 Seconds
Link to comment
Share on other sites

This works well, thanks; just a couple of points:

  1. If I want to keep the notification visible for a few seconds (in the event that it is something useful), do I just change Sleep?
  2. How can I keep the program in memory, and run it each time that I open Evernote (which is always in memory, but minimised to the taskbar)?
Link to comment
Share on other sites

A1. I have updated the function above so that it shows for 5 seconds before closing the notification.
A2. You should use the compiled script for starting EverNote, it will remain in memory until you Quit EverNote, so if the notification appears again it will wait 5 seconds before closing the notification.

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