Jump to content
Macro Express Forums

Cory

Members
  • Posts

    4,206
  • Joined

  • Last visited

  • Days Won

    61

Everything posted by Cory

  1. I am not familiar with the program and would need to review it before giving any specific advice. I just don't have the time at the moment.
  2. Sure, I’ll give it a shot. However I don’t have a lot of time so my answers might be short. If you’re interested I do hire my talents out and if you need to get something going I’m available for hire. This way you can get my full and prompt attention as well as the benefit of phone calls, web desktop sessions and the like. Sorry, just had promote myself a little. 1- Kevin didn’t give you any code. He copied the text from the script editor. This is not something you can copy and paste in. You will need to create it. 2- Any time one uses a control it must be for a specific window title, or at least it normally is, so you would have to tailor it to your specific control. I don’t think Kevin can make this for you. 3- Um…. You edit the macro and add whatever you want. 4- The else is there to create the delay so you need it. Otherwise it will fire off so fast you won’t see it. I have to do a webinar now but if I get more time I might be back to consider all of this further.
  3. As for the right click there was a discussion in here about adding a macro to that menu and it works really slick. Might want to check that out. For parsing out the different file names I can't say or sure as I haven’t seen it but there is probably a CRLF at the end of each line. I would read that in to a text var, find the position of CR and store in N1, decrement N1, Copy part of the text to T2 from 1 to N1. Add 2 to N1 and delete part of text from 1 to N1 and repeat. Simple. If you like do the copyclip and save it to a text variable and post it here. Then I can look at it with the hex editor and see what’s in between. Oh, can see may article about hex editors if you’re interested. http://bluepointdesign.com/macros/hexedit.htm
  4. That's cool. I'll have to keep that in mind. I know how you could do it. Assuming you are running a macro then ask the user to go out and select some file and that your problem is how to get back to the macro. How about you clear the clipboard first, then start an infinite repeat that uses the clipboard contents not being empty as a criteria for a break. Like this: Repeat Until %T1% <> %T1% If Clipboard Text Equals "" Delay 250 Milliseconds Else Break End If Repeat End <REP3:08:000002:000001:0001:1:01:T1><IFOTH2:07:1:><MSD:250><ELSE><BREAK><ENDIF><ENDREP>
  5. I’m sorry, I didn’t mean to suggest you create a separate macro. In you case wait a couple of seconds with a Delay and the check if the control is visible then do something if it is. Unfortunately ME doesn’t have a “Wait for control X seconds and if it doesn’t appear do this” command. If you use the wait for you will get an error when it doesn’t appear. Also I would not do the mouse move you mentioned. Rather I would use the command to mouse click on the control if it has been detected. If you made a separate macro this may be why it isn’t working. You can only run one macro at a time and a second will not activate. As for the critical error are you saying that only a sound gets played with not dialog box or other visible feature? I’m afraid I don’t know of any way to detect a Windows sound being played if that’s the case. In this case I think you need to hunt for some sort of visible thing to interact with. Again like I mentioned in the first paragraph ME doesn’t have the ability to simply wait for something to happen while the macro is running. You need to actively go out and test for it in the script. Calculator tutorial: http://macros.com/tutorial/ME3Tutorial.htm Then go to the “Advanced – Using Controls” on the nav pane on the left.
  6. Sure, it's simple. At least for the first one. Almost all buttons and objects in Windows are controls and ME makes good use of these. In this case I would use an "If Control" with something like the "Visible" option. It's hard to say without seeing your application exactly which would be the best. One warning about controls. 99% of the controls work great but there are some pitfalls and limitations. Odds are you won't run into them for some time but just be aware that they are out there. Also for most control variables are difficult for people to get their brains wrapped around. Take a little time to learn them first or you will be frustrated. There is a very good Windows Calculator tutorial on Insights support page you should try. Joe’s book is good too. The one pearl I would pass on is that it seems like “Get Control” is inappropriately named but it is not. Since Windows handles are always changing ME uses what is stored in the control var as a sort of path on how to find the handle when the macro runs. It’s important to realize that the control variable does not contain the control or its address (handle) but rather this crumb trail. As for a critical stop error I think you’re SOL if you’re trying to detect it at run time. If I understand you correctly you’re talking about the BSoD (Blue Screen of Death) and although I’m not a programmer I’m pretty sure all processes stop at this point but for sure ME. I have run into cases like these when doing some harvesting routines that would blow up an application and how I handled it was to first log each attempt as a way to track failed attempts. Of course this was with an application so a system reboot would be a little different. In this case my first step in the loop would be to log the attempt. At the end of a successful attempt I would log it complete. Then if ME fired up again on reboot and started running the macro again and found an incomplete transaction it would tag that attempt as a BSoD or whatever and move on to the next record. Pretty simple actually if that’s what you’re trying to do.
  7. There is a free one called ClipPath I use as well but I don't think any of these will return the path of multiple selected files which I think is what he's trying to do.
  8. Oh, I see. I thought you said you were trying to launch an application you were clicking on. It’s an interesting problem. I just tried my suggestion and it works but with a serious drawback. I used left click as the activation and then did a Wait Left Mouse Click for 1 second followed by some Text Type in Notepad. It works but if you ever single click and don’t follow up with another click you will get a time out error. I don’t see any way around it. I suggest using a different activation. For instance a Right Mouse Click or better yet a Middle Mouse button click or possibly combination with a keyboard key.
  9. To count the number of occurrences is simple, see my example. There are many ways and sometimes different ways might serve your purpose better but this is one to think about. Basically it’s a repeat that consumes one instance of your text every time in a temporary variable. If one gets the position of text that does not exist in a var you get zero and I use this as the control for how many times it repeats. Basically it keeps repeating until N1=0. Variable Set String %T1% from File: "test.txt" Repeat Until %N1% = 0 Variable Modify Integer: Inc (%N2%) Variable Set Integer %N1% from Position of Text in Variable %T1% Replace "DISPATCH" with "" in %T1% Repeat End Variable Modify Integer: Dec (%N1%) Text Box Display: Result <TVAR2:01:04:c:\test.txt><REP3:08:000001:000002:0001:0:01:0><NMVAR:08:02:0:0000001:0:0000000><IVAR2:01:13:1:DISPATCH><TMVAR2:21:01:00:000:000:DISPATCH><ENDREP><NMVAR:09:01:0:0000001:0:0000000><TBOX4:T:1:CenterCenter000278000200:000:ResultDISPATCH appears %N1% times>
  10. I don’t think you want to do that. In order to Double click on an icon it would have to be global which would now mean that the doubleclick would be shanghaied everywhere. This is a Windows thing and usually you want to have some activation different than the Windows default things. I’ve never tried it but you might be able to use the left click and then have a ‘wait for left click’. But like I said, this would take over and you wouldn’t be able to double click anywhere in windows now. Generally I would never come across this. Normally if there was an application I wanted to run a macro I would have ME running all the time and have a macro that launches the application and assign it a hotkey. See Windows Programs > Activate or Launch.
  11. I once wrote a macro to harvest a soon to be closed Yahoo Newsgroup of 36,000 messages and it taught me a lot about the difference between writing a macro to do a simple one off navigation where an occasional error is tolerable and one that needs to be able to run for hours and hours without interruption. The difference is validity checking and it usually doubles the size of my macros and is difficult to debug. For instance with Yahoo they would occasionally take you first to a advertising screen where you had to click a button to continue but it was random. Another problem was that Yahoo would only allow so much traffic from a given IP address before it would start blocking your requests at which point I would have my macro open my router’s admin mage and do a DHCP release/renew to get a new address and continue on. But both of these problems and all other conceivable problems were solved with screen polls. By screen poll what I mean is grabbing the contents of the screen and having ME evaluate it for validity. There are many different ways but I found the easiest was to type a CTRL+A to highlight the entire screen and move the clipcopy to a text var. Here one can scrutinize the text and make decisions on how to proceed. For instance I could see if var T1 contains “Error: Quota Exceeded” and know to execute the routine that would roll my IP address. Or maybe if it doesn’t get a valid response after so many tries it simply backs out and tries again. Or maybe it simply tags the effort as failed in your output file for you to come back to later. There are infinite options. Anyway the CTRL+A and copyclip are nearly instantaneous and innocuous so they don’t slow the macro down any. And often in cases where there might be network delays you can use them reiteratively as a makeshift “wait for ActiveX”. Hint: In the section where ME has found an error have it use the email utility to send your phone an SMS message so it doesn’t sit there for hours doing nothing. When I read you thing about the changes in tabs it brought back memories. Personally I have found that web developers have too much time and just like to change things for no good reason. This usually renders tab counts and mouse clicks unreliable. One workaround I’ve found is to use the find utility. I’ll do a CTRL+F and search for “Account Number:” or whatever precedes the field I desire and then issue one tab. This way I always find my mark. Oh, and sometimes you can get all your data from the screen poll instead of navigating around the web window. Depending on the controls used and such it only works some of the time but lets say you were looking for the dollar figure next to account balance. I would set N1 to the position of “Account Balance:”, add 18 to N1 and grab the next 10 characters or whatever from the screen capture, trim and ‘Bob’s your uncle’. The cool thing with doing all this in ME is that you don’t have to worry about all the timing issues and the process happens at the speed of light. And if you need help developing such a macro I would be happy to lend a hand.
  12. Check your formatting. Make sureit's "General" or a date format and not Text. If it's Text all kinds of things won't work. Often CSV files and such will att a ingle quote mark (') to the beginning of the cell data to slave Excel to make it text. It doens't display unless you actually look at the raw data or the formula. But any version of Excel should be able to reformat if the cells format is not text or has this single quote. I am confident your problem can be solved in Excel. If you attach a sample file I could look at it. But my other suggestions would still work. The ones that do the comparisons in ME. Would be fairly easy logic to implement.
  13. One solution might be to use an Access (VBA) macro instead. This avoids all the timing problems. Beyond that I am not sure what type of queries you are running or what the screen looks like and I don’t quire understand your counter description. But if it were me I would look at one of the Windows controls. Usually in things like this a control will be grayed out until the action is complete and you can wait for it. I would try something like that. Also you can wait for the mouse cursor to change sometimes. Most apps will give an hour glass while executing which goes away when it’s complete. But it’s dangerous bc in most case the hour glass will go away if the user moved the cursor off of the app window. If it’s full screen it’s not a problem.
  14. Are you saying that the “Window Title” activation doesn’t work unless the window has focus? I thought it didn’t matter but I don’t think I have ever had a case where a window would popup w/o focus. If that is the case then I think you’re hosed. The only thing I could think of is if you had a macro that went off at a regular interval and checked all the window titles to see if one existed but that would not be very elegant.
  15. Don't forget this is a subroutine. It's designed for one to use to generate one variable and stash it in the registry. If you weren't going to take advantage of that it would look somethign like: <TBOX4:T:3:00LeftCenter000278000200:000:InstructionsBrowse to and select your files one at a time. When you are finished click on Cancel.><TVAR2:01:09:File to attach><REP3:08:000002:000001:0001:1:01:T1><TVAR2:02:09:File to attach><IFVAR2:1:02:1:><BREAK><ENDIF><TMVAR2:07:01:00:000:000:;%T2%><CLEARVAR1:T:2:2><ENDREP><TBCLOSE:Instructions><EMAIL2:Center:Center:Center:Center:Center:Center:RNR1TOFred@somewhere.com|Fred@somewhere.com;S1Testing123A2%T1%;F> Looking at you eMail command I see you have T1 listed twice. This is most likely the problem. You only need list T1 once. If that doesn't fix it send me some sample file names with path that don't work.
  16. I don't have an answer for what you are trying to do but I would suggest that this is not best way to select a range. Personally I use Excel's F5 command instead. Basically you do the F5 then spec the range like A1:G456 and enter. It's super easy. Also I have written macros that will add logic to this so that it will note the users current position from the status bar and then create a range that is X over and Y down from that position. That's all really easy. Also I don’t know if you know this or not but all the copyclips from Excel and most Office applications appear as tab separated files when read into ME. From there it’s super simple to parse and manipulate data internally in ME instead of arrowing all over the place in Excel and running into problems like what you mention.
  17. Why don't you just use the MAX function in Excel? E.g. =MAX(B1:B5). Your problem is that when copied to the clipboard it's coping text values hence why in your example it seems backwards. But to the computer it's exactly correct because it's sorting it alphabetically. One solution would be to parse the dates into year, month and day. Then compare them as integers. However this is a much more complex algorithm but it would be fun to write I think. Another solution would be to reformat your dates in Excel to be in the format 03/14/2006. That is 4 digit years and padded month and day. This will sort alphabetically. Yet another consideration is to change the format to integer. You see Excel actually keeps dates as integers counting up from 1/1/1900. E.g. Excel thinks today is 39233! If you have ME change the format (CTRL+1) to get these integer values then you could switch it back when done. Yet another alternative would be to convert the date to integer in ME and compare that. Now that would be a fun project too.
  18. Still not quite clear. You have a user with a macro actively running, right? THen the macro pauses with a Wait For Key Press" adn the user types some stuff in and hits the magic ket to continue... Right so far? And your WFKP is Enter or Space and when the user sinks thier sausage onto that key is issues the key press instead of continuing the macro? Is that right? Assuming I got that right are you sure the macro is still running? IOW do you have a little black running man in the system tray? Beyond that I don't know what to tell you. Did you read the notes in the help file? That might be relevant: Otherwise I have no idea what couldbe wrong. Maybe you could post your macro or a simple example that illustrates your error and post it here.
  19. Why would you want to use the registry? Just set a text var to the window title and parse out the file name. You could look for patterens like "Document X" to see if it had been saved yet.
  20. The command insertion thing I already do. But I didn’t understand about the preference to set focus back to the script. That’s hot! I’ve never used the command selection trick either. I’ll have to try that since I have all my common commands memorized. Thanks Kevin!
  21. I had forgotten about this and am just now trying out ClipMate. Very cool. Thanks guys!
  22. Was that to me or Alex? If to me, yeah I was aware. I tried rearranging things but since I work on various machines it became confusing and inefficient. Also I quickly discovered their arrangement is pretty good and now that I know where everything is it doesn’t help.
  23. I can think of a couple of ways. One would be random and one would cycle. The random is probably easier. To randomly select a file I would use the Repeat with Folder command and simply count the number of files are in there. One just increments an integer variable each time. Call it N1. Then I would use that number to create a random integer in the range of 1 to N1. Call it N2. Then I would do the repeat with folder again but this time have a conditional statement (If N3 = N2 then Break) which would leave T1 as the file name. Then change wallpaper to T1. Now just schedule this macro. The second one is a little more difficult because the macro needs to remember where it left off. In this case I would save the iteration number in the registry. So if it’s currently at file number 3 I would do a Repeat with Folder like above and Break when the counter reaches 4 leaving T1 as the next file name. Then store 4 back to the registry. Also, of course, you would need to count the number of files each time so that when the maximum number of files have been reached the counter goes back to zero. I’m sure there are other ways but this might give you some things to think about.
  24. Yeah the arrangement of the categories is mostly good but sometimes I find the arrangement 'hides' some things. Like the Text Type option to push to a control can not be found anywhere in the controls section and yet it’s one of the most useful commands you could categorize as control. I think we have all had a period of discovery where we get into the scripting aspect of ME and it takes a while to familiarize oneself with all the commands. If you haven’t already check out Joe’s book. It does a pretty good job of it.
×
×
  • Create New...