 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
j0989 Guest
|
Posted: Tue Jan 08, 2008 3:44 am Post subject: GroupAdd and WinClose - I can't make it work |
|
|
This is my first script.
I am trying to learn how to use GroupAdd.
I want to close all the windows whose titles include keywords passed into the script from the command line.
| Code: |
SetTitleMatchMode, 2
loop %0%
{
GroupAdd, ToBeClosed, %a_index%
}
WinClose, ahk_group ToBeClosed
|
"autohotkey.exe thiscript.ahk Calculator Calendar Word"
But this doesn't seem to work. I'll appreciate your hints and suggestions.
Andrzej |
|
| Back to top |
|
 |
freakkk
Joined: 29 Jul 2005 Posts: 128
|
Posted: Tue Jan 08, 2008 4:27 am Post subject: |
|
|
Your usage of GroupAdd is fine.. but the A_Index in your loop is literally converting to be the number of the current loop iteration. If you use it as an expression it would work.
| Code: | SetTitleMatchMode, 2
Loop, %0%
GroupAdd, ToBeClosed, % %A_Index% ; <-- the contents of the var N
WinClose, ahk_group ToBeClosed |
_________________ .o0[ corey ]0o. |
|
| Back to top |
|
 |
j0989 Guest
|
Posted: Wed Jan 09, 2008 1:24 am Post subject: |
|
|
Many thanks freakkk for your help. It does work, indeed.
However, I must be missing something аbout loops because when I try to use the same pattern for stopping Windows services:
| Code: | Loop, %0%
Run, %comspec% /c net stop % %a_index%
return
|
I get the following error when executing "autohotkey.exe thisScript.ahk Mysql Apache2" from the command line: | Quote: | | the following variable name contains an illegal character: "". The program will exit. |
Could you give me a hint, please? |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|