Jump to content
Macro Express Forums

How Can I Close 20 Windows At Once ?


poetman
 Share

Recommended Posts

Hello to everyone,

I'm a complete new user of ME 3.0, after three days of muddling along it was love at first sight.

I can't find a solution for this problem:

In my work I use ME 3.0 to open (using hotkeys) a lot of different Explorer folders, from which I select a file to work with.

The file loads in it's application, and on the background the Explorer folder-window stays open.

After an hour of work I find some thirthy opened Explorer folder-windows, that are in the way.

What I'm looking for is a kind of command that I can add to my macros, that says: "close window after selecting a file"

A (little lesser) alternative could be a new macro that says: "close all Explorer-windows" (but not the windows of opened applications)

Somehow I have the feeling that this should be possible with ME 3.0, but how ? and where ?

Hope I made myself a little clear

Thanks for any reply

Poetman

Link to comment
Share on other sites

After some experimentation I have discovered that this is difficult to close a Windows Explorer window unless you already know the name of the folder that Explorer is pointing to. However, if the option 'Display the full path in the title bar' within My Computer/Windows Explorer is enabled, you may be able to use the Repeat with Windows command. Something like this:

Repeat with Windows: Place title in %T1%
 If Variable %T1% contains "C:\"
   Window Close: "%T1%"
 End If
Repeat End

... The file loads in it's application, ...
Have you considered using the Activate or Launch command to launch the applications instead of navigating through Windows Explorer? This will launch Notepad:
Activate or Launch: "notepad" OR "notepad.exe"

And this launches Microsoft Word:

Activate or Launch: "Microsoft Word" OR "Microsoft Word"

To try this technique, copy the following and paste it into the Macro Express Scripting Editor. You will need to modify this if your Shortcut used to launch Word does not exist in the same location.

<LAUNCHYES3:0:0112Microsoft Word<LAUNCH:C:\Documents and Settings\All Users\Start Menu\Programs\Microsoft Word>

Link to comment
Share on other sites

Hmm dunno if it works for you, but why not close windows right after you are done with them?

 

Are all 30 windows required to be open at the same time? Perhaps you could insert "window closing" code at regular intervals.

 

Assuming you know what windows to close, you could use the Activate Window command, followed by Wait for Window Title to Appear, and finally, Close Window.

 

-Lemming B)

Link to comment
Share on other sites

Thanks Kevin & Lemming for your response

Although it's quite Hocus Pocus for me, I experimented with the Kevin's advices.

Now I think I am halfway my goal: I build a new macro that closes all windows with "C:\"in the title, (these seem to be my opened Explorer-folders)

Script: <REPEATWIN:1:1:1><WCLS:C:\><ENDREP>

This seems to work, only the macro stays running after closing al this windows, I Think I need some sort of "repeat Untill" command, only I don't Understand all the things that are offered in this dialogbox.

 

(Sure I tried several things ,f.e. I copied this from the help file, and added it to the macro script:

Variable Set Integer %N1% to 0

Repeat Until %N1% = 1

If Not Program Name "Explorer" running

Variable Set Integer %N1% to 1

End If

Repeat End

and had some exiting moments glazing at my monitor and seeing all sort of applications popping up, Macro Express jumping around, the macroscript-text being typed in several Wordprocessors etc etc.)

 

So my more specific question is : how can I make the macro <REPEATWIN:1:1:1><WCLS:C:\><ENDREP> to stop after it's work is done (all opened explorer folders to be closed)

 

Thank you guys for your time, and maybe someone has another tip for me

Poetman

 

PS Lemming : thanks for your suggestions on closing windows right after I'm done with them, but this doen't work for me

I'll trie your tip on: "window closing" code at regular intervals

Link to comment
Share on other sites

The Repeat with Folder command loops once through the entire list of windows (hidden and non-hidden) currently running on your system. It only loops once through the list of windows.

 

To confirm that the Repeat loop finishes, I would add a Sound Wave File or a Sound Beep command after the Repeat End. You can delete or disable this command later.

 

Is it possible that your macro is being activated again?

Link to comment
Share on other sites

I keep trying to find a better solution. The best solution would be to have the Explorer windows close each time you select a file. I cannot think of a way to do this with Explorer but have you considered using the Variable Set String %T1% from File Name?

 

This command launches an Explorer window and allows you to select a file. Once selected you, can use the Program Launch command to launch the application that goes with it. You can even set a folder for the Variable Set String %T1% from File Name command to start in. Try this:

Variable Set String %T1% "c:\MyFiles"
Variable Set String %T1% from File Name
Program Launch: "%T1%"

or this:

Set Variable %T1% to "Path to My Documents"
Variable Set String %T1% from File Name
Program Launch: "%T1%"

Link to comment
Share on other sites

The Repeat with Folder command loops once through the entire list of windows (hidden and non-hidden) currently running on your system. It only loops once through the list of windows.

 

To confirm that the Repeat loop finishes, I would add a Sound Wave File or a Sound Beep command after the Repeat End. You can delete or disable this command later.

 

Is it possible that your macro is being activated again?

Kevin thanks for all your suggestions

I added a sound, so my macro looks like this now: <REPEATWIN:1:1:1><WCLS:C:\><ENDREP><BEEP>

 

The explorer folders are closed in maximum 5 seconds

The beep goes off after about 20 seconds (ans ME is OffLine for 15 seconds)

I don't understand what ME 3.0 is doing all this time, there are only 5 or 6 windows left open (1 with the focus, 5 in the background)

Can I enter a "time value", something that makes the macro repeat for maximum 6 seconds, or otherwise enter a value for the maximum amount of repeats, or even better add a repeat value that says repeat until no longer folders C:\ exist.

Is this possible in the "Repeat-Until" section ?

I tried to work with this commands, but I don't understand where to place the End repeat command

(I made something like this:<REPEATWIN:1:1:1><WCLS:C:\><ENDREP><BEEP><REP3:05:000001:000001:0001:1:01:>

<REP3:08:000001:000002:0001:0:01:5><ENDREP>

but ME stays asking for a correct End Repeat

 

Idon't understand Your second mail completely: I can click files and activate applications, your way to do this opens probably more opportunities, but I don't understand completely how to deal with this code (and how to implement it in my computer-situation)

 

I'm afraid one newbee can ask more than ten advanced members can answer

Grz

 

Poetman

Link to comment
Share on other sites

If you did a Repeat with Windows and typed out the name of the windows that were found, you would find that there many more windows than you see on the screen. I just ran a macro that lists the Windows that are currently running and it found 85 of them.

Activate or Launch: "notepad" OR "notepad.exe"
Repeat with Windows: Place title in %T1%
 Text Type: %T1%<ENTER>
Repeat End

So, your macro runs. It finds and closes the 5 or 10 or 20 Windows Explorer windows that you have open. But the Repeat with Windows loop continues until it has examined all of the windows on your system. That is likely why you see the 30 second delay.

 

Perhaps something like this would work:

Activate or Launch: "notepad" OR "notepad.exe"
Repeat with Windows: Place title in %T1%
 If Variable %T1% contains "C:\"
   Sound Wave File: 5F1.wav
   Window Close: "%T1%"
 End If
 If Not Window Title "C:\" running
   Repeat Exit
 End If
Repeat End

Link to comment
Share on other sites

Randall thanks, but what who where is ME filepicker (didn't get a search-match in the helpfile, nor on the Insight website)

 

Kevin thanks

I found some sort of simple half solution:

<WCLS:C:\><WCLS:C:\><WCLS:C:\><WCLS:C:\><WCLS:C:\><WCLS:C:\><WCLS:C:\><WCLS:C:\><WCLS:C:\><WCLS:C:\>

Takes about 6 seconds to run, I can live with that

I think I'll order the Macro Express book of Joseph Weinpert

All the best

Poetman

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...
 Share

×
×
  • Create New...