Sunday, August 3, 2014

Automation Crazy

I'm really enjoying using AutoHotKey.  I wrote a general blog entry regarding this program HERE   I have had a couple updates since.  Now I have a total of 6 scripts running and it makes running the station MUCH easier and safer.  To tune my solid state amp for example I had to 

put the amp in standby
choose the right band 
make sure the right antenna was selected
hit tune on the radio
hit tune on the tuner
turn off tune on the radio
switch the amp from standby to operate

screw up on the order or forget a step in the middle of trying to get ready to call some DX and you might just have disaster on your hands.

DDUtil has a macro function.  I am running 2 versions of DDUtil.  Version 3 for the 6300 and Version 2 for PSDR_mRX.  Both rigs have associated tuners.  My Anan radio is connected to my 43ft vertical so every band change needs a tune.  So I wrote scripts and made macro's  for both radio stations 


DDUtil V3

F1 turns off the amplifier and turn on tune DD6TXL0:0;DD6TXT1;
F2 turns off tune and turns the amp back on DD6TXL0:0;DD6TXT1;

I consider these perhaps the most important since I don't want to try and tune my tuner under a KW of power under any circumstance.  The tuner and amp are pretty well protected but if I can do this in a absolutely safe way using macros then why not.

The macros in DDutil v2 are 

F3 turns on tune ZZTU1;
F4 turns off tune ZZTU1;

I don't have an amp on this radio (yet) but the added amp command looks like it should be some variation on ZZOF or ZZOG.  I'm not sure exactly how PSDR for the Anan is going to react to those so there is some ohmin' left to do on the tx ports.  

Thus far we have improved the workflow slightly   We have to: bring the correct DDUTIL into focus by clicking on it.  Click DDUtil v3 then press F1/F2 to shut off the amp and toggle tuning the 6300 or highlight DDUtil v2 and press F3/F4 to toggle tuning in the case of Anan.   We still have to change bands on the amp and antennas on the antenna switch by hand but since the amp is always off when I tune, there is never any danger.  In fact I generally change the amp band switch while tuning since the amp is off, to save time.  Press F1 change band switch on amp, press f2.  Eventually I will automate the amp and band switching as well as my hardware supports that.

Better and safer but still a lot of clicking.  So how can we remedy that?  Write a script of course!

I have AutoHotKey installed so all you have to do is right click the desktop then New > AutoHotKey Script.  A blank script is created ready to be named.  My first script is called DDUTILTUNE.ahk  You need the .ahk

The verbiage added 

;sets ddutil v 3 avtive for tuning SmartSDR F1 tunes F2 stops according to DDUTIL macros. F1 F1 
; tune on DD6TXL0:0;DD6TXT1;    tune off DD6TXT0;DD6TXL0:1;  This shuts off linear tunes then turns linear


WinActivate, DDUtil 3.

The hot key is Ctl-F1  so if you press Ctl-F1 with this script active DDUTIL v3 will highlight.  If you then release Ctl and press F1 the radio will shut off the amp and tune.  If you press F2 the reverse: tune off-amp on.  Very compact fast and fool proof.  

I tried to get the script to highlight SmartSDR using Ctl-F2 by adding another script but SmartSDR would not respond to the WinActivate command.  I'm not exactly sure why,

For PSDR and DDUtil v2 I did this with a new script called DDUtilv2Tune.ahk (remember the .ahk is important it is what identifies the script to the parser)


The verbiage 

;This script sets DDUtil v2 active  Tune in ddutil F3 tune on ZZTU1; tune off F4 ZZTU0;


WinActivate, DDUtil 2.

I included the ddutil macro commands in the description so I don't have to wade through a billion commands in case I ever need to repopulate the macro table.

This script will maximize DDutil and set it into focus when I press Ctl-F3.  I then press F3 to tune F4 to tune off.  

I wrote another script to complete the actions

PSDR.ahk (you see you remember about .ahk :))


The Verbiage

; this script minimizes DDUtil v 2, sets PSDR active and returns it to its previous max/min setting


WinMinimize, DDUtil 2.
WinActivate, PowerSDR
;WinRestore, A

When you press Ctl-F4 DDUtil minimized and sets PowerSDR to the focus and returns it to its former size.  I tend to run PSDR in a less than max screen 

I placed the scripts in the startup folder by typing shell:startup in the run line and copy/paste to the folder

This way the scripts will run with every restart.  

So there you have it!   I can tune my patootie off with just a few keyboard hot keys therefore reducing confusion and improving work flow and never worry the first instant about blowing things up.  

73  W9OY