Remixed Posted August 2, 2015 Share Posted August 2, 2015 Hey, I'm fairly new to Autoit. I am trying to get Autoit to press F11(Xsplit PPT key) when I press my Mouse4(X1) button. This is what I have so far and I'm not sure what else to do. I looked into the function _IsPressed and the send function. My script is telling me that WEnd on the last line is giving me an error. Any help would be appreciated, thanks!#cs ---------------------------------------------------------------------------- AutoIt Version: 3.3.14.1 Author: Script Function: Turns on Push to talk button for Xsplit.#ce ----------------------------------------------------------------------------#include <Misc.au3>; Press Esc to terminate script, Pause/Break to "pause"Global $g_bPaused = FalseHotKeySet("{PAUSE}", "TogglePause")HotKeySet("{ESC}", "Terminate")HotKeySet("{X1}", "PPT")Func Terminate()Exit 1EndFuncFunc TogglePause() $g_bPaused = Not $g_bPaused While $g_bPaused Sleep(100) ToolTip('Script is "Paused"', 0, 0) WEnd ToolTip("") EndFuncFunc PPT()$pressed = 0While 1 If _IsPressed("05") Then If Not $pressed Then ToolTip("PPT is turned on") Send("{F11}") $pressed = 1 EndIf Sleep(250) EndFunc WEnd Link to comment Share on other sites More sharing options...
ViciousXUSMC Posted August 3, 2015 Share Posted August 3, 2015 (edited) You can't rebind the key directly in XSplit?As far as your code, I would imagine its because you put EndFunc before your WEnd. Also you have two If statements and only a single EndIf.But I also think what you want to do here is better to do without a loop, as if your in your loop your other functions are not going to work.The last time I did a "toggle" I handled it like this.If $nMsg = $Button13 Then $sound += 1 If Mod($sound, 2) = 0 Then SoundPlay("") Else SoundPlay(@TempDir & "\miketyson.mp3") EndIf EndIfIn your case you would strip off the first if statement and can put that in your function. Something like this perhaps. Func PPT() $vPPT += 1 If Mod($vPPT, 2) = 0 Then Send("{F11}") Tooltip("PPT is ON") Else Send("{F11}") Tooltip("PPT is OFF") EndFuncThis is assuming you have F11 set to toggle PPT, if you need to hold it down you would need some slightly different commands, still I think much of what you need to do you can do from XSplit itself to help make your code easier to manage. Also you may have already paid for XSplit and that is fine, but I left that program a while back from OBS (Open Broadcaster) and have not looked back as its a great free alternative. Edited August 3, 2015 by ViciousXUSMC Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now