Jump to content
Macro Express Forums

Cory

Members
  • Posts

    4,207
  • Joined

  • Last visited

  • Days Won

    61

Everything posted by Cory

  1. I have one macro file that is shared by the whole company. I'm just trying to determine what the best practice is to have it behave differently for different users.
  2. I have a company who will have 20 instances of ME running. More or less I need one macro file for all of them but I want certain things to act different. I can think of several ways to do this but I’m not sure what all the pitfalls will be yet so I was wondering if you old sages could give me some ‘best practices’. Here’s a specific example. On one machine I want to schedule a macro that checks a folder ever minute or so for a change. If that change happens it will launch another macro to do something. But I want to be able to change what machine that is during the day whenever that one person is gone or whatever. Kind of passing the torch. I could put a text file indicating who is currently the active one But I don’t want everyone’s macro running every minute checking to see if they are it either. So I was wondering what’s the best way to have the same macros running on different machines differently?
  3. Hmmmm.... I'll have to check that out. Thanks!
  4. I sent a huge batch email for one of my clients but need to maintain a permanent record of what all was emailed. The email log is great but it's in a proprietary format only viewable from ME’s preference section. I want to give them some sort of log that doesn’t require going into ME’s option section. Any ideas?
  5. Wow, what went wrong with my post? Weird. No, you need to know the name of the files.
  6. Fogive me for jumpiForgive me for jumping in here as I have only skimmed Randall's posts but Cybercheif asked if there was a way to access those cells in Excel without having Excel open them all. There is. Just create a new workbook and link to all those cells.ng in here as I have only skimmed Randall's posts very
  7. Well I really didn't want to have to open another application to do this. I'm interested in the clipboard programs though, I'll check into them later. I assume they're like the Office clipboard util. I hate that thing. It isn't intuitive and it only works in Office applications which is really dumb. Well at least I know I'm not missing anythign obvious.
  8. Example: I have a macro where the user copies some HTML formatted text to a clipboard that is later pasted into an email. But there are other operations in between that require the use of the clipboard. As it is now if I write the clipboard to a string var only the characters are copied and not the formatting so when I read back fro the variable into the clipboard all I get it plain text. How can I preserve the formatted text?
  9. One more thought. You mouse click to start the pendulum, right? IF it always started exactly then and IF it always had the same frequency you should be able to have ME do the first click, wait a period of time and then click again instead of sampling colors. I would use a stop watch and time 10 full swings and then divide by 40 as a starting place the monkey with the timing a bit. But those are two big “ifs“, they may have some randomness in there that would make this futile.
  10. I think your problem is timing. As you can see for yourself it's not running very quickly in the program. However I have no idea how to rectify this. Obviously the game it taking priority over other applications. I think Kevin should be able to help you there. I would like to beat a dead horse though. I looked at your graphic and it is not at all like I thought so I think you should be able to hit it with one pixel color match. But you do need to take care to get the right pixel. Above is the pendulum at 10X. See how there are several colors of yellow? You need to catch the top 4 pixels I’m thinking. They are all the same color 321276 but below that each rank is a different color. It goes; 3320252, 319228, 318204 and so on. Now notice the top half of the red are real low numbers? At about the halfway point in the red shade gets darker the numbers jump up quickly starting at to 135657 but if in your test if you said Greater than 300000 instead of an exact match you might have greater success.
  11. Don't forget you can use the Launch Program to load files too. As long as the association is there it usually works fine.
  12. Joe’s right on here. These loops are very fast. I have logical comparison processes that read from files and do comparisons in nested loops. The section itself is a couple hundred lines long and given that it’s nested with other repetitive routines this means it’s on the order ot 10,000 lines of instruction it’s doing INCLUDING reading and writing from files and this part of my macro takes about 1.5 seconds. Joe is suggesting what I suggested. Except I was also suggesting logging the colors. I’ll think you’ll find the answer there. What I think is the problem is the color and I’m afraid I haven’t made myself clear. Let me try another tack. See the simley face post icons some use here? They’re yellow, right? Well not exactly. What they are is several hudred shades of yellow to give the depth to make them look dimensional. Let’s take a closer look: This is one of those smileys at 10X magnification. See how the individual pixels are slightly different colors? If you were just one pixel off ME would not find a match. In fact even half way towards the center where it appears the same they are different. Only the very center pixels are the same. And this is a pretty simple guy. If the pendulum is even slightly realistic none of the colors will be the same. And depending on the lighting and such from the games rendering it could be different all the time. You see most games render every frame so there is a great deal of randomness. This is why I think you need to do a closer analysis of the colors and come up with some way to accept a range of colors. Otherwise it’s hit or miss. Bha ha ha ha….
  13. You are doing an excellent job with your English. It’s just the technical lingo is sometimes difficult. This is pretty simple then. In the timing section look for the command Wait for Window. This will wait for the next window by title before proceeding. I often add a one second delay after that. Look in the script editor and click on the Scope tab. In there you can set it so that ME only runs in windows with specific titles or of specific programs. This will prevent it from running when another program pops up. Click here for an example. Also you can check a the start for any processes running that might cause problems. I have a client who uses WinFax and it sometimes has a popup notification for new faxes. I check to see if it’s running and if it is pause and tell the user to close it. Click here for an example. Also I suggest you copy all your emails from the old 3270 to file then review them all. Once satisfied they are all correct and there were no interruptions move on to another section of the macro which will delete them all. Then move to the destination system and put them all in there in a similar fashion. This would require some investigation. I am sure it is firing but there may be some other problem. A word of advice. When possible use keyboard shortcut and navigation. In my experience it’s much more reliable. As an example use CTRL+N nor a new mail message instead of clicking on the “New” button. Also clicking on common controls is very useful. Clcik here for an example. Of course but until they perfect Artificial Intelligence that’s not going to happen in any computer system. They are blind unless you tell them what to look for. You need to study the Window/Programs section of commands. Especially the activate and Launch. Then look at the Timing section. Especially the “Wait for windows” commands. Let’s call it WfW. In this case in Window 2 when click the button I would WfW with “Request” in the title. Once I did my thing in there and closed this window I would WfW with the title of “Service Desk”. This is all very simple. I hope this helps. I think I understand now what you are doing and with these timing controls you will succeed. Good luck!
  14. It's not as bad as it sounds but it would probably take a couple of hours so as always you have to weigh if it's worth the time. I've been wanting to try this out now for some time as often people post this same sort of problem but I've never found an application that was worth the time.
  15. Well if it's with the last window then I think it would be a lot easier to fix given it’s a windows program. Does it give an error message or is the problem that it just hangs for a while? If it hangs can you give me a screen shot of the second window?
  16. Cory

    3.5e.

    You know now that you mention it I too have had some odd problems with e. I had a macro I was working on and had problems with unexpected windows in QuickBooks but had to bail off of it for a couple of months. When I started on it again I upgraded to e and now when the same unexpected windows would pop up ME would frag. It made it real difficult to debug and more than once it lost my changes. Thing is I was experiencing the same problems before on d and it didn’t blow up then. Hmmmm…..
  17. I’m sorry but I don’t have time to go into detail as I need to get back to billing some hours but I think I would get the screen size of the window first as a limit and write that to integer variables. I would then create a nested repeat loop for the X and Y values. I would scan in every pixel color at every coordinate across but only maintain the width of the button signature. IOW if the button signature was 100 pixels (could be smaller probably) wide I would only maintain that many in the string var. Write a tab to separate each color and every loop you append to the end and trim off from the front. You can use the tab to determine the position of the first one and trim off that many characters. Each time you test to see if that var matches your signature. When it does execute a mouse move and click at that position. You might need to modify the coordinates to add an offset to hit the center of the button. But let me get back to the signature. I would first write a special macro to get the signature. I would ask the user to center their mouse over the button and then I would read the pixels starting 50 from the left and counting over 100 (in this example). Then hard code this into the macro as the signature. I just had another thought. Check to see if there are any unique colors in the button. IOW a color that doesn’t exist anywhere else on the page. Let’s say it was a gray button on a blue background. Then this would all be a lot simpler. Just scan line by line for that color and fire a mouse click at it when it’s found. You could start by logging all the pixel colors to a file and looking where the button is to see if there are any unique. Oh, here’s what I would do… Do a screen capture and use a simple graphics editor like Irfanview (Free!) . Create two files and on one cut out the button so it’s just black there. Then conversely clip out the button and paste it to a new file. Then have ME scan every pixel and log every unique color in each to separate files. Then have ME look to see if there are any pixels in the button set that do not occur in the screen set. Seems likely you might find one. Then you can use this as your signature pixel color and avoid having to look for patterns.
  18. Thanks for including the script, that helps a lot. In terms of timing this should go pretty quick, at least a few hundred times a second or something on that order. If you would like to test the timing I would suggest adding a bit in your loop that would log each loop. Include the milliseconds and it should give you a pretty good idea how fast it is going. Again I have to admit I’m not sure exactly what you are doing so I’ll just toss out some things. 1- Are you entering an “enter” in the text type boxes? You should use the <Enter> instead if that’s the case. I don’t know if that makes any difference but I’ve run into weirdness before with doing things like entering a space instead of <SPACE> before. Although I used to enter carriage returns in my text in the early days and I do now they will play back. <TEXTTYPE:<ENTER> > 2- What is you text type delay? If it is set high you might miss it. I often will set the text type delay up to 200mS in order to avoid timing problems on clunky programs but if yours was set to 500 there would be a half second delay. Again, logging the time to a variable would help show this. 3- It seems odd that you are hitting an enter twice outside the if statement every time the thing loops. Maybe there’s a reason for this but that’s a lot of enter key strokes. I’m talking about lines 4 and 6. 4- You could also log the color each time to get a picture of what’s happening. 5- I noticed you have a left mouse click in the “If”. Is this your trigger? If it is it’s not clicking in the right spot. You would need to move the mouse to 227,725 first. Also you can’t be touching the mouse during this time. 6- Your macro keeps firing even after you have success. I’m thinking that if it’s a target the fire should be outside the repeat. 7- Often graphics are not one solid color as they seem. Look closely at the target. Is there any shading? Any gradient in hue? I bet if you did a screen shot and looked at the pixel colors of each individual pixel you will find that they’re all slightly different. In this case I suggest that you look at all the pixel colors and see if you can see a pattern in the number. Let’s say that they’re all in the 50,000 range and when it isn’t in the cross hairs it’s in the 30,000 range. So in this case do an IF greater than 50,000 and less than 60,000 instead of trying for an exact match. Let me rearrange what you have a second. Now I don’t know what the command sequence should be but let’s say you had to enter a left click to start the game offering the target. Then a swinging target dangles back and forth that you want to shoot by hitting the left mouse button. Here’s how I would do it. I took out the enters because I’m not sure what they are doing. Also you can remove the pause once you learn to take your paws off the mouse. <LCLK><PAUSE2:Center,CenterTake your hands off the mouse! Hit enter on the keyboard to continue. T ><MMS2:227,725><REP3:08:000002:000001:0001:1:01:T1 ><GETPX:6:S:000227:000725><IFVAR2:2:06:1:58623 ><EXITREP><ENDIF><ENDREP><LCLK><BEEP> To do some logging I suggest creating the CRLF (T95) and TAB (T96) like in my CRLF TAB macro here before the repeat then in the repeat write the time with milliseconds to T6 and then write it all to an accumulator variable. It would look something like <TVAR2:08:01:%T6%%T96%%N1%%T95%> Then write all that to a file after the repeat exit. Don’t be tempted to append to a text file instead as I think that might slow you down too much. But you can try it and see what the time log says! Afterwards you can view this text file in Notepad or Excel to see what’s what.
  19. I think it would be fairly easy to scan all the pixels in a window line by line hunting for a series of pixel colors. As it scans evaluate the last series of pixels of a certain width and when you it matches the pattern you recorded earlier use those coordinates to click. I think it would be pretty straight forward. Also you might do a more clever search. Let’s say it’s a gray button on a green background. Do a loose grid search like playing “Battleship” where the grid is smaller in X and Y than the button to get you in the ballpark then to amore refined search if necessary. Just depends on how detailed the background and button are.
  20. Thanks for the screen shots. This helps a lot. Is it in the “Session A” (let’s call it “black”) window where the error is occurring? If it is, can you send a screen shot of the error you would see if there is a displayed error? Please explain in more detail what happens when you select a mail item in the black window. Is it viewed on screen or is it a text file that gets saved to disk somewhere? Maybe you could include the code from your macro to show us this. Just copy the commands in the script editor and paste into your message and then highlight them and hit the “Code” button in the message editor. Let’s assume that you select an item and hit a command key to view that item. Since there may be a delay you might make an error by typing before the screen is ready. What I would do is set up some type of test to see if the system responded. For instance on the system I used to use there was a command to capture all the text in the terminal emulator window to a text file or to the clipboard. Now let’s say the next window you would see had the text “View email” at the top. What I would do is to copy all the screen text to my clipboard every couple of seconds and then search to see if that text exists in the clipboard. Since “View email” does not exist in the prior screen the macro would not advance until this condition was met. This way you will have no errors. Does your terminal emulation software have the ability to dump the screen to the clipboard or file as I described before? We just need some way to read in what is on the screen for ME to evaluate. Another suggestion is that you might want to slow down the keystroke delay when in this window. This will give a little pause between each keystroke. Often as little as 200ms will avoid a lot of problems and doesn’t increase the run time of the macro a significant amount.
  21. Sorry, had a client whose server crashed. I got your post and I'll look it over here in a bit.
  22. Check out the "Get Pixel color" section of the help file. I would imagine you could sample many times a second and fire when it's yellow.
  23. Yes. I do this to navigate to web pages automatically in some of my scripts. What I do is search in IE6 by doing a text type CTRL+F and wait for the box then typing in what I want ot search for. Once it's found I will do a Shift+tab then a Tab and that will highlight the link. Then I do a text type of Enter. Works slick.
×
×
  • Create New...