autoit0822 Posted January 11, 2017 Share Posted January 11, 2017 How can I create a script that will automatically close a control in Evernote after a few seconds? Using Au3Info, I know that the class of the control is ENMainFrameNotification; what other information should I provide? Link to comment Share on other sites More sharing options...
Subz Posted January 11, 2017 Share Posted January 11, 2017 (edited) 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 January 12, 2017 by Subz Link to comment Share on other sites More sharing options...
autoit0822 Posted January 11, 2017 Author Share Posted January 11, 2017 I want to close the ENMainFrameNotification notification that appears in the program with a button to dismiss it. Link to comment Share on other sites More sharing options...
Subz Posted January 11, 2017 Share Posted January 11, 2017 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 More sharing options...
autoit0822 Posted January 11, 2017 Author Share Posted January 11, 2017 Class is ENMainFrame; ClassnameNN is ENMainFrameNotification1. I have attached a screenshot; the notification appears if your subscription is about to expire, or if you do not have one. Link to comment Share on other sites More sharing options...
Subz Posted January 12, 2017 Share Posted January 12, 2017 (edited) 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 January 12, 2017 by Subz Added Sleep for 5 Seconds Link to comment Share on other sites More sharing options...
autoit0822 Posted January 12, 2017 Author Share Posted January 12, 2017 Thank you; but what if I don't have that registry key? (The path is %LOCALAPPDATA%\Apps\Evernote\Evernote\Evernote.exe) Link to comment Share on other sites More sharing options...
Subz Posted January 12, 2017 Share Posted January 12, 2017 Can you check 'HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\Evernote.exe', it sounds like you have a per user installation rather than a per machine. If you can confirm I can update the code. Link to comment Share on other sites More sharing options...
autoit0822 Posted January 12, 2017 Author Share Posted January 12, 2017 There it is Link to comment Share on other sites More sharing options...
Subz Posted January 12, 2017 Share Posted January 12, 2017 Updated the script to detect HKLM, HKLM64 and HKCU. Link to comment Share on other sites More sharing options...
autoit0822 Posted January 12, 2017 Author Share Posted January 12, 2017 This works well, thanks; just a couple of points: 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? 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 More sharing options...
Subz Posted January 12, 2017 Share Posted January 12, 2017 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 More sharing options...
autoit0822 Posted January 12, 2017 Author Share Posted January 12, 2017 Thank you, again; this is great! 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