run time error

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
SuitedAces
Pro Scripter
Posts: 50
Joined: Thu Feb 21, 2008 9:11 pm

run time error

Post by SuitedAces » Tue Mar 04, 2008 11:22 pm

I am getting the following error with the RunProgram> command.

Microsoft Visual C++ Runtime Library
Runtime Error!
Abnormal program termination.

The app I was running started without error using RunProgram>, until I ran my start/logon macro without first closing the app .

Now I can run the same macro as long as I click on the desktop shortcut in the macro to start the app, but I get an error with the RunProgram> command.

I can also go the the app's file and double click the exe. and it starts without error.

I uninstalled and reinstalled the app but that didnt help , I also did a system restore rolling back to a prior date.

Why would there be a different reaction to clicking a shortcut vs the
RunProgram command ?

User avatar
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

Post by Bob Hansen » Wed Mar 05, 2008 1:41 am

Please show us the RunProgram command line and the Target and StartIn Lines from the shortcut. Suggest doing Cut/Paste vs. typing in what you think is there.
Last edited by Bob Hansen on Wed Mar 05, 2008 4:16 am, edited 1 time in total.
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

Me_again
Automation Wizard
Posts: 1101
Joined: Fri Jan 07, 2005 5:55 pm
Location: Somewhere else on the planet

Post by Me_again » Wed Mar 05, 2008 3:02 am

Could it be related to the directory from which it's run?

SuitedAces
Pro Scripter
Posts: 50
Joined: Thu Feb 21, 2008 9:11 pm

Post by SuitedAces » Wed Mar 05, 2008 5:53 pm

Maybe I wasn't clear in my post.

There is nothing at all wrong with the line of code to run the app.
This is no typing error.
I never typed the path , it was a copy/paste.
The RunProgram> line was already functioning and has not been altered.

Plus I copied the line of code after RunProgram> and pasted it into the Run window from the start menu in windows and it starts the app without error.

That line of code ran dozen of times without fail until I started my macro before closing the app.
I had several windows from that app opened and apparently it didn't like something about my macro trying to open that app while it was already running.

It makes no sense to me that I can paste that identical line of code into the Run window and the app opens without error.

For some reason or another RunProgram> with that same path is not being seen as the equivalent of executing it from the Run window.

Me_again
Automation Wizard
Posts: 1101
Joined: Fri Jan 07, 2005 5:55 pm
Location: Somewhere else on the planet

Post by Me_again » Thu Mar 06, 2008 12:31 am

As a test you could try a Change Directory> before the Run Program> to move to the same directory that "Run" runs from. I think that would be the directory you land in when you do a Run cmd, C:\Documents and Settings\username for me.

User avatar
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

Post by Bob Hansen » Thu Mar 06, 2008 4:19 pm

If you answer my questions from 03/04 we may come to the same conclusion. Real examples of what you are doing are the best way for us to help you.
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

SuitedAces
Pro Scripter
Posts: 50
Joined: Thu Feb 21, 2008 9:11 pm

Post by SuitedAces » Thu Mar 06, 2008 4:39 pm

Bob Hansen wrote:If you answer my questions from 03/04 we may come to the same conclusion. Real examples of what you are doing are the best way for us to help you.


I uninstalled and then reinstalled macro scheduler and that solved the issue.

I wish people would take into consideration that the person posting has experienced what they when through the motions of describing rather than the more self-serving tack of assuming that the other individual is not as cognizant as they are.

I tried to explain twice that I ran the same line of code prior to the error dozens of times without fail.

But to no avail ,sometimes what you will encounter is an insistance that you must be imagining things.

Thank you for your help and I appologize for the rant , but I cannot help but feeling insulted.
Last edited by SuitedAces on Thu Mar 06, 2008 5:44 pm, edited 1 time in total.

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Thu Mar 06, 2008 5:11 pm

I don't think anyone meant to insult anyone. Sometimes it helps to put yourself in the shoes of the people trying to help. There are often lots of possibilities and the only way to address each one and be sure they have been dealt with is to ask the user to try each one out and receive confirmation of each step and that way rule out the possibilities. It is hard to strike off one possibility and move onto the next without confirmation of, or an answer to the first. Bob just hadn't received the information he had asked for, so he asked for it again. He certainly wasn't assuming you were not cognizant. He was asking you the same question we'd ask anyone.

The most likely cause of the problem you described was that the working directory needed to be set specifically and that is why Bob asked you for the Target and StartIn lines of the shortcut. Run Program is not the same as clicking on a shortcut which may also set the working directory and target directory. So Bob asked for that info. You didn't give it.

While you say you hadn't changed anything it is still entirely possible that the working directory can change during the course of execution if it was never set explicitly. Bob's question seems perfectly reasonable and the first thing I would have asked also.

Also bear in mind that you are not the only person who will read this thread. The benefit of a forum as well as helping the original poster is that others will learn from the answers. And not everyone has the same knowledge and experience.

One sure fire way of mimicking EXACTLY what clicking on a shortcut does is to execute the shortcut itself:

ExecuteFile>shortcut.lnk

For the benefit of those that may not know (and not to offend the OP) a shortcut is just a .lnk file. Desktop shortcuts will be found in your Desktop folder under your username. They can live anywhere. ExecuteFile will execute it and therefore should do precisely what happens when you double click on it.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

SuitedAces
Pro Scripter
Posts: 50
Joined: Thu Feb 21, 2008 9:11 pm

Post by SuitedAces » Thu Mar 06, 2008 5:35 pm

I don't understand what you are referring to when you say the directory can change.
The RunProgram> command takes the path of the exe.
How could that change?

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Thu Mar 06, 2008 5:45 pm

Sometimes the "working directory" needs to be set. This is not necessarily the path of the exe and is not changed by the Run Program command. If you look in a shortcut properties you will see that as well as the path to the application you can set the start in directory. The exe path is just to reference the exe. But some apps will behave differently depending on what the current working directory is. In most cases it is the same as the exe's path so most shortcuts will show the same path in both. But some need to be different and when you use Run Program you are not setting the working or start in directory. That is done with the Change Directory command.

The working directory can also get changed by other apps you run in your script, by Macro Scheduler itself depending on what you are doing - maybe if you save a script somewhere. In short if an app you start with Run Program requires it you need to be sure to first set the working directory explicitly with Change Directory since other factors can change it.

Hence why Bob asked the questions he did.

User avatar
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

Post by Bob Hansen » Thu Mar 06, 2008 7:17 pm

As Marcus has stated so well, there was no insult intended, just an attempt to duplicate exactly what was happening in your situation.

Note that ME_again also mentioned changing the directory before the RunProgram> command might be the correct solution. But without seeing the script we are all just making best guesses about the most likely cause.

I am glad that your problem seems to be resolved right now, but we really don't know why. It is not common to have to uninstall and reinstall Macro Scheduler to solve problems, but if it worked, congratulations.

If any more issues, be sure to return here for more help,
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts