koden Posted January 3, 2008 Report Share Posted January 3, 2008 hello.... I have a macro that open mails from a folder in lotus notes, and copy and use the text. I manually (with a prompt) set the macro to run so many times as there is mails. but I would now like that it run aut. when there is new mails. I have found out that the best way to do this is to be standing in the folder and make a ctrl+e. This will open a mail if there is any. If there is'nt any mail it will do nothing. I can then check wich window is active. But this macro only haves to run when my first macro is not running. How do I get my "check mail" macro to run every minute but only when no other macro is running???? Quote Link to comment Share on other sites More sharing options...
jason Posted January 4, 2008 Report Share Posted January 4, 2008 Unfortunately there is not an easy answer for this as the routine is different for each program. It looks like you have figured out most of the program with the exception of figuring out if there is any new mail. This can be done by checking screen coordinates for a signal on the first line of the mail list in some program (e.g. some programs will show a blue dot in the unread field if the mail has not yet been open, a quick look to see if the pixel color in that location is blue would indicate that there is new mail). It may also be possible to use the registry if your program uses the option to display the number of unread e-mail on your logon screen. The registry location that the number is stored is: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\UnreadMail. You may be able to set up a repeat loop based on the number listed in this key. Quote Link to comment Share on other sites More sharing options...
koden Posted January 4, 2008 Author Report Share Posted January 4, 2008 Thanks.. If i use my own ctrl+e solution i can do it all in one macro. I don't have the key unread mail in :-( HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\UnreadMail maybe because it's my work laptop. NO...it's also not on my own laptop. XP on booth machines. A search also did'nt find unread in regedit. Are you sure? Quote Link to comment Share on other sites More sharing options...
koden Posted January 4, 2008 Author Report Share Posted January 4, 2008 I have just found another way...... My macro starts with copying the email "header" (don't know what it's called. The text you can se before opening mail. date,sender a.s.o.) If clipboard contains one of 4 special words the macro for one of the 4 words is running... this macro i already use, just manually. So..... If clipboard is empty, there is no mail and i can use macro stop. If there is mail the macro go on with one of the 4 macros depending on whats in the mail. But after macro stop. How do i get it running again..... I still need some loop or what? Quote Link to comment Share on other sites More sharing options...
jason Posted January 4, 2008 Report Share Posted January 4, 2008 Try this: Variable Set Integer %N1% to 0 Repeat Until %N1% = 1 // Enter Code Here If Clipboard Text Equals "" Break End If Repeat End Quote Link to comment Share on other sites More sharing options...
koden Posted January 5, 2008 Author Report Share Posted January 5, 2008 Hmm... Have tried your ex....i think :-) But maybe I don't understand it, because it's not working. The code just copy the mail header all the time. Just running in ths loop no mather if there is mail or not. I know I'm doing something wrong but what? What happens in 2 first lines in your code EX. ? As I see it's checking all 24 hours (all the time). Is it possible to set a 7am-17pm time on this macro, so it's not running in night? Do you meen this? : Variable Set Integer %N1% to 0 Repeat Until %N1% = 1 // clipboard empty // activate the folder in the mail program // copy mail header If Clipboard Text Equals "" Break End If Repeat End I will unterneed here try to explain exaxtly what i need. So far as my english can do it :-) I need a macro 1 that cheks if there is a mail in a folder. I do this by copying the mail header text and check if clipboard is empty or not If clipboard is full then run macro 2. If there is no mail the clipboard is empty and then macro 1 will stop. But it has to start aut. again from start, IF not the macro 2 is running. What I understand from your code is, that the macro just have to check, run the macro 1 and when finnished then check again a.s.o But how will it start again aut. when there is no mail and break has been activated? Sorry if I confusing you instead of asking, but I don't figure out to this :-)) Quote Link to comment Share on other sites More sharing options...
jason Posted January 7, 2008 Report Share Posted January 7, 2008 The Variable Set Integer command insures that the variable is indeed set to 0 before it enters the loop. The Repeat Until N1 = 1 will continue repeating as long as N1 = 0. The If Clipboard = "" checks to see if anything is on the clipboard. If there is, than the If statement is bypassed. If the clipboard is empty, than the Break command is issued to exit the loop. You could also use the Variable Modify Integer command here to add 1 to N1. Doing this would set variable N1 to 1 which will then cause the repeat loop to end because N1 no longer equals 0. Having never used LotusNotes, it may be possible that you need to issue a Clipboard Empty command at the end of the loop to insure that it does not leave anything on it making the If statement nul. Quote Link to comment Share on other sites More sharing options...
koden Posted January 8, 2008 Author Report Share Posted January 8, 2008 I know all about what The If Clipboard command does :-) I use clipboard empty. It's what the integer do i don't understand. I do understand that the loop is running so far as the N1=0 Loop will stop when N1=1. But when will N1=1? When clipboard is empty??? My problem is that I don't understand how this is used in my macro. That I use notes does'nt matter. It could be any program. The case is about the clipboard containing something or not. If I have understand you right, then this loop will run all the time and check if something get to clipboard. If clipboard is full then my macro 2 will run. Quote Link to comment Share on other sites More sharing options...
stan Posted January 9, 2008 Report Share Posted January 9, 2008 Here is one way to do this. If the clipboard is empty set variable N1 to 1. When N1 changes to 1, the macro exits the Repeat loop. Variable Set Integer %N1% to 0 Repeat Until %N1% = 1 // Enter Code Here If Clipboard Text Equals "" Variable Set Integer %N1% to 1 End If Repeat End Quote Link to comment Share on other sites More sharing options...
koden Posted January 9, 2008 Author Report Share Posted January 9, 2008 Okay...this code will run the macro until the clipboard don't get anything. But when there is mail again how will it then start again? Am I right that your and jasons code only are half of my wishes :-) ? can i do this instead: I have to use empty clipboard the right places...know that :-) At 7 am i open my mail folder. There is ex. 100 mails I run a macro that make ctrl+c of the mail header If clipboard contains text it will run my macro 2 that handle the mail text When macro 2 is finished macro 1 runs again. When 100 mails are finished macro 1 will have an empty clipboard (if I in notes make a ctrl+c of NO mail header nothing happens and give me empty clipboard) In your ex. the macro will stop. But how do it start again when there is new mail? Could I do this: repeat have macro 1 that copy to clipboard if there is data or not in clipboard run macro 2 macro 2 will check if there is data if there is data run macro 3 (this will handle the mail) else run the macro 1 again repeat end This macro will run from 7 am until I stop it. OR is there something I have'nt been ware of? Quote Link to comment Share on other sites More sharing options...
jason Posted January 10, 2008 Report Share Posted January 10, 2008 There is no trigger to watch for new mail, so your options would be to either set the macro up on a schedule to check every so often, or to manually launch the macro when you see new mail. Quote Link to comment Share on other sites More sharing options...
koden Posted January 11, 2008 Author Report Share Posted January 11, 2008 OK. yesterday I got a counter in notes that count mails,and give me a number in a pop up box. I can copy that number to clipboard. Can I use this together with your loop? Quote Link to comment Share on other sites More sharing options...
jason Posted January 11, 2008 Report Share Posted January 11, 2008 If you can capture the number that it displays, you should be able to assign that to a variable which could then be used in the counter for the loop. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.