; Small AutoHotkey script to use the arrow keys, letters and numbers in the Perseus receiver software (by Nico Palermo) ; Modified version with special commands to perform ShuttleProV2 USB Human interface (by WoodBoxRadio) ;************************************************************************************************************** ; Help: ; Right arrow => Equ. to the mouseWheel down ; Left arrow => Equ. to the mouseWheel up ; Shift + Right arrow => Equ. to 10 notches of the mouseWheel down ; Shift + Left arrow => Equ. to 10 notches of the mouseWheel up ; Down arrow => Decrease span (wider traces on the waterfall) ; Up arrow => Increase span (narrower traces on the waterfall) ; PageDown => Decrease "wheel step" ; PageUp => Increase "wheel step" ; < => Decrease "CF STEP" ; > => Increase "CF STEP" ; / => Decrease "Ref Lev (dBm)" ; * => Increase "Ref Lev (dBm)" ; Enter => Opens the "Frequency (KHz) dialog for input, then close the keypad (with another Enter) ; 1, 2, 3, 4, 5, 6, 7, 8, 9, 0 => Open the freq dialog, send this number, add the others and close (with Enter) ; a, s, c, r, l, u, f, d, e => Activate Modes: AM, SAM, CW, RTTY, LSB, USB, FM, DRM, usEr ; +, - (from Numpad) => Activate "USB" and "LSB" (as "u" and "l", but more quickly) ; - => Tuning up fm value of CF Step ; _ => Tuning up fm value of CF Step ; w => switch to waterfall ; t => switch to spectrum ; x => Center frequency in spectrum or waterfall ; o => Toggle Zoom the frequency in waterfall ; b => Toggle Noise Blanker ON/OFF ; n => Toggle Noise Reducer ON/OFF ; j => Toggle "SpkRej" on off ; h => Activate Notch (to deactivate use "y" PBT) ; y => Activate PBT (to deactivate use "h" Notch and so on) ; g => Activate Autonotch ; m => 1. Mute or Activate Volume ; m => 2. after a frequencies input it means "MHz" and close the frequency input window ; k => 1. CWPeak ; k => 2. after a frequencies input it means "kHz" and close the frequency input window ; z => Wave Files change ; Shift q, ALT-F4 => Close Perseus and also the script ; Tab => Jump forwards in the PLAYBACK bar by the specified number of seconds ; Shift+Tab => Jump backwards in the PLAYBACK bar by the specified number of seconds ; Ctrl+Tab => A dialog will appear where the PLAYBACK jump step and the WAV file length can be changed ; Remarks to the PLAYBACK supporting features: ; 1. The jumps are relative to the current playback position, though there are some limitations. ; 2. The jumps begin relative to the start of the playback bar. The position will be set back by a z-keystroke. ; 3. Close to the end of the playback bar a Tab-keystroke will lead to jump to the start of the playback bar. ; 4. When jumping backwards the limit will be the start of the playback bar. ; (C) Laurent Haas - F6FVY - Nov 2008 (f6fvy _at_ free.fr) ; modified by Aldo Moroni (IW2DZX) and Salvo Micciche' (SWL IT9-4639) ; modified by WoodBoxRadio (IK3VIG) ; extended by Ferdinand Lenhardt (perseus_only) ; Thanks to Wolfgang OE1MWW for some important tips ; ; Version 3.2 - Jun 05 2010 ; tested with Perseus 2.1i and 3.0beta ;************************************************************************************************* #SingleInstance force ; skips the dialog box and replaces a previous instance of this script automatically #NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases. SendMode Input ; Recommended for new scripts due to its superior speed and reliability. SetDefaultMouseSpeed, 0 ; Move the mouse instantly. ; don't remove the above line: it try to avoid to run the script with another window called "Perseus" ; that's not the Perseus receiver software SetTitleMatchMode RegEx ;*** BEGIN of the PLAYBACK parameter section *** ; The following parameters may be changed and specify the default values playback_step = 10 ; seconds (how many seconds to jump forwards or backwards on each keystroke) playback_minutes = 5 ; minutes (the minutes part of the WAV file length) playback_seconds = 0 ; seconds (the seconds part of the WAV file length) ; The following parameters shouldn't be changed playback_bar_start = 180 playback_bar_end = 1011 playback_bar_vpos = 603 playback_position := playback_bar_start playback_last_timestamp = 0 PlaybackJump(seconds) { global return (playback_bar_end - playback_bar_start) / (((playback_minutes * 60) + playback_seconds) / seconds) } ;*** END of the PLAYBACK parameter section *** ;function for "Frequency" window sendToFreqWnd(key) { Click,,100,245,2 WinWait,ahk_class#32770 ControlFocus,Edit1,ahk_class#32770 ControlClick,Edit1,ahk_class#32770,LEFT IfWinNotActive,ahk_class#32770 WinActivate Click,,110,45 Send %key% return } ;function for background mouse operation with recovery of the mouse cursor position UnnoticeableClick(xpos,ypos,attr="",clicks=1) { CoordMode,Mouse,Screen MouseGetPos,cxpos,cypos CoordMode,Mouse,Relative Click,%attr%,%xpos%,%ypos%,%clicks% CoordMode,Mouse,Screen Click,,%cxpos%,%cypos%,0 return } ; Activate Perseus if it isn't already active (with "realtime" priority) IfWinExist Perseus ahk_class (Afx:400000:2028:|Afx:00400000:2028:) { WinActivate } else { Run Perseus,,UseErrorLevel,NewPID if ErrorLevel = ERROR { MsgBox Can't find the Perseus program.`n`nCheck PerseusKeyboard and the Perseus software`nare located in the same directory. ExitApp } Process,Priority,%NewPID%,Realtime WinWait Perseus ahk_class (Afx:400000:2028:|Afx:00400000:2028:) WinActivate } #IfWinActive Perseus ahk_class (Afx:400000:2028:|Afx:00400000:2028:) { ;### Frequency -100Hz Down:: UnnoticeableClick(587,290,"WU") return ;### Frequency -1kHz Delete:: Loop 10 { UnnoticeableClick(587,290,"WU") Sleep 1 } return ;### Frequency +100Hz Up:: UnnoticeableClick(587,290,"WD") return ;### +Right:: PgDn:: Loop 10 { UnnoticeableClick(587,290,"WD") Sleep 1 } return ;### Span Decrease [:: UnnoticeableClick(135,295) return ;### Span Increase ]:: UnnoticeableClick(150,295) return ;### Wheel Step Home:: UnnoticeableClick(157,376) return ;### Wheel Step PgUp:: UnnoticeableClick(132,376) return ;### Frequency -5kHz Left:: UnnoticeableClick(192,309) return ;### Frequency +5kHz Right:: UnnoticeableClick(987,308) return -:: UnnoticeableClick(130,333) return _:: UnnoticeableClick(155,334) return /:: NumpadDiv:: UnnoticeableClick(133,152,"ARROWD") return *:: NumpadMult:: UnnoticeableClick(157,152,"ARROWU") return t:: +t:: UnnoticeableClick(227,309) return w:: +w:: UnnoticeableClick(263,309) return b:: +b:: UnnoticeableClick(518,403) return n:: +n:: UnnoticeableClick(969,402) return ;Activate keypad ;the "Frequency (KHz) window should stay on its normal position to work better ;there are two Enter (see the last function and don't remove) Enter:: NumpadEnter:: sendToFreqWnd("{Space}{BS}") return 0:: Numpad0:: sendToFreqWnd("0") return 1:: Numpad1:: sendToFreqWnd("1") return 2:: Numpad2:: sendToFreqWnd("2") return 3:: Numpad3:: sendToFreqWnd("3") return 4:: Numpad4:: sendToFreqWnd("4") return 5:: Numpad5:: sendToFreqWnd("5") return 6:: Numpad6:: sendToFreqWnd("6") return 7:: Numpad7:: sendToFreqWnd("7") return 8:: Numpad8:: sendToFreqWnd("8") return 9:: Numpad9:: sendToFreqWnd("9") return ;LSB l:: +L:: NumPadSub:: UnnoticeableClick(408,353) return ;USB u:: +U:: NumPadAdd:: UnnoticeableClick(455,353) return ;AM a:: +A:: UnnoticeableClick(204,353) return ;SAM s:: +S:: UnnoticeableClick(259,353) return ;CW +c:: C:: UnnoticeableClick(310,353) return ;RTTY r:: +R:: UnnoticeableClick(362,353) return ;FM f:: +F:: UnnoticeableClick(508,353) return ;DRM d:: +D:: UnnoticeableClick(561,353) return ;User e:: +E:: UnnoticeableClick(594,353) return ;SpkRej j:: +j:: UnnoticeableClick(562,458) return ;PBT y:: +y:: UnnoticeableClick(260,546) return ;Notch h:: +h:: UnnoticeableClick(300,546) return ;Autonotch g:: +g:: UnnoticeableClick(340,546) return ;CWPeak k:: +k:: UnnoticeableClick(380,546) return ;Mute or Activate Volume m:: +m:: UnnoticeableClick(1002,405) return ;Center frequency x:: +x:: UnnoticeableClick(23,422) return ;Zoom frequency o:: +o:: UnnoticeableClick(300,310) return ;Wave file change (if it's a single file it works as "rewind") z:: +z:: UnnoticeableClick(playback_bar_end,playback_bar_vpos) playback_position := playback_bar_start playback_last_timestamp := A_TickCount Sleep, 1000 return ;*** BEGIN of the PLAYBACK hotkey section *** Tab:: playback_current_timestamp := A_TickCount if(playback_last_timestamp = 0 or playback_last_timestamp > playback_current_timestamp) { playback_last_timestamp := playback_current_timestamp } playback_position += PlaybackJump((playback_current_timestamp - playback_last_timestamp) / 1000) playback_last_timestamp := playback_current_timestamp if(playback_position > (playback_bar_end - 1)) { playback_position := playback_bar_start + mod(playback_position - playback_bar_start, playback_bar_end - playback_bar_start) } playback_position += PlaybackJump(playback_step) if(playback_position > (playback_bar_end - 1)) { playback_position := playback_bar_start } UnnoticeableClick(playback_position,playback_bar_vpos) Sleep, 100 return +Tab:: playback_current_timestamp := A_TickCount if(playback_last_timestamp = 0 or playback_last_timestamp > playback_current_timestamp) { playback_last_timestamp := playback_current_timestamp } playback_position += PlaybackJump((playback_current_timestamp - playback_last_timestamp) / 1000) playback_last_timestamp := playback_current_timestamp if(playback_position > (playback_bar_end - 1)) { playback_position := playback_bar_start + mod(playback_position - playback_bar_start, playback_bar_end - playback_bar_start) } if(playback_position > (playback_bar_start + PlaybackJump(1))) { playback_position -= PlaybackJump(playback_step) if(playback_position < playback_bar_start) { playback_position := playback_bar_start } UnnoticeableClick(playback_position,playback_bar_vpos) } Sleep, 100 return ^Tab:: InputBox,playback_step_tmp,PLAYBACK,Step (in seconds),,160,130,,,,,%playback_step% if !ErrorLevel { if playback_step_tmp is digit { if(playback_step_tmp > 0) { playback_step := playback_step_tmp InputBox,playback_minutes_tmp,PLAYBACK,Minutes,,160,130,,,,,%playback_minutes% if !ErrorLevel { if playback_minutes_tmp is digit { if(playback_minutes_tmp >= 0 and playback_minutes_tmp <= 59) { playback_minutes := playback_minutes_tmp InputBox,playback_seconds_tmp,PLAYBACK,Seconds,,160,130,,,,,%playback_seconds% if !ErrorLevel { if playback_seconds_tmp is digit { if(playback_seconds_tmp >= 0 and playback_seconds_tmp <= 59) { playback_seconds := playback_seconds_tmp } else { MsgBox,0x10,Error,Seconds invalid } } else { MsgBox,0x10,Error,Seconds invalid } } } else { MsgBox,0x10,Error,Minutes invalid } } else { MsgBox,0x10,Error,Minutes invalid } } } else { MsgBox,0x10,Error,Step invalid } } else { MsgBox,0x10,Error,Step invalid } } return ;*** END of the PLAYBACK hotkey section *** ;Close Perseus and the script +q:: !F4:: UnnoticeableClick(1010,12) ExitApp return ; Automatically Close keypad after freq input ;please, keep these lines at the end #IfWinActive Frequency ahk_class#32770 ; for frequencies in kHz Enter:: NumpadEnter:: k:: +k:: click,,64,184 click,,104,186 return ; for frequencies in MHz m:: +m:: click,,33,184 click,,104,186 return }