Jump to content
Macro Express Forums

Closing a program closes a file


patgenn123

Recommended Posts

Cory,

 

Hello! How are you doing? I hope well.

 

Sorry if I wasn't clear.

 

I have a macro that opens a program(for example ACTSAGE.exe). I tell the macro to open an excel file at the same time.

 

What I want to do is close the excel FILE when ACTSAGE.exe closes too.

 

I got the "OPEN" part down, but I can't get it to close when ACTSAGE.exe closes.

 

 

That's all folks! Thanks for asking Cory!

 

Pat

Link to comment
Share on other sites

Hi Pat,

I was just looking around the ME Editor and saw a "Wait for Program to Terminate" command.

Maybe that can be used in conjunction with "Program Shut Down"??

I haven't tried these commands, so I don't know for sure...

-steve

Link to comment
Share on other sites

Steve,

 

It seems like it's not working because the macro makes a sinlge run at it and if it's not happening within the initial run, it won't hold the rest of the macro to memory. I guess I'm saying that right.

 

It appears that in addition to the activation tab, maybe there should be a "closing' tab in Macro Express? Or is there a workaround? Can those commands be saved to memory? Should I call up the Scripting guys at Microsoft and ask about their WMI scripts?

 

All I need is this:

 

A. A program opens/executes

B. A file opens along with it

 

When the program closes,

 

C. close/shut down the file while the program is shutting down.

 

Can A, B and C happen within the same macro?

 

Thank you ALL for listening to someone who doesn't know jack about computers. If I worded something anyone doesn't understand, you may say "Come again?" and I will rephrase.

 

-P

 

Pat

Link to comment
Share on other sites

Hi again Pat,

 

Here's a bare-bones macro that seems to work:

 

<TBOX4:T:1:CenterCenter000278000200:000:The macro starts...Macro STARTED.><LAUNCHDEL2:0:01C:\Program Files\Microsoft Office\Office12\EXCEL.EXE><WAITPROG2:000010:000000:EditPadLite.exe><WSHUT:Microsoft Excel><TBOX4:T:1:CenterCenter000278000200:000:Excel has been closed.  Done.>

 

I use the free EditPad Lite and I've set the macro to launch when an EditPad Lite window becomes active.

 

I'm not sure why, but I seem to have trouble if I use a *specific* EditPad file or a specific Excel book.

 

The "wait" command *does* seem to work, as is evidenced by the little MacExp icon in the System Tray (It's the blue M with red hulahoop, but turns into a little black "running" man while the macro is in 'waiting-mode.')

 

I'm not an expert, but I think having ME in wait-mode could have certain ramifications.... It doesn't seem to use many system resources.... It's running right now as I type and the Windows Task Manager is telling me that it's using about 5% of the CPU and about 3 MB of RAM --- not bad. HOWEVER, only one macro can run at a time, so I can't use any of my other ME automation doodads while the macro is waiting

 

 

As always, you gurus please step in with any corrections or suggestions...

 

-steve

 

 

====

[shameless plug warning] The fine people that develop MacExp also offer ShortKeys, a baby version of ME that *does* allow me to do certain text automation tasks while ME is busy... Yay Insight Software! ;o)

Link to comment
Share on other sites

  • 2 weeks later...

Steve,

 

I haven't tried this yet, but doesn't the running man interfere with any other macros that need to run? The way I use the program, the running man could be running for a long time. It's not something that happens withina few moments.

 

I know I could "schedule" the macro to run every 5 minutes or so.

 

Is there anyway to hold the "wait" command in some other fashion without tying up Macro Express?

 

Pat

Link to comment
Share on other sites

... but doesn't the running man interfere with any other macros that need to run? ...

 

As I understand, it does.

 

I was toying with another work-around you might be able to build on....

 

Example:

Excel.exe is the dependent variable.

Sage.exe is the independent variable.

 

Make a macro that is triggered by Excel’s window becoming ‘on top,’ then create a scenario where the Sage window is *on top of* the Excel window. If you then close Sage, Excel (which was behind it) becomes the one on top and the marco is triggered.

 

This does seem to work, but the problem is that *anytime* Excel is launched, the macro triggers.

 

I tried scoping the macro such that the trigger-on-Excel.exe macro only runs of the application Sage.exe is already running, but that doesn’t work.

 

Perhaps you can introduce another independent variable—such as Notepad.exe. Notepad is a program you never use for anything, so you use scoping to make it a place-holder. Excel being on top will trigger the macro, but *only* if Notepad is running. That way you can use Excel for other things and it won’t trigger the macro.

 

So MACRO ONE:

Triggered by Sage.exe Window..

Launches Excel

Then Launches Notepad

Then executes XYZ

End

 

MACRO TWO

Triggered by Excel.exe (during time that Notepad is running)

Kills Excel

Kills Notepad

End

 

This is a pretty hokey workaround... I played around with the logic and it does work, sort of, though haphazardly. It’s very easy to make a “stupid-loop” that launches extra instances of Notepad and Excel.

 

Maybe you can build on the basic concept though(?)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...