I want my system sound to toggle on and off by pressing Ctrl + Delete. I already have some of it here;
#installkeybdhook
#usehook
^Delete::
SoundSet, 0
But I don't have the part that lets me press it again which I would assume is some kind of loop but I'm a noob so I don't know how to do that. Also I would like my skype window to Minimize when I press CTRL + Delete and unminimize when I press it again. Most of the time This isn't always going to be an active window but I also want it to do the same thing when it is. And I would like this to mute my microphone at the same time.
script that will toggle system sound on and off also other code
-
- Posts: 10
- Joined: 27 Jul 2017, 09:39
- Location: USA
- divanebaba
- Posts: 805
- Joined: 20 Dec 2016, 03:53
- Location: Diaspora
Re: script that will toggle system sound on and off also other code
Hi.
Using the search function will offer tons of examples for toggle a key.
Look here for example. I've found it by searching for "toggle key".
I'm using an example from the help file to increase or decrease the sound of my system. Look here.
For minimizing a window there is a command called WinMinimize.
Using the search function will offer tons of examples for toggle a key.
Look here for example. I've found it by searching for "toggle key".
I'm using an example from the help file to increase or decrease the sound of my system. Look here.
For minimizing a window there is a command called WinMinimize.
Einfach nur ein toller Typ.
-
- Posts: 10
- Joined: 27 Jul 2017, 09:39
- Location: USA
Re: script that will toggle system sound on and off also other code
I have come a long way with my code but I have a problem; when I try to replace the window title from notepad to anything else it doesn't work. the window that I want to minimize is the skype window (not the live conversation window that it makes when you go in full screen) also I've tried a script that tests the windows Active ID to no luck.
^Delete::
{
Toggle := !Toggle
if Toggle
#installkeybdhook
#usehook
SoundSet, 0
else
#installkeybdhook
#usehook
SoundSet, 100
}
{
IfWinExist,ahk_class Notepad
WinGet,WinState,MinMax,ahk_class Notepad
If WinState = 0
WinMinimize
else
WinRestore,ahk_class Notepad
}
^Delete::
{
Toggle := !Toggle
if Toggle
#installkeybdhook
#usehook
SoundSet, 0
else
#installkeybdhook
#usehook
SoundSet, 100
}
{
IfWinExist,ahk_class Notepad
WinGet,WinState,MinMax,ahk_class Notepad
If WinState = 0
WinMinimize
else
WinRestore,ahk_class Notepad
}
- divanebaba
- Posts: 805
- Joined: 20 Dec 2016, 03:53
- Location: Diaspora
Re: script that will toggle system sound on and off also other code
[EDIT: ATTENTION - Code below is incorrect!]
Hi.
I can give you only a bit syntax support.
Change to
I don't know what or how the rest of your code is doing or is processed. Hope someone else can give better support. Maybe it is a SetTitleMatchMode problem.
EDIT: Now I know.
"WinGet,WinState,MinMax,ahk_class Notepad"
ahk_class Notepad is not the title. It is something called ahk_class.
You can find the class of your desired window by using Window Spy. Look to this tread. It is in german language. Maybe you understand. Look for the pictures and find your ahk_class.
Right click on the symbol of a running ahk script at the right side of your windows taskbar. Choose Window Spy and then position your mouse over the window, you want to analyse.
Hi.
I can give you only a bit syntax support.
Change to
Code: Select all
^Delete::
Toggle := !Toggle
#installkeybdhook
#usehook
if (Toggle = Toggle)
SoundSet, 0
else
SoundSet, 100
...
EDIT: Now I know.
"WinGet,WinState,MinMax,ahk_class Notepad"
ahk_class Notepad is not the title. It is something called ahk_class.
You can find the class of your desired window by using Window Spy. Look to this tread. It is in german language. Maybe you understand. Look for the pictures and find your ahk_class.
Right click on the symbol of a running ahk script at the right side of your windows taskbar. Choose Window Spy and then position your mouse over the window, you want to analyse.
Last edited by divanebaba on 27 Jul 2017, 18:48, edited 1 time in total.
Einfach nur ein toller Typ.
-
- Posts: 10
- Joined: 27 Jul 2017, 09:39
- Location: USA
Re: script that will toggle system sound on and off also other code
That only made the toggle not work but thanks for showing me the space between the else.
- divanebaba
- Posts: 805
- Joined: 20 Dec 2016, 03:53
- Location: Diaspora
Re: script that will toggle system sound on and off also other code
[EDIT: ATTENTION - first code is untested and probably INCORRECT - Use second code ]
Oh.
Your right. It has to be something like this:
Code below is a bit different, but it is a way, I would do. #installkeybdhook and #usehook I never used, so I dont know, if it could be taken out of the hotkey
Oh.
Your right. It has to be something like this:
Code: Select all
^Delete::
if (Toggle = Toggle)
Toggle := !Toggle
#installkeybdhook
#usehook
if (Toggle = Toggle)
SoundSet, 0
else
SoundSet, 100
...
Code: Select all
#installkeybdhook
#usehook
toggle = yes
^Delete::
if (Toggle = yes)
{
SoundSet, 0
Toggle = no
}
else
{
SoundSet, 100
Toggle = yes
}
...
Einfach nur ein toller Typ.
-
- Posts: 10
- Joined: 27 Jul 2017, 09:39
- Location: USA
Re: script that will toggle system sound on and off also other code
I have fixed the issue of it not working with anything except notepad by changing ahk_class to ahk_exe and I had it opening Skype and closing it fine yesterday but when I went to try it again today the it minimized and unminimized at the same time. The last lines is me trying to minimized skype in fullscreen (I had this code yesterday aswell) and I tested to see if that was the issue and it was to a certain extent it fixed the issue of it minimizing and unminimizing at the same time but now the WinRestore line doesn't work and that's where it is now. Before I turned my computer off I tested to see if it worked and it did no one changed it overnight to my knowledge.
^Delete::
#installkeybdhook
#usehook
{
Toggle := !Toggle
if Toggle
SoundSet, 0
else
SoundSet, 100
}
{
IfWinExist,ahk_exe Skype.exe
WinGet,WinState,MinMax,ahk_exe Skype.exe
If WinState = 0
WinMinimize
else
WinRestore,ahk_exe Skype.exe
}
;IfWinExist,ahk_class tSkMainForm
;WinGet,WinState,MinMax,ahk_class tSkMainForm
;If WinState = 1
; WinMinimize
;else
;sleep 1000
;WinRestore,ahk_class tSkMainForm
^Delete::
#installkeybdhook
#usehook
{
Toggle := !Toggle
if Toggle
SoundSet, 0
else
SoundSet, 100
}
{
IfWinExist,ahk_exe Skype.exe
WinGet,WinState,MinMax,ahk_exe Skype.exe
If WinState = 0
WinMinimize
else
WinRestore,ahk_exe Skype.exe
}
;IfWinExist,ahk_class tSkMainForm
;WinGet,WinState,MinMax,ahk_class tSkMainForm
;If WinState = 1
; WinMinimize
;else
;sleep 1000
;WinRestore,ahk_class tSkMainForm
-
- Posts: 10
- Joined: 27 Jul 2017, 09:39
- Location: USA
Re: script that will toggle system sound on and off also other code
ok never mind I figured it out I needed to put a timer before the restore line
-
- Posts: 10
- Joined: 27 Jul 2017, 09:39
- Location: USA
Re: script that will toggle system sound on and off also other code
I'm working on the code that minimizes the conversation window and when I press the control and delete it minimize the window but it doesn't minimize the second window like it would normally when that's the only window there. I feel like I need to implement some kind of code that communicates with each other to allow this to happen where would I start?
Who is online
Users browsing this forum: No registered users and 315 guests