Jump to content
Macro Express Forums


  • Content count

  • Joined

  • Last visited

  • Days Won


Everything posted by Cory

  1. Macro stops at login

    I've used dedicated machines using VNC instead of RDP. With VNC, when one disconnects, the session keeps functioning. I'm sure many remote apps like it work the same way. I've used LogMeIn also.
  2. Consider using the Windows Task Scheduler.
  3. It probably isn't relative but one thing to bear in mind is that PS is by default, Unicode and MEP is ASCII/ANSI. I remember I was doing something in PS with MEP and I found a workaround by reading every other character. Unicode is 16bit so as long as the characters were still in the ACSII set, this trick worked. Someone once suggested that PS file encoding output could be modified to be ASCII. Set-Content cmdlet with '-Encoding ASCII' it might have been. But that was long ago.
  4. Macro stops at login

    It's not an MEP limitation, it's Windows. When you lock your workstation Windows knows there is no way a user can interact with any of the programs and essentially suspends all user controls. ME commands that do things like copying files still work. This problem exists in Remote Desktop sessions that are disconnected as well. I can't think of any way you will be able to get past this limitation in Windows. You might want to see if there are any command line options for your ERP software. Or look for an option to keep you logged into the software and use the Windows Scheduler to somehow refresh that report. Maybe you can access your computer remotely via RDP and run the report prior to leaving for work. Can you turn off your monitor instead of locking? Sorry, I can't think of any great ways around this.
  5. Why do I get this error?

    You're welcome.
  6. Why do I get this error?

    That's most likely a bug in MEP. Please report it to ISS. Then ask them for support. It could be related to the most recent version. If so, you might want to go back a version. It could be triggered by your macro but it's in an exception in MEP. Ideally no exception should ever occur in a program and no matter what your macro does, MEP shouldn't have an exception and should be able to handle anything you throw at it. In my experience programming even with the best IDE tools, I still make this mistake sometimes. I suggest you close your macro file and create anew macro file containing no macros and see if it continues to happen. That will help ISS a lot. If it goes away, then do isolation troubleshooting to determine which is causing the problem. Even if you don't have any running MEP is constantly processing your macros activations. It might be in there. Technical side: There are two types of variables, values type and reference type. Value types hold the actual data and are specifically dimensioned. But most programming uses objects that can expand, contract and do all kinds of things in dimension. One can't move blocks of data around in memory so object variables are made of two parts. One is the data which is dynamic and in location and size around (address changes) and the other is a a value type variable which contains the current address of the object. It is called, intuitively enough, a pointer. When I 'reference' my object in the program, it gets the pointer and finds my object. Hence "reference" type. Sometimes one can do something in a program that makes the pointer invalid. It's like calling someone's phone only to find the number has been disconnected. So in ones' program when one references an object using a pointer and the system doesn't find the object there, it throws an exception. Usually one creates handlers for exceptions but we avoid handlers because they adversely affect performance and complicate the code. I frequently write code that seems like there is no way on earth I could ever invalidate a pointer, and yet somehow it still happens. Code can get very complex and objects (reference type) can contain numerous objects in a complex hierarchy. At times it can be practically impossible to mentally consider every possible exception.
  7. Variables not Clearing

    Please create a sample macro file with two macros that demonstrate the problem and post it here for me to look at.
  8. Tips for beginners

    No classes. There was only one book written by my esteemed friend Joe Weinpert,Macro Express Explained. It's out of print now but you can buy the PDF form ISS. But it's for ME3, not MEP. But many of the fundamentals are the same. I also want you to try and used named variables. I think that's something that many get stuck on the old ways and it damages the way you think about variables. Many sample macros come with the program. Go though those. And there are many resources and examples on the ISS website. And besides that, get in and try things. Post here when you get stuck, we like to help . I recommend making simple example macros when you have a problem and export them to a file to post on the problem. Use the comments a lot in the macro. The easier you make it for us to understand your problem, the more likely we are to answer.
  9. Variables not Clearing

    I'll bet you my bottom dollar that if MEP is terminated and restarted, there is no way a variable will persist unless it's saved and restored in some way. Please provide us with a sample macro that succinctly demonstrates the problem. Be careful with the viewing variables via F5. There are times when it can be misleading. I recommend you ad some message dialog boxes or do some variable saves to files if you're having problems. How are you scoping your variables? I'm guessing this is your problem. Scope is often hard for people to understand. I wrote this web page to describe it.
  10. Program macro at random interval

    Two loops (repeats), one inside the other. In the outside loop generate a random number between 3600 and 7200. This is the number of seconds in one to two hours. Create an inner loop that loops that random number of times. In the inner loop, insert a command to decrement the counter by 1, a 1 second delay, and a message box update command. In the message box you can display the random number as it decrements. This will serve as a launch countdown. When it exits the inner loop, but still within the outer loop, close the message box and execute your macro commands. You might also consider using the Macro Run and have your main code exist in it and be called by this macro. You could also get fancy and use time variables instead of integer to display a more friendly countdown. EG: Hours, minutes, seconds.
  11. As an 'aside'check out the Windows Task Scheduler. You can schedule MEP macros, and other things, from there. Used in combination with MEP's scheduler, one can do some things one can't do with either of them individually.
  12. Program macro at random interval

    I would create a macro that waits a random interval. When it starts, it generates the long interval. Then have there be a loop with a short interval. Say 1-10 seconds. The number of iterations would be the long divided by the short. Each time it loops, you can update the text box with a countdown with the remaining long interval. IE a countdown to the next iteration.
  13. Wait for Text Playback - does it work?

    Good point Terry. Now that I think about it, i don't see the point. To me, if I perform a Text Type command the macro doesn't proceed until that command has completed. It seems I too need an edification. As an aside I have found the timing of text playback off. I have several macros that I categorize as "AutoText". Usually something that completes a longer bit of text with the first bit. Like the beginning of my email address. But if MEP has been inactive for a spell, it seems to be napping and the playback is delayed several seconds. It's probably of no bearing, but I mention it just in case.
  14. Problem pasting to PaintShop Pro

    I see that PSP has a scripting feature. Have you tried that?
  15. Excel: macro fails consistently

    You might also consider using databases. MS SQLExpress and MySQL are free. And for basic use, they're easy to learn. And Excel loves to connect to Dbs.
  16. As you may know I don’t like using IE or any web browser for automated web tasks. Instead I would use some downloader program to get the job done. But that wasn’t very elegant as it required me to distribute another app and make firewall adjustments to all machines running it. So I went hunting again and found this very handy VBScript. You give it a URL and a local path and file name and it downloads it for you! It’s fast and if you choose to capture the console output the macro will not advance until it’s done. I’ve been using it to download torrents on RSS feeds and it has been working very reliably. But the best part is that the script is saved in the file. In this example I use the variables %URL to Download% and %Local File Name%, you can see them in the script. ' Set your settings strFileURL = "%URL to Download%" strHDLocation = "%Local File Name%" ' Fetch the file Set objXMLHTTP = CreateObject("MSXML2.XMLHTTP") objXMLHTTP.open "GET", strFileURL, false objXMLHTTP.send() If objXMLHTTP.Status = 200 Then Set objADOStream = CreateObject("ADODB.Stream") objADOStream.Open objADOStream.Type = 1 'adTypeBinary objADOStream.Write objXMLHTTP.ResponseBody objADOStream.Position = 0 'Set the stream position to the start Set objFSO = Createobject("Scripting.FileSystemObject") If objFSO.Fileexists(strHDLocation) Then objFSO.DeleteFile strHDLocation Set objFSO = Nothing objADOStream.SaveToFile strHDLocation objADOStream.Close Set objADOStream = Nothing End if Set objXMLHTTP = Nothing As a practical example I‘ll describe the macro I wrote this weekend. I am a Vikings fan but do not get DirecTV but want to watch all my games. There are private torrent sites where people post torrents of games but they are a little strange. You see most torrent sites have RSS (XML structured web pages) feeds which list all the latest posts. Most torrent sites will have the torrent URL in the link section but these guys link to another page that you have to go to where you can download the torrent. Personally I think they are just trying to discourage any automation but what this means is we can’t use the traditional RSS downloaders for our torrent clients. The other problem here is that because it’s a private tracker there are a limited number of lechers (downloaders) and since we are scrutinized on our ratio if you are tail end Charlie all the time your ratio will suck and you risk getting the boot. So I essentially created a macro to be an RSS downloader. What I do is have this script download the RSS feed to a file. I then parse that XML into a series of arrays with descriptions, links, sizes and so on. I even parse out the size from the description so I don’t accidently step on an MPEG2 version. I then check every description looking for Vikings games. It does this every 5 minutes. If I do find a game it follows the link to the next page where it downloads that file. In that file it finds the unique string of text which is the beginning to the torrent URL. I then cut out the URL from the rest of the HTML and use this VBScript again to download the torrent file to the drop folder (a folder monitored by the torrent software where files are automatically inducted). It then records the title of the torrent to be saved in a file that will prevent it from being downloaded again in the future. But the important thing is that this is all being done in macro memory and does not ever involve a web browser. Not only that but it’s faster because I’m not downloading all the graphics, advertising and especially not running any scripts in the web page like a browser will. No timing issues, not waiting for a web page to load... It all just works flawlessly and invisibly every time. Anyway given the problems users have with web page timing I thought I would share this as a solution. Manipulating the variables is a little more advanced but it’s easy to learn.
  17. WAV at end of macro - macro never ends

    Mine plays the sound file and terminates normally. You have the strangest problems with your machine :-)
  18. When I have a series of integers I contain them in an array. MEP has almost none of the normal programming methods for arrays that proper programming languages have so I have macros that I use as subroutines. One of them is "Find Index". It sets an integer value that's scoped to the parent macro and iterates though the array and aborts when the value is found. The integer value is set to the index of the value in the array. If the value is zero, it's not found. If it's something more, that's the index. I also have ones like "Find Last", "Sort" and even a binary search for large sorted arrays. It's a simple way to manipulate and query arrays without cluttering up your macros and writing code twice.
  19. Often the user environments are different in many ways. In several cases I created a training program for the users for the positions of windows, elements, controls, etc. The user runs the program, sets values, clicks to show locations, etc. and then this is saved in the registry for future macro use. If the user changes their minds, they can rerun the training program.
  20. Editing the contents of a string

    I understand family issues. I've had to make multiple trips back to Montana for deaths in the last 14 months. I'm getting jaded lately. There are tons of OPs who never respond lately that I have wasted time on and I'm getting sick of it. Having said that, it's been almost a month since you said you would "try it tomorrow". How did it go? Was the program I wrote for you useful?
  21. robocopy not detectable anymore

    Wow. Another rude one. I spent a lot of time on this also.
  22. Rename Folder Error

    Another rude guy. Glad I skipped to the end before reading his post.
  23. Wait till website is fully loaded

    I do a lot of this sort of thing and if it becomes a problem for you, let me know. I have some ways of extending macro express pros capabilities in this department. Send me a PM if you're interested with an explanation of what you're doing and I'll see if any of my tricks might work for you.