Jump to content
Macro Express Forums

Cory

Members
  • Posts

    4,207
  • Joined

  • Last visited

  • Days Won

    61

Everything posted by Cory

  1. Glad to hear it. When I first started scripting with ME there were several perceived limitations but after thinking on it for a while I almost always found a way. For instance many people instantly dismiss ME's scripting language because there's no "GoTo". But that's not a limitation unless you refuse to think the way the scripting language is arranged. So as long as you are familiar with all the teools and think on it a bit, and get some help from folks here, there's almost always a way.
  2. Sure. The other day I posted a sample macro that validates email addresses that does this same thing. You can get it here. Let's call our evaluated string T1. What I did is to create a variable, let's call it T2 and put all the valid characters in there. In this case a-z, 1-0, and a coupe of special characters like the hyphen, period and plus sign. Then I count the number of characters in T1, call it N1, and create a repeat loop that cycles N1 times. In each loop I get one character starting at position N1. Let's call that T3. I then check to see if T2 contains T3. It's very simple and quick. Oh. And if you want to make sure there is exactly one hyphen you can have an IF statement in there that increments a counter N2 and at the very end if N2 doesn't equal 1 then error out. Also you can use a character range sometimes. For instance less than or equal to 9 AND greater than or equal to zero. In some cases I've even used the Variable Set to ASCII Value in order to get an integer I could evaluate. This is handy to ensure it's a printing character where, say, numbers are next to letters and or you want to have a superset that includes adjacent sets in the standard ASCII table. In my email validation macro I break things in to constituent parts for evaluation, this might work for you if you always have a hyphen.
  3. I created a subroutine to validate email addresses and posted it here for you all. It's crude but effective.
  4. IMHO the best way to do this is the way I do it. What I do is create small reusable macros to use as subroutines. In the parent macro I use the Macro Run command and if I need to pass data between I do it with the registry. Works slick. I have some examples here. I don't know if that's what you're looking for but..
  5. A while back I posted a sample Multiple Choice macro to my website and a link here to a macro that demonstrated a trick of how to accumulate variable numbers of items for user selection into a single string variable with the warning that one must do some extra tricks if you have more than 36 resultant items. Pat quickly asked for my “More…” solution and when I tried to do it I found a big flaw with my logic and had to come up with a more complex solution which took more time. Then, as it has been observed, I fell off the world for a while and never got back around to documenting my sample on the website. So if you’re interested in how to do the Multiple Multiple Choice trick click here. I even made some nice Visio algorithms to make it easy to follow my pretzel logic. Enjoy!
  6. CTRL+A to highlight the web page and Clipboard Copy command. The use of conditional statements should be obvious, just mess with them. If you have a paragraph first set a string to that text like by using the Set String from File and use that in the field.
  7. Check back thru the posts as there is a good writeup on using the VBA macro to print Word docs. Excel I'm not sure about but it may be similar. And as for PDF you can check out my writeup on it on my webpage.
  8. I seem to remember some discussion on time outs in here before but I can't find them now. I don't use these very often so I don't have much advice other than basic troubleshooting. It seems something is making the system think there is keyboard or mouse activity and it's keeping you awake. I would try booting into safe mode and running it there so only essential processes not start. If it works there use MSConfig to selectively disable them until you find which is the culprit. Now you don't have any other scheduled macros running do you? I don't know but it would seem plausible that a macro that moves a mouse or types a keystroke would reset the inactivity timer. Might try disabling all your other macros. Oh, and make sure there's no cat hair in your mouse. I've seen machines that will never go to sleep because there's a cat hair or fuzz in the laser port of the mouse. It's nearly imperceptible but it can cause the mouse to dance back and forth rapidly a tiny amount. Some good laser mice are so sensitive that vibrations like someone walking by can keep them up too. I have literally walked by a user's desk before and had the monitor light up in the middle of the night. And something like an out of balance fan on the users desk can keep it awake. Try unplugging the mouse altogether and see if that fixes our wagon.
  9. Is there nothing common in the window title? For instance I have a time tracking software that shows the accumulated time, client name and so forth but it always contains the word "TimeSlice" in the title and a partial match works for it. Assuming there isn't how would you or the macro know which is the correct window? It seems what you are suggesting is that the window is completely random so how would you, programmaticly, identify the correct window title? If you can find some kind of test you could use it with the Repeat With Windows command until you found the correct one and then stick T1 (or what have you) into the title field of the Window Reposition command. Another thought might be to execute the executable again. Many programs like Outlook will not launch another instance but rather switch to the instance currently open. This brings it to the top and you can use the Window Reposition with topmost window as Jason described.
  10. I have never done any actual speed comparisons as most seem pretty quick. But my preference is to use the registry. It's all spooled up in memory so you won't get the constant disk writes. Personally I avoid read/writes to disk but it's rare that it's ever noticeable if you do. I had a macro once that was using two ASCII File Processes commands where one would "Look up" a SSN in another and there were about 35,000 records and it was pretty slow so I changed to do it all from memory instead and things were much faster. But that's plowing thru 30k records where each one requires looking up an comparing on average 15k records each time then writing results to disk. But don't forget also that for small amounts of memory Windows caches making it literally as fast as memory. Sometimes I use the windows clipboard but that can be annoying. But for my money I've never noticed any speed problems, even with large amounts and iterations of data using the registry.
  11. I see. Why don't you just create a batch file to load the apps and put that in the startup folder? Then you can control the order. Alternatively why don't you run ME at startup and schedule your macro with the "At Startup" scheduling option. Personally I don't see why people like MXE's and I almost never use them as it's easier to have one instance of Macro Express proper that loads at startup and runs all the time. This way you can schedule and control all kinds of things. I think people often forget that a ME file doesn't contain just one macro but should hold hundreds. I think they get into the mindset of "1 macro = 1 file" which is very limiting. I have a clients who has 20+ users all running off the same file that loads at startup and run all day. I just can't find any reason why one would want to stop ME before the user logs off!
  12. Seabass you might consider using VBScript instead to trigger the report from an external script. This way you can use the Windows Scheduler to create the reports. With the Windows Scheduler you might even be able to do it such that no user even need be logged in. Or, of course you could have Access run that VBA on startup and just make sure it only does it if it hasn't been run yet today. But if you use ME to launch Access you might try using the Wait for Mouse Icon command or watch for pixel colors to know hen it's ready to print.
  13. <REP3:07:000002:000001:0001:0:01:c:\test><TMVAR2:07:02:00:000:000:%T1%;><ENDREP> You can't use wildcards for attachments. This is what I do. I discovered a while ago that if you have a variable number of attachments you can accumulate them in a string var provided they are separated by semicolons. In fact you can do this with many tings in the email command. And it makes sense because if you look at the direct editor that’s all they do there. TO use this simply put T2 as the attachment. Works slick!
  14. If I remember correctly you originally get this data from the clipboard, correct? In that case I would avoid ever writing it to a file which precludes the text file process commands. It's better to just do it all in memory as I have demonstrated. What you wrote shows you have the right idea but I think you will 'get' my sample macro even though it's a slightly different approach. Having said that... One fault I found with your macro was the Text File Process. If there are only two rows and the first is the header row you should start processing at line 2 not line 1. I think your attempt to test for the Tab (T2) is trying to do that but the header row will contain tabs as well so if I understand this correct it's not going to work. One note on my macro and how it gets past the header row. In most cases the actual character count of the header row doesn't vary so it's easy to set the chunk to be deleted to a specific amount. But if it does vary then you need to get the position of the first CRLF, increment 1 since there are two characters, and delete that chunk.
  15. Bridger.zip Sorry, Too late. Try this instead. All you need to do is open the sample text file and copy the entire contents (CTRL+A) to your clipboard and run the macro.
  16. I can't see what's behind your Macro Run command but I would use the Date/Time command with an offset. I owuld first set the day of the month to T1 <DT:dT:01:1:> and if T1=1 I would generate a previous month <DT:mmmmT:02:3:{P00000}{P00001}{P00000}{P00000}>. Works slick. The whole thing looks like: <DT:dT:01:1:><IFVAR2:1:01:1:1><DT:mmmmT:02:3:{P00000}{P00001}{P00000}{P00000}><ELSE><DT:mmmmT:02:1:><ENDIF>
  17. Copy the text t your clipboard and paste it into a hex editor and see what the actual character codes are. Then copy to a text variable in ME and see if it changes. My guess is that the source system is all uppercase and will display both lower case and upper case characters as upper case. But when copied and pasted into another environment you may see they're actually different. I know MRP systems and various terminal based applications can have this problem. If you want them to always be upper case just convert the case on of the lower case characters in the macro.
  18. Personally I would stick it all in a string variable and look for the HTML tags and use the Copy Part of Text as well as the Delete Part of Text to chew thru the string variable.
  19. Why don't you just put shortcuts for those applications in your startup group?
  20. Paul's suggestion #2 is what I was trying to describe to you. Personally I don't use the text file process but that's an clever way to avoid looking for the next CRLF. Lets say you want to get the data in column number 101. Once you have the row in a string var simply start a repeat loop that will run 100 times. In each case find the position of the tab (assuming it's a tab separated file, you can change the delimiter if need be) say to N1. Now delete part of text 1 to N1 and repeat. Once out of the loop find the position of the next tab again and copy part of text 1 to N1 again to T2. Now trim T2 to get rid of the extra tab and you have the contents of the 101st item!
  21. Floyd made an HTA dialog box a while back and posted an example. You might want to check out that post. Others have suggested using a Notepad document or even a web form.
  22. I have had this in the back of my head for a long time for the same reasons as you. But I was dismayed when I determined one can't script telent sessions in Windows. You could use another terminal emulator application but I hate having to install another app for such a seemingly simple thing but it seems unavoidable. But I recently ran into a very old and free application Wget I am going to play with soon to do exactly what you are suggesting. The cool think is you can use command line parameters to do things like retrieving a web page. In the past I would open a page and then do a "View Source" and copy that to a file to avoid all the browser timing issues but with this I don't even need ot do that and with a "Wait for file exist/ready" all my timing issues will go away. Oh, and it can be run in silent mode!
  23. I’m not sure about how it would work without doing some experiments and trying as you have already done so I can’t speak to that with any authority but if for some reason that doesn’t work why don’t you just use a variable. If the parent macro sets T99 to “This came from a macro” and when you do the “Macro Run” you could use the logic If T99 = “This came from a macro” then you know if it was executed by itself or called. I'll be interested to hear what you find on your basic question though.
  24. I could give it a shot. To start with what type of documents are you printing? Once we get a print command line to work for you then we can move on to the rest.
×
×
  • Create New...