Jump to content

Following Commands don't seem to work after $MB_SYSTEMMODAL call

Go to solution Solved by argumentum,

Recommended Posts

This is my post to the board. Please don't slam me. I have used AutoIt for years and have many complex (my term) functioning scripts. This one has me baffled.

I wanted to have a box on top, I'd prefer to choose the location of the pop-up. but that does not seem to be in the parameters of this SYSMODAL function. Well this code is basic. When a commercial comes up I would like to mute my PC for the $iTimeout (a countdown would also be nice but I will build that later).

I cant seem to get the volume back on when it quits. I have tried the timeout, and yes that works, but I forget I have it on mute, and would prefer a reminder. I've tried running another script to turn it back on. No joy :(

Any coders that can help? 

OBTW Thanks in advance!

Mute 30.au3

Link to comment
Share on other sites

Recommend using SplashTextOn instead, also recommend NirCmd or SoundVolumeView, both from NirSoft, the latter allows even more control of volume e.g. muting an application only, below is basic example for muting/unmuting system volume.

HotKeySet("{ESC}", _Quit)

Local $iTimeout = 30
Local $sMessage

;~ NirCmd v2.86
;~ Copyright (c) 2003 - 2019 Nir Sofer
;~ Description : NirCmd is a small command-line utility that allows you to do some useful tasks without displaying any user interface.
;~ Download    : NirCmd-64 from https://www.nirsoft.net/utils/nircmd.html

;~ Mute system volume
Run(@ScriptDir & "\nircmd-x64\nircmd.exe mutesysvolume 1", "", @SW_HIDE)

SplashTextOn("Volume Muted", "", 350, 40, @DesktopWidth - 355, @DesktopHeight-110)
For $i = $iTimeout To 0 Step - 1
    $sMessage = "Muted : " & $i & " of " & $iTimeout & " seconds remaining..."
    ControlSetText("Volume Muted", "", "Static1", $sMessage)
;~ Unmute system volume
Run(@ScriptDir & "\nircmd-x64\nircmd.exe mutesysvolume 0", "", @SW_HIDE)

Func _Quit()
    ;~ Unmute system volume
    Run(@ScriptDir & "\nircmd-x64\nircmd.exe mutesysvolume 0", "", @SW_HIDE)


Link to comment
Share on other sites

  • Solution
9 hours ago, Tip_N_Ring said:

but I forget I have it on mute

Func mute()
    For $n = 1 To 50

Func unmute()
    For $n = 1 To 50



Link to comment
Share on other sites

Have a look here: https://www.autoitscript.com/forum/topic/84834-control-vista-master-volume/

In the above UDF There are some audio functions to control volume and other audio managements;
here a small example of use for 'Activate', 'Deactivate' or 'Invert' (toggle) the audio state


#include <GUIConstantsEx.au3>

; get following UDF here:
; https://www.autoitscript.com/forum/topic/84834-control-vista-master-volume/
#include <_AudioEndpointVolume.au3>

$hGUI = GUICreate('Audio Boss', 140, 40)

$hOff = GUICtrlCreateButton("Off", 10, 10, 40)
$hOn = GUICtrlCreateButton("On", 50, 10, 40)
$hToggle = GUICtrlCreateButton("Toggle", 90, 10, 40)

; Loop until the user exits.
While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
        Case $hOff
            _SetMute(1)    ; 1 = Mute audio
        Case $hOn
            _SetMute(0)    ; 0 = Unmute audio
        Case $hToggle
            _SetMute((Not _GetMute()) * 1)     ; Toggle current state




image.jpeg.9f1a974c98e9f77d824b358729b089b0.jpeg Chimp

small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...