 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
T-B0N3
Joined: 24 Nov 2009 Posts: 2
|
Posted: Tue Nov 24, 2009 5:36 pm Post subject: Need help making 1 button starting winamp and toggle it |
|
|
I want to have a button that
-Starts winamp if it is not started
- If it is started i want the same button to toggle between activated and minimized.
I have made multiple versions of this script and in the end just copy/pasted what someone made for windows media player. But the button only minimizes winamp, not maximizes. Anyone can see the problem?
| Code: |
SetTitleMatchMode 2
Launch_Media::
#IfWinNotExist Winamp
Run C:\Program Files\Winamp\winamp.exe
WinGet, WinampState, MinMax, Winamp
If (WinampState = -1) ; -1 means minimized
WinRestore, Winamp
Else
WinMinimize, Winamp
return
return
|
this is my first attempy at autohotkey so i probably made a silly mistake :/ |
|
| Back to top |
|
 |
HotKeyIt
Joined: 18 Jun 2008 Posts: 1994 Location: GERMANY
|
Posted: Tue Nov 24, 2009 6:09 pm Post subject: |
|
|
Try this: | Code: | SetTitleMatchMode 2
Launch_Media::
WinGet, WinampState, MinMax, Winamp
IfWinNotExist Winamp
Run C:\Program Files\Winamp\winamp.exe
Else if (WinampState < 0) ; -1 means minimized
WinRestore, Winamp
Else
WinMinimize, Winamp
return
|
_________________ AutoHotFile - ToolTip(n,text,title,options) |
|
| Back to top |
|
 |
T-B0N3
Joined: 24 Nov 2009 Posts: 2
|
Posted: Tue Nov 24, 2009 6:26 pm Post subject: |
|
|
thanks that works, how did that fix it?
as far as i can see you changed
- #IfWinNotExist to IfWinNotExist
- put WinGet, WinampState, MinMax, Winamp on top
- and made winrestore and minminimize in the same if statement.
- and removed the 2nd return
which of these things fixed it you think? |
|
| Back to top |
|
 |
HotKeyIt
Joined: 18 Jun 2008 Posts: 1994 Location: GERMANY
|
Posted: Tue Nov 24, 2009 7:04 pm Post subject: |
|
|
| Code: | #IfWinNotExist ;is used for case sensitive hotkeys, see help file
WinGet, WinampState, MinMax, Winamp ;This line can be executed anyway and you will have the state when you need it!
if statement ;works here like a switch, makes it easier
return ;there is no way to reach second return! |
_________________ AutoHotFile - ToolTip(n,text,title,options) |
|
| 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
|