Join 2 Working Scripts to Toggle

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
jakfish
Posts: 3
Joined: 13 Apr 2018, 07:09

Join 2 Working Scripts to Toggle

13 Apr 2018, 07:17

Hello,

Thanks to Autohotkey, I'm resuscitating an old Sony Vaio running Vista, and I would like to combine these two working scripts so I can toggle the disabling/enabling of my bluetooth.

Enable:

@echo off
set source=%~dp0
if "%source%x"=="x" set source=.\
"%source%devcon" Enable "USB\VID_044E&PID_3017&REV_0227" >NUL 2>&1
"%source%devcon" Enable "USB\VID_044E&PID_3017" >NUL 2>&1

Disable:

@echo off
set source=%~dp0
if "%source%x"=="x" set source=.\
"%source%devcon" Disable "USB\VID_044E&PID_3017&REV_0227" >NUL 2>&1
"%source%devcon" Disable "USB\VID_044E&PID_3017" >NUL 2>&1

Many thanks for any help/pointers,
Jake
jakfish
Posts: 3
Joined: 13 Apr 2018, 07:09

Re: Join 2 Working Scripts to Toggle

13 Apr 2018, 08:00

I have a primitive addition to my AHK:

#Persistent
#SingleInstance
!2::
toggle:=!toggle
if toggle
{
Run "C:\BTutilities\disable_BT.cmd"
}
else
{
Run "C:\BTutilities\enable_BT.cmd"
}
Return

This just alternates b/w the enabling/disabling scripts regardless of the actual state of bluetooth. Since the bluetooth icon in the systray appears when bluetooth is activated, that's the litmus test of whether or not bluetooth is available.
User avatar
derz00
Posts: 497
Joined: 02 Feb 2016, 17:54
Location: Middle of the round cube
Contact:

Re: Join 2 Working Scripts to Toggle

13 Apr 2018, 09:55

Figured it out, or do you still have a question?
try it and see
...
jakfish
Posts: 3
Joined: 13 Apr 2018, 07:09

Re: Join 2 Working Scripts to Toggle

13 Apr 2018, 10:10

Thank you for your follow-up.

I don't know if I should mark this post as solved since it's a toggle based merely on alternating scripts rather truly gauging if bluetooth is on, then disabling, or vice-versa.

Do you have an opinion about that?
User avatar
derz00
Posts: 497
Joined: 02 Feb 2016, 17:54
Location: Middle of the round cube
Contact:

Re: Join 2 Working Scripts to Toggle

13 Apr 2018, 10:13

Oh yes I see what you mean. Hmm no I wouldn't know how to check that.
try it and see
...

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Joey5, mikeyww, RandomBoy, wpulford and 376 guests