AutoHotkey Community

It is currently May 27th, 2012, 10:29 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 151 posts ]  Go to page Previous  1 ... 7, 8, 9, 10, 11  Next
Author Message
 Post subject:
PostPosted: January 17th, 2011, 12:03 pm 
Offline

Joined: January 14th, 2011, 12:47 am
Posts: 19
Thanks you were able to get me nearer to a working script! I'll post the rest in the help section ;)
Pio


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 13th, 2011, 5:47 am 
Image
(I reckon you can guess my name)

I've been working with VA.ahk, and now I've gone and changed something to make this pop up everytime I run my script. Any thoughts?


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: April 13th, 2011, 5:50 am 
Offline

Joined: October 17th, 2006, 4:15 pm
Posts: 7503
Location: Australia
A block somewhere in your script, perhaps near the end, is missing its ending brace (}). For example:
Code:
Func1() {
; } <-- missing
Func2() {  ; "Functions cannot contain functions."
}


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 13th, 2011, 5:59 am 
Lexikos wrote:
A block somewhere in your script, perhaps near the end, is missing its ending brace (}). For example:
Code:
Func1() {
; } <-- missing
Func2() {  ; "Functions cannot contain functions."
}

ah, so it was!
Thanks! With a reply that fast, I'd think this were instant messaging website :)


Report this post
Top
  
Reply with quote  
 Post subject: nonexistent function
PostPosted: May 16th, 2011, 1:28 am 
Offline

Joined: February 27th, 2011, 8:44 pm
Posts: 4
I am trying to run a script that would check if my Windows 7 laptop microphone is muted, and then mute the microphone if it is not already. I am getting Error: Call to nonexistent function. Specifically: VA_GetMasterMute("Microphone"). I am using AutoHotKey_L. The version I downloaded is AutoHotkey110000.zip. Is there something I need to do with AutoHotKeySC.bin?? Is there additional files that I need to install on my laptop? Am I using VA_GetMasterMute incorrectly? Do other particular files need to be running already for VA functions to work???
Code:
{
micMute := VA_GetMasterMute("Microphone")
if  micMute = false
    VA_SetMasterMute(true, "Microphone")
else
    VA_SetMasterMute(false, "Microphone")
}
return


EDIT: D'oh.
Reading the documentation on Libraries of Functions I found the line "path-to-the-currently-running-AutoHotkey.exe\Lib\ ; Standard library." After I put VA.ahk in to the appropriate Lib directory I stopped receiving the nonexistent function error. I also modified the code and got it working exactly as I wanted.
Code:
{
if VA_GetMasterMute("Microphone") = 0
    VA_SetMasterMute(1, "Microphone")
else
    VA_SetMasterMute(0, "Microphone")
}
return


Last edited by mario1776 on May 17th, 2011, 10:12 am, edited 1 time in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject: Re: nonexistent function
PostPosted: May 16th, 2011, 1:42 am 
Offline
User avatar

Joined: May 18th, 2010, 3:10 pm
Posts: 1179
Location: Sweden
mario1776 wrote:
I am trying to run a script that would check if my Windows 7 laptop microphone is muted, and then mute the microphone if it is not already. I am getting Error: Call to nonexistent function. Specifically: VA_GetMasterMute("Microphone"). I am using AutoHotKey_L. The version I downloaded is AutoHotkey110000.zip. Is there something I need to do with AutoHotKeySC.bin?? Is there additional files that I need to install on my laptop? Am I using VA_GetMasterMute incorrectly? Do other particular files need to be running already for VA functions to work???
Code:
{
micMute := VA_GetMasterMute("Microphone")
if  micMute = false
    VA_SetMasterMute(true, "Microphone")
else
    VA_SetMasterMute(false, "Microphone")
}
return


You might want to install the library linked in the first post of this topic. The library that has the actual function VA_GetMasterMute(). Include the function in your script, or get it working as a library (named VA.ahk, fex).

_________________
~sumon Appifyer AHK Nova halted Recommended: AHK_L (Why?)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 8th, 2011, 11:57 pm 
Offline

Joined: February 15th, 2005, 8:24 pm
Posts: 19
Location: Ludwigsburg, Germany
Hi,

since Windows Vista/7 one can setup an audio output channel for each application separately. In software like Winamp, Skype, Teamspeak you can select to which audio device the sound should be sent. Is there a possibility to do the same for AHK?

What I try to achieve concretely is to set the AHK script's audio render device to either "Realtek Digital Output" or "AMD HDMI Output" and then have the "SoundPlay" function output music/sounds to the specified render device.

Does anybody see a chance on how to achieve that? Thank you very much in advance.

_________________
In a world without walls and fences who needs windows and gates?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 29th, 2011, 9:23 am 
Offline

Joined: August 29th, 2011, 7:14 am
Posts: 1
Anonymous wrote:
hi!
sorry if this is to basic
but I just want to have a script that when you press "win"+"v" mute the sound of my computer running windows 7
I try with this script:

Code:
#v::
VA_SetMasterVolume(0)
return


the error I get is that VA doesn't exit
I copied the VA.ahk to the /lib/ directory under autohokey main path
any help wil be really appreciated
thanks!

I have the same problem
Would you tell me how to fix it
thanks


Report this post
Top
 Profile  
Reply with quote  
PostPosted: October 10th, 2011, 11:11 pm 
Offline

Joined: October 18th, 2007, 7:08 pm
Posts: 32
duveit wrote:
Is it possible with application specific sound control in windows 7 with this script?

Lets say if you only want to mute the sound in a specific program, but let others stay the same volume.


It can be done with nircmd
setappvolume [Process] [volume level] {Device Name/Index}
changeappvolume [Process] [volume level] {Device Name/Index}
muteappvolume [Process] [mute mode] {Device Name/Index}

So maybe there is a chance it could get implemented in ahk in the future.

Lexikos, any news on this?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 10th, 2011, 8:35 pm 
Offline

Joined: July 18th, 2011, 3:08 pm
Posts: 58
Awesome stuff Lexikos, thanks a ton, I had been banging against the wall with trying to get SoundGet to work correctly!


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 26th, 2012, 12:43 pm 
Offline

Joined: January 8th, 2012, 9:45 pm
Posts: 4
So there is a new Audio WinAPI Vista-Core-Audio-API

Here's a tutorial on how to use them. With some help I think we can make this work for AHK too.

http://www.codeproject.com/Articles/185 ... me-Control

http://whenimbored.xfx.net/2011/01/core-audio-for-net/


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 27th, 2012, 4:30 am 
Offline

Joined: October 17th, 2006, 4:15 pm
Posts: 7503
Location: Australia
The script which is the topic of this thread is based entirely around the Vista Core Audio API... :roll:


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 28th, 2012, 2:29 am 
Offline

Joined: January 8th, 2012, 9:45 pm
Posts: 4
Lexikos wrote:
The script which is the topic of this thread is based entirely around the Vista Core Audio API... :roll:


Yeah, just me being a bit high from reading the API from msdn. I rly hadn't looked through VA properly yet. Still trying to wrap my brain around it all.

Trying to call IAudioSessionManager::GetSimpleAudioVolume. I want to get the guid for a session too. Not sure if I have to go through an IAudioClient::Initialize to get it.

also keeping tabs of every new audio session created, than keeping track of the Peak meters. Then I'd like to listen to events.

Just trying to find some samples to get the hang of things. Just isn't that much samples to go from. Only found your topology2.ahk for now.

Image
It could be more informative, Overall. Hey at least there's something to work from. Some more examples (samples) would be great, if you got any.

Thanks for putting in the time.


Report this post
Top
 Profile  
Reply with quote  
PostPosted: February 2nd, 2012, 12:33 pm 
Offline

Joined: February 2nd, 2012, 12:23 pm
Posts: 1
Thanks For the Sound Control Code.
It solved a Problem i had.
Here is a replacement for the 'Sound' in Control Panel using your Code:-
(i am sure it can be improved)
Code:
#include va.ahk

gosub main

return
GuiClose:
ExitApp
CPAudio:
Run rundll32.exe shell32.dll`,Control_RunDLL mmsys.cpl`,`, ; use a number at end to select option
Return
CPMixer:
Run ,sndvol
Return
main:

meter_display :="playback"
Gui,1:Default
gui,1:destroy
Menu, ShowMenu, Add, S&ound(windows), CPAudio
Menu, ShowMenu, Add, Volume M&ixer(windows), CPmixer
Menu, MyMenuBar, Add, &Show, :ShowMenu
Gui, Menu, MyMenuBar
Gui, Add, Text, x500 y1 w400 h340 hwndParent         
Gui, Add, Text, x1 y200 w300 h250 hwndParent2       
Gui,Add,Button,x5 y310 gGuiClose,EXIT
Gui,Add,Button,x330 y310 gMeterMain,Show Meter

Gui, Add, Tab2,x5 y5 w450 h170 bold cblue, Playback|Capture
inout1=playback
inout2=capture
index:=1
loop 2
   {
   inout:=inout%A_index%
if A_index=1
{
Gui, Tab,Playback 
}
if A_index=2
{
Gui, Tab,Capture
}

inoutsav:=A_index
   loop
      {

      deviceid := VA_GetDevice(inout  ":" A_index)
      if deviceid>0
         {
         devicename:=VA_GetDeviceName(deviceid)
         volume := VA_GetMasterVolume(A_index,devicename)
         label:=inout%inoutsav%
         muted := VA_GetMasterMute(label)
         mutes := VA_GetMasterMute(devicename)
         channels:=VA_GetChannelCount( "1",devicename)
         ObjRelease(deviceid)
s%index%:=A_index
l%index%:=label
c%index%:=channels
n%index%:=devicename
Gui,Add,Button,y+10 gDetails v%index%, %devicename% Channels (%channels%)
index+=1
         }
      else
         {
         break
         }
      }
   }
Gui,Tab
Gui, Color, 0xF5e2A0

Gui, Show,w480 h350,Audio
return
Details:
Gui,2:destroy
Gui,1:Default
index :=A_GuiControl
Dev_seq:=s%index%
Dev_type:=l%index%
no_of_channels:=c%index%
Dev_clicked:=n%index%
meter_display :=Dev_clicked
msg :=
loop 8
{
Vol_n%A_index%:=A_index
}
;default values
vol_n1=L
vol_n2=R
if SubStr(Dev_clicked, 1 , 8) ="Speakers" ; AC97 Speakers names
{
vol_n1=L
vol_n2=R
vol_n3=C
vol_n4=Sub
vol_n5=RL
vol_n6=RR
vol_n7=SL
vol_n8=SR
}
if Dev_type = 2
{
vol_n1=Boost
vol_n2=Reserved
}
label:=inout%Dev_type%
meter_inout:=inout%Dev_type%
Dev_mute:=VA_GetMasterMute(label)
if Dev_mute= 0
{
Gui, 2:Add,Button,x10 y10 w200 gmmute vDev_mute,  Mute %label% Default Device
}
else
{
Gui, 2:Add,Button,x10 y10 w200 gmmute vDev_mute,  unMute %label% Default Device
}
Mvol:= VA_GetMasterVolume(,inout%Dev_type%)
Gui, 2:Add, text,x10 y40 cblue,1
Gui, 2:Add, Slider,x+1 w100 y40 h30 vMvol Range1-100  ToolTip gSliderMove cblue, %Mvol%
Gui, 2:Add, text,x+1 y40 cblue,100
label:=inout%Dev_type%
Seq_mute :=VA_GetMasterMute(Dev_clicked)
if Seq_mute  = 0
{
Gui, 2:Add,Button,x10 y65 gmmute vSeq_mute,  Mute %Dev_clicked%
}
else
{
if Seq_mute <>
{
Gui, 2:Add,Button,x10 y65 gmmute vSeq_mute,  unMute %Dev_clicked%
}
}
if no_of_channels >0
{
Dvol := VA_GetMasterVolume(, Dev_clicked)
Gui, 2:Add, text,x10 y95 cblue,1
Gui, 2:Add, Slider,x+1 y95 w100 h30 vDvol Range1-100  ToolTip gSliderMove, %Dvol%
Gui, 2:Add, text,x+1 y95 cblue,100
Gui, 2:Add, text, x10 y190 cblue,100
Gui, 2:Add, text, x10 y230 cblue,50
Gui, 2:Add, text,x10 y270 cblue,1
loop %no_of_channels%
{
xx:=A_index* 50
sp_dev:=vol_n%A_index%
Gui, 2:Add, text,x%xx% y160 cgreen,%sp_dev%
line_volume := VA_GetVolume(Dev_type,A_index, Dev_clicked)
Gui, 2:Add, Slider, x%xx% y180 w40 h100 invert  vertical vline_volume%A_index% Range1-100   gSliderMove, %line_volume%
}
}
Gui, 2:Add,Button,x10 y310  g2close, Close Volume Control
Gui,2:Add,Button,x200 y310 gMeter,Show Meter
Gui, 2:Color, 0xF5e2A0
Gui, 2:+Lastfound -Resize -caption -border
Gui,2:show,x1 y1 ,Child1
child1:= WinExist()

DllCall("SetParent", "UInt", child1, "Uint", parent)      ; set parent for child window 1
Gui, Show,w980 h350,Audio
return
SliderMove:
Gui, Submit, nohide
GuiControlGet, slid, FocusV
slidval :=%slid%
StringRight, slidindex, slid, 1
StringLeft, slidwhich, slid, 1
if slidwhich=M
{
;msgbox adjust master
VA_SetMasterVolume(slidval,,inout%Dev_type%)
}
if slidwhich=D
{
;msgbox adjust master with sequence
VA_SetMasterVolume(slidval,, Dev_clicked)
}
if slidwhich=l
{
;msgbox adjust sub
VA_SetVolume(slidval,Dev_type,slidindex, Dev_clicked)
}
; need to refresh as one can afect others
Gui,2:destroy
gosub Details
return
mmute:
GuiControlGet, mute_this, FocusV
; msgbox %mute_this% %Dev_type% ,%Dev_clicked%
label:=inout%Dev_type%
if mute_this=Dev_mute
{
if VA_GetMasterMute(label)
{
VA_SetMasterMute(0,label)
}
Else
{
VA_SetMasterMute(1,label)
}
}
else
{
if VA_GetMasterMute(Dev_clicked)
{
VA_SetMasterMute(0,Dev_clicked)
}
Else
{
VA_SetMasterMute(1,Dev_clicked)
}
}
Gui,2:destroy
gosub Details
return
2close:
Gui,2:destroy
gosub main
return
3close:
Gui,3:destroy
gosub main
return
MeterMain:
meter_display:="playback"
meter_inout:=inout1
Gui,2:destroy
Gui, Show,w480
Meter:
Gui,3:destroy
MeterLength = 30
audioMeter := VA_GetAudioMeter(meter_display)
VA_IAudioMeterInformation_GetMeteringChannelCount(audioMeter, channelCount)
Gui, 3:Add,Text,x10 y10, %meter_display% has %channelCount% Channels
if channelCount>0
{
loop %channelCount%
{
Gui,3:Add, Progress, w350 h10 cBlue vMyProgress%A_index%
}
Gui 3: -Caption -border
Gui, 3:Color, 0xF5e2A0
Gui, 3:+Lastfound -Resize -caption -border
Gui,3:show,x1 y1 ,Child2
child2:= WinExist()

DllCall("SetParent", "UInt", child2, "Uint", parent2)     
Gui, Show

VA_GetDevicePeriod(meter_display, devicePeriod)
Loop
{
VA_IAudioMeterInformation_GetPeakValue(audioMeter, peakValue)   
meter := MakeMeter(peakValue, MeterLength)
VarSetCapacity(peakValues, channelCount*4)
VA_IAudioMeterInformation_GetChannelsPeakValues(audioMeter, channelCount, &peakValues)
Loop %channelCount%
{
which=MyProgress%A_index%
valmeter:=MakeMeter(NumGet(peakValues, A_Index*4-4, "float"), MeterLength) * 100
GuiControl,3:, %which%, %valmeter%
gui ,3:show,NoActivate,Audio Meter
sleep 50
}
}
MakeMeter(fraction, size)
{
return fraction
}
}
return



Report this post
Top
 Profile  
Reply with quote  
PostPosted: February 21st, 2012, 10:03 pm 
I'v been looking quite much today after a script that can mute / unmute my microphone but not found one, but this thread atleast got me on the way

my code here utilize the volume up / down / mute keys in conjunction with ctrl, it only works for the second set of microphone (witch i wanted it to work for)
Code:
if VA_GetMasterMute("Microphone:2")
{
   menu, tray, icon, OFF.ico,,1
   }
else
{
   menu, tray, icon, ON.ico,,1
   }

^Volume_Mute::
;msgbox % VA_GetMute("2","Microphone:2")
;VA_SetMute(!VA_GetMute("1","Microphone:2"),"1","Microphone:2")
VA_SetMasterMute(!VA_GetMasterMute("Microphone:2"),"Microphone:2")
;msgbox % VA_GetMasterMute("Microphone:2")
CoordMode, ToolTip, Screen
if VA_GetMasterMute("Microphone:2")
{
   TrayTip, Microphone state changed, Microphone muted, 10, 1
   menu, tray, icon, OFF.ico,,1
   }
else
{
   TrayTip, Microphone state changed, Microphone unmuted, 10, 1
   menu, tray, icon, ON.ico,,1
   }
   return

^Volume_Up::   
vol_tmp := VA_GetVolume("1","","Microphone:2")
vol_Master := (vol_tmp + 5)
VA_SetVolume(vol_Master, "1" , "", "Microphone:2")
vol_new := VA_GetVolume("","","Microphone:2")
   TrayTip, Microphone state changed, "Microphone volume set to" %vol_new%, 10, 1
if VA_GetMasterMute("Microphone:2")
{
   menu, tray, icon, OFF.ico,,1
   }
else
{
   menu, tray, icon, ON.ico,,1
   }
return

^Volume_Down::
vol_tmp := VA_GetVolume("","","Microphone:2")
vol_Master := (vol_tmp - 5)
VA_SetVolume(vol_Master, "" , "", "Microphone:2")
vol_new := VA_GetVolume("","","Microphone:2")
   TrayTip, Microphone state changed, "Microphone volume set to" %vol_new%, 10, 1
if VA_GetMasterMute("Microphone:2")
{
   menu, tray, icon, OFF.ico,,1
   }
else
{
   menu, tray, icon, ON.ico,,1
   }
return

it might help someone else in the future.


Report this post
Top
  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 151 posts ]  Go to page Previous  1 ... 7, 8, 9, 10, 11  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 16 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group