Page 1 of 1

How to close all windows at once?

Posted: Wed Jul 04, 2018 2:11 pm
by snowseals
After I'm done with my project , I have a lot of windows/programs open.
To start over, I have to close them all.
But that takes alot of clicks.

Is there a way to create a shortcut like CTRL-SHIFT-X to close all what is opened?
Like a ALT-F4 for all.
We're talking about Google Chrome, 2 instances, Adobe Reader, some CMD console, explorer.exe to show a folder, Sticky Notes.

Re: How to close all windows at once?

Posted: Sat Jul 07, 2018 10:13 am
by Oleg
You can minimize all widows. Send Win+M key to active window.

In order to close all windows you have to use Window Loop action to enumerate necessary windows
Next use Window Command to close window in the loop one-by-one
Use "Use Window Handle" option and "Close" action.

But be careful, please. You don't need close all windows. You can close some necessary windows too

Re: How to close all windows at once?

Posted: Mon Jul 16, 2018 11:46 am
by snowseals
Like this?

Code: Select all

;*****************************
;* RoboTask Task file
;* Do not edit in text editor!
;*****************************
 
[Root]
ActionAfterRun=INTEGER|0
Actions=FOLDER
Automat=INTEGER|-1
CatID=INTEGER|0
Comment=STRINGLIST
ContinueOnError=INTEGER|0
ExternalName=STRING|"Task3"
Hide=INTEGER|0
ID=INTEGER|1187257673
LogOnAsUser=INTEGER|1
Name=STRING|"Close all open windows"
OnErrorTaskID=INTEGER|-1
Priority=INTEGER|3
RunOnClose=INTEGER|0
RunOnStartup=INTEGER|0
ToLog=INTEGER|3
UnicodeFormat=INTEGER|1
WriteGeneralLog=INTEGER|0

[Actions]
Action1=FOLDER
Action2=FOLDER
Action3=FOLDER

[Actions\Action1]
ActionID=STRING|"A_LOOP_WINDOW"
Enabled=INTEGER|-1
Name=STRING|"Window Loop"
Params=FOLDER

[Actions\Action1\Params]
caption=STRING|"0"
captionexact=STRING|"0"
captionfilter=STRING|"0"
class=STRING|"0"
classexact=STRING|"0"
classfilter=STRING|"0"
handlevariable=STRING|"1"
showchild=STRING|"0"
showhidden=STRING|"0"

[Actions\Action2]
ActionID=STRING|"A_WINDOW_COMMAND"
Enabled=INTEGER|-1
Name=STRING|"Close window by handle"
Params=FOLDER

[Actions\Action2\Params]
action=STRING|"4"
caption=STRING|"1"
child=STRING|"0"
class=STRING|"0"
classexact=STRING|"0"
exact=STRING|"0"
findmode=STRING|"1"
handle=STRING|"1"
hidden=STRING|"0"
processall=STRING|"0"

[Actions\Action3]
ActionID=STRING|"A_LOOP_END"
Enabled=INTEGER|-1
Name=STRING|"End Loop"


Re: How to close all windows at once?

Posted: Tue Jul 17, 2018 9:27 am
by Oleg
Your task is wrong.
Variable name can't begin from number
also you have to use variable expression in step #2 See my example below

Also you have to exclude necessary windows in the loop
such as: RoboTask, mail client and other background applications

Code: Select all

;*****************************
;* RoboTask Task file
;* Do not edit in text editor!
;*****************************
 
[Root]
ActionAfterRun=INTEGER|0
Actions=FOLDER
Automat=INTEGER|0
CatID=INTEGER|444033236
Comment=STRINGLIST
ContinueOnError=INTEGER|0
DoNotStopWhenShutdown=INTEGER|0
ExternalName=STRING|"Task174"
Hide=INTEGER|0
ID=INTEGER|1187257673
LogOnAsUser=INTEGER|1
Name=STRING|"Close all open windows (corrected)"
OnErrorTaskID=INTEGER|-1
Priority=INTEGER|3
RunOnClose=INTEGER|0
RunOnStartup=INTEGER|0
ToLog=INTEGER|3
UnicodeFormat=INTEGER|1
WriteGeneralLog=INTEGER|0

[Actions]
Action1=FOLDER
Action2=FOLDER
Action3=FOLDER
Action4=FOLDER
Action5=FOLDER
Action6=FOLDER
Action7=FOLDER
Action8=FOLDER

[Actions\Action1]
ActionID=STRING|"A_LOOP_WINDOW"
Enabled=INTEGER|-1
Name=STRING|"Window Loop"
Params=FOLDER

[Actions\Action1\Params]
caption=STRING|"1"
captionexact=STRING|"0"
captionfilter=STRING|"0"
captionvariable=STRING|"CAPT"
class=STRING|"0"
classexact=STRING|"0"
classfilter=STRING|"0"
handlevariable=STRING|"HWND"
showchild=STRING|"0"
showhidden=STRING|"0"

[Actions\Action2]
ActionID=STRING|"A_FLOW_IF"
Enabled=INTEGER|-1
Name=STRING|"If Then"
Params=FOLDER

[Actions\Action2\Params]
case=STRING|"0"
connection=STRING|"0"
count=STRING|"1"
operator=STRING|"6"
type=STRING|"0"
value1=STRING|"RoboTask"
value2=STRING|"{capt}"

[Actions\Action3]
ActionID=STRING|"A_MISC_COMMENT"
Enabled=INTEGER|-1
Name=STRING|"//do nothing"
Params=FOLDER

[Actions\Action3\Params]
comment=STRING|"do nothing"

[Actions\Action4]
ActionID=STRING|"A_FLOW_ELSE"
Enabled=INTEGER|-1
Name=STRING|"Else"

[Actions\Action5]
ActionID=STRING|"A_MISC_COMMENT"
Enabled=INTEGER|-1
Name=STRING|"//close the window"
Params=FOLDER

[Actions\Action5\Params]
comment=STRING|"close the window"

[Actions\Action6]
ActionID=STRING|"A_WINDOW_COMMAND"
Enabled=INTEGER|-1
Name=STRING|"Close window by handle"
Params=FOLDER

[Actions\Action6\Params]
action=STRING|"4"
caption=STRING|"1"
child=STRING|"0"
class=STRING|"0"
classexact=STRING|"0"
exact=STRING|"0"
findmode=STRING|"1"
handle=STRING|"{hwnd}"
hidden=STRING|"0"
processall=STRING|"0"

[Actions\Action7]
ActionID=STRING|"A_FLOW_ENDIF"
Enabled=INTEGER|-1
Name=STRING|"End If"

[Actions\Action8]
ActionID=STRING|"A_LOOP_END"
Enabled=INTEGER|-1
Name=STRING|"End Loop"