Amateurfunk: Hytera CPS und automatischer Import (Codeplug)

Hallo zusammen,

seit kurzem bin ich auch im DMR-Netz QRV ;-) Machen wir hier auf unserer IT-Seite doch mal einen kleinen Exkurs in ein sehr spannendes Themengebiet: Amateurfunk!
Als Gerät nutze ich aktuell ein Hytera MD785G, wobei hier die Konfigurations-Software leider ein graus in meinen Augen darstellt.
Um dennoch nicht alle Kanäle manuell an dem Gerät zu konfigurieren, habe ich mir ein kleines Skript gebaut, welches einen Import aller Repeater vornimmt. Das Skript ist aktuell so aufgebaut, dass es:
– mind. 2 Zonen für jedes Bundesland erstellt (1x für Scan- und Roaming-Kanäle und die restlichen für alle Relais)
– Pro Bundesland jeweils Roaming-Listen anlegt und diese in dedizierte Kanäle speichert
– Pro Bundesland jeweils Scan-Listen anlegt und diese ebenfalls in dedizierte Kanäle speichert
– …

Um das ganze zu Realisieren, habe ich mir das Tool AutoIT zur Hilfe genommen. Weiterhin habe ich versucht alle Repeater (Analog und Brandmeister/DMR) automatisiert in eine CSV zu packen. (Sollten hier weitere Infos benötigt werden, kurzer Kommentar – dann melde ich mich). Schwierigkeit war hierbei für mich, eine automatisierte Zuordnung der Repeater mit der vorliegenden Stadt in die einzelnen Bundesländer hinzubekommen. Dies konnte ich aber letztendlich auch mit „sehr komplexen Mitteln“ komplett automatisiert lösen :-)

Hier das AutoIT Skript für euch:

#include <TrayConstants.au3>
#include <GUIConstants.au3>
#include <string.au3>
#include <GUIListView.au3>
TraySetState($TRAY_ICONSTATE_SHOW)

$hGUI = "Customer Programming Software"
$hTitle = "CPS Import Script"
$sleep_low = 700
$sleep_high = 1400

$filename = "C:\Scripte\channels.csv"
; Format der Datei, Beispiele:
; <DMRID>;<Stadt>;<Bundesland>;<QRG>;<Offset>;<CTCSS>
; 262330;DB0TVH;Hannover/Stadt;NIEDERSACHSEN;439.58750;-7.600;
; 262320;DB0ATS;Hannover/Messe;NIEDERSACHSEN;439.97500;-9.400;
; -1;DB0FUS;Hannover;NIEDERSACHSEN;439.200;-7.6;85.4

$do_channel_digital = False
$do_channel_analog = False
$do_list_roaming = False
$do_list_scan = False
$do_channel_roaming = False
$do_channel_scan = True
$do_zones = False

; -----------------------------------------------------------------------------------------------------------
;
; Data Source
;
$file = FileOpen($filename, 0)
If $file = -1 Then
   MsgBox(0, "error", "File doesn't exist or can't be read")
   Exit
EndIf

; -----------------------------------------------------------------------------------------------------------
;
; Digital Channel
;
If($do_channel_digital) Then
   Call("SleepMe")
   ControlClick($hGUI, "", "[CLASSNN:SysTreeView321]")
   Send("!e")
   Send("{DOWN 2} {RIGHT}")
   Send("{DOWN 2} {RIGHT}")
   Send("{ENTER}")
   Call("SleepMe", false)
   ControlClick($hGUI, "", "[CLASSNN:Button44]")
   Call("SleepMe", false)
   ControlClick($hGUI, "", "[CLASSNN:Button44]")
   ; Import Digital Channel
   FileSetPos($file, 0, 0)
   While 1
	  Local $line = FileReadLine($file)
	  If @error = -1 Then ExitLoop
	  $input = StringSplit($line, ";")
	  If($input[1] <> "-1") Then
		 Call("AddChannelDigital", $input[2] & "-1 " & $input[3], 1, $input[5], $input[6])
		 Call("AddChannelDigital", $input[2] & "-2 " & $input[3], 2, $input[5], $input[6])
	  EndIf
   WEnd
   Call("SleepMe", false)
   ControlClick($hGUI, "", "[CLASSNN:Button38]")
   Call("SleepMe", false)
EndIf
;
; -----------------------------------------------------------------------------------------------------------
;
; Analog Channel
;
If($do_channel_analog) Then
   Call("SleepMe")
   ControlClick($hGUI, "", "[CLASSNN:SysTreeView321]")
   Send("!e")
   Send("{DOWN 2} {RIGHT}")
   Send("{DOWN 2} {RIGHT}")
   Send("{DOWN}")
   Send("{ENTER}")
   Call("SleepMe", false)
   ControlClick($hGUI, "", "[CLASSNN:Button31]")
   Call("SleepMe", false)
   ControlClick($hGUI, "", "[CLASSNN:Button31]")
   ; Import Analog Channel
   FileSetPos($file, 0, 0)
   While 1
	  Local $line = FileReadLine($file)
	  If @error = -1 Then ExitLoop
	  $input = StringSplit($line, ";")
	  If($input[1] == "-1") Then
		 Call("AddChannelAnalog", $input[2] & " " & $input[3], $input[5], $input[6], $input[7])
	  EndIf
   WEnd
   Call("SleepMe", false)
   ControlClick($hGUI, "", "[CLASSNN:Button25]")
   Call("SleepMe", false)
EndIf
;
; -----------------------------------------------------------------------------------------------------------
;
; Roaming Lists
;
If($do_list_roaming) Then
   Call("SleepMe")
   ControlClick($hGUI, "", "[CLASSNN:SysTreeView321]")
   Send("!e")
   Send("{DOWN 2} {RIGHT}")
   Send("{DOWN 7}")
   Send("{ENTER}")
   Call("SleepMe", false)
   ControlClick($hGUI, "", "[CLASSNN:Button15]")
   Call("SleepMe", false)
   ControlClick($hGUI, "", "[CLASSNN:Button15]")
   ; Import Roam Lists
   For $ts=1 to 2
	  FileSetPos($file, 0, 0)
	  $state=""
	  $counterlist=1
	  $counteritem=1
	  While 1
		 Local $line = FileReadLine($file)
		 If @error = -1 Then ExitLoop
		 $input = StringSplit($line, ";")
		 if($state <> $input[4]) Then
			$state=$input[4]
			$counterlist=1
			$counteritem=1
			Call("AddListRoaming", "R TS" & $ts & " " & $counterlist & " " & $state)
		 EndIf
		 If($counteritem > 31) Then
			$counteritem = 1
			$counterlist = $counterlist + 1
			Call("AddListRoaming", "R TS" & $ts & " " & $counterlist & " " & $state)
		 EndIf
		 If($input[1] <> "-1") Then
			Call("AddChannelListRoaming", StringLeft($input[2] & "-" & $ts & " " & $input[3], 16))
			$counteritem = $counteritem + 1
		 Else
		 EndIf
	  WEnd
   Next
   Call("SleepMe", false)
   ControlClick($hGUI, "", "[CLASSNN:Button9]")
   Call("SleepMe", false)
EndIf
;
; -----------------------------------------------------------------------------------------------------------
;
; Scan Lists
;
If($do_list_scan) Then
   Call("SleepMe")
   ControlClick($hGUI, "", "[CLASSNN:SysTreeView321]")
   Send("!e")
   Send("{DOWN 2} {RIGHT}")
   Send("{DOWN 6}")
   Send("{ENTER}")
   Call("SleepMe", false)
   ControlClick($hGUI, "", "[CLASSNN:Button18]")
   Call("SleepMe", false)
   ControlClick($hGUI, "", "[CLASSNN:Button18]")
   ; Import Scan Lists
   $state=""
   $counterlist=1
   $counteritem=1
   ; Read in lines of text until the EOF is reached
   FileSetPos($file, 0, 0)
   While 1
	  Local $line = FileReadLine($file)
	  If @error = -1 Then ExitLoop
	  $input = StringSplit($line, ";")
	  if($state <> $input[4]) Then
		 $state=$input[4]
		 $counterlist=1
		 $counteritem=1
		 Call("AddListScan", "Scan " & $counterlist & " " & $state)
	  EndIf
	  If($counteritem > 31) Then
		 $counteritem = 1
		 $counterlist = $counterlist + 1
		 Call("AddListScan", "Scan " & $counterlist & " " & $state)
	  EndIf
	  If($input[1] <> "-1") Then
		 Call("AddChannelListScan", StringLeft($input[2] & "-1 " & $input[3], 16))
		 $counteritem = $counteritem + 1
		 If($counteritem > 31) Then
			$counteritem = 1
			$counterlist = $counterlist + 1
			Call("AddListScan", "Scan " & $counterlist & " " & $state)
		 EndIf
		 Call("AddChannelListScan", StringLeft($input[2] & "-2 " & $input[3], 16))
	  Else
		 Call("AddChannelListScan", StringLeft($input[2] & " " & $input[3], 16))
	  EndIf
	  $counteritem = $counteritem + 1
   WEnd
   Call("SleepMe", false)
   ControlClick($hGUI, "", "[CLASSNN:Button12]")
   Call("SleepMe", false)
EndIf
;
; -----------------------------------------------------------------------------------------------------------
;
; Roaming Channel
;
If($do_channel_roaming) Then
   Call("SleepMe", false)
   Call("SleepMe", false)
   ControlClick($hGUI, "", "[CLASSNN:SysTreeView321]")
   Send("!e")
   Send("{DOWN 2} {RIGHT}")
   Send("{DOWN 2} {RIGHT}")
   Send("{ENTER}")
   Call("SleepMe", false)
   Call("SleepMe", false)
   ControlClick($hGUI, "", "[CLASSNN:Button44]")
   Call("SleepMe", false)
   Call("SleepMe", false)
   ControlClick($hGUI, "", "[CLASSNN:Button44]")
   Call("SleepMe", false)
   Call("SleepMe", false)
   $state=""
   $roamlist=0
   $counterlist=1
   $counteritem=1
   ; Read in lines of text until the EOF is reached
   For $ts=1 to 2
	  FileSetPos($file, 0, 0)
	  While 1
		 Local $line = FileReadLine($file)
		 If @error = -1 Then ExitLoop
		 $input = StringSplit($line, ";")
		 if($state <> $input[4]) Then
			$state=$input[4]
			$counterlist=1
			$counteritem=1
			Call("AddChannelDigital", "R TS" & $ts & " " & $counterlist & " " & $state, $ts, "433.000", "-2.0", $roamlist)
			$roamlist = $roamlist + 1
		 EndIf
		 If($counteritem > 31) Then
			$counteritem = 1
			$counterlist = $counterlist + 1
			Call("AddChannelDigital", "R TS" & $ts & " " & $counterlist & " " & $state, $ts, "433.000", "-2.0", $roamlist)
			$roamlist = $roamlist + 1
		 EndIf
		 If($input[1] <> "-1") Then
			$counteritem = $counteritem + 1
		 Else
		 EndIf
	  WEnd
   Next
   Call("SleepMe", false)
   ControlClick($hGUI, "", "[CLASSNN:Button38]")
   Call("SleepMe", false)
EndIf
;
; -----------------------------------------------------------------------------------------------------------
;
; Scan Channel
;
If($do_channel_scan) Then
   Call("SleepMe", false)
   Call("SleepMe", false)
   ControlClick($hGUI, "", "[CLASSNN:SysTreeView321]")
   Send("!e")
   Send("{DOWN 2} {RIGHT}")
   Send("{DOWN 2} {RIGHT}")
   Send("{ENTER}")
   Call("SleepMe", false)
   Call("SleepMe", false)
   Call("SleepMe", false)
   Call("SleepMe", false)
   ControlClick($hGUI, "", "[CLASSNN:Button44]")
   Call("SleepMe", false)
   Call("SleepMe", false)
   Call("SleepMe", false)
   Call("SleepMe", false)
   ControlClick($hGUI, "", "[CLASSNN:Button44]")
   $state=""
   $scanlist=0
   $counterlist=1
   $counteritem=1
   ; Read in lines of text until the EOF is reached
   FileSetPos($file, 0, 0)
   While 1
	  Local $line = FileReadLine($file)
	  If @error = -1 Then ExitLoop
	  $input = StringSplit($line, ";")
	  if($state <> $input[4]) Then
		 $state=$input[4]
		 $counterlist=1
		 $counteritem=1
		 Call("AddChannelDigital", "Scan " & $counterlist & " " & $state, 1, "433.000", "-2.0", -1, (($counterlist-1)*14)+$scanlist)
		 $scanlist = $scanlist + 1
	  EndIf
	  If($counteritem > 31) Then
		 $counteritem = 1
		 $counterlist = $counterlist + 1
		 Call("AddChannelDigital", "Scan " & $counterlist & " " & $state, 1, "433.000", "-2.0", -1, (($counterlist-1)*14)+$scanlist)
	  EndIf
	  If($input[1] <> "-1") Then
		 $counteritem = $counteritem + 1
		 If($counteritem > 31) Then
			$counteritem = 1
			$counterlist = $counterlist + 1
			Call("AddChannelDigital", "Scan " & $counterlist & " " & $state, 1, "433.000", "-2.0", -1, (($counterlist-1)*14)+$scanlist)
		 EndIf
	  Else
	  EndIf
	  $counteritem = $counteritem + 1
   WEnd
   Call("SleepMe", false)
   ControlClick($hGUI, "", "[CLASSNN:Button38]")
   Call("SleepMe", false)
   Call("SleepMe", false)
EndIf
;
; -----------------------------------------------------------------------------------------------------------
;
; Zones
;
If($do_zones) Then
   Call("SleepMe")
   ControlClick($hGUI, "", "[CLASSNN:SysTreeView321]")
   Send("!e")
   Send("{DOWN 2} {RIGHT}")
   Send("{DOWN}")
   Send("{ENTER}")
   Call("SleepMe", false)
   Call("SleepMe", false)
   Call("SleepMe", false)
   Call("SleepMe", false)
   ControlClick($hGUI, "", "[CLASSNN:Button13]")
   Call("SleepMe", false)
   Call("SleepMe", false)
   Call("SleepMe", false)
   Call("SleepMe", false)
   ControlClick($hGUI, "", "[CLASSNN:Button13]")
   $maxitems=90
   $state=""
   $counterlist=1
   $counteritem=1
   ; Read in lines of text until the EOF is reached
   FileSetPos($file, 0, 0)
   While 1
	  Local $line = FileReadLine($file)
	  If @error = -1 Then ExitLoop
	  $input = StringSplit($line, ";")
	  if($state <> $input[4]) Then
		 $state=$input[4]
		 $counterlist=1
		 $counteritem=1
		 Call("AddZone", "Z" & $counterlist & " " & $state)
		 $counterlist=2
		 Call("AddZone", "Z" & $counterlist & " " & $state)
	  EndIf
	  If($counteritem > $maxitems) Then
		 $counteritem = 1
		 $counterlist = $counterlist + 1
		 Call("AddZone", "Z" & $counterlist & " " & $state)
	  EndIf
	  If($input[1] <> "-1") Then
		 Call("AddChannelZone", StringLeft($input[2] & "-1" & " " & $input[3], 16))
		 $counteritem = $counteritem + 1
		 If($counteritem > $maxitems) Then
			$counteritem = 1
			$counterlist = $counterlist + 1
			Call("AddZone", "Z" & $counterlist & " " & $state)
		 EndIf
		 Call("AddChannelZone", StringLeft($input[2] & "-2" & " " & $input[3], 16))
		 $counteritem = $counteritem + 1
	  Else
		 Call("AddChannelZone", StringLeft($input[2] & " " & $input[3], 16))
		 $counteritem = $counteritem + 1
	  EndIf
	  If($counteritem == 2) Then
		 Call("SleepMe")
		 ControlClick($hGUI, "", "[CLASSNN:SysListView322]")
		 Call("SleepMe")
		 ControlFocus($hGUI, "", "[CLASSNN:SysListView322]")
		 Call("SleepMe")
		 Send("{HOME}")
		 Call("SleepMe")
		 ControlClick($hGUI, "", "[CLASSNN:SysListView322]", "left", 1, 70, 34)
		 Call("SleepMe")
		 ControlClick($hGUI, "", "[CLASSNN:Button3]")
		 Call("SleepMe")
	  EndIf
   WEnd
   Call("SleepMe", false)
   ControlClick($hGUI, "", "[CLASSNN:Button7]")
   Call("SleepMe", false)
   Call("SleepMe", false)
EndIf

Func SleepMe($islow = True, $message = "")
   If(Not WinActive($hGUI)) Then
	  TrayTip($hTitle, "Please select window " & $hGUI & " for further processing.", 3)
	  WinWaitActive($hGUI)
   EndIf
   If(Not $message == "") Then
	  TrayTip($hTitle, $message, 3)
   EndIf
   If($islow) Then
	  Sleep($sleep_low)
   Else
	  Sleep($sleep_high)
   EndIf
EndFunc

Func AddChannelDigital($name, $ts, $rx, $offset, $roamlist=-1, $scanlist=-1)
   ;Traytip("CPS", "Please select CPS Tool in Channel Mask...", 1)
   Call("SleepMe")
   ControlFocus($hGUI, "", "[CLASSNN:Button45]")
   Call("SleepMe")
   Send("{SPACE}")

   ; Click ADD New Channel
   ;Traytip("CPS", "New Channel", 1)
   ;ControlClick($hGUI , "", "[CLASSNN:Button45]")
   ;Call("SleepMe", False)
   ;If (StringLeft(ControlGetText($hGUI, "", "[CLASSNN:Edit1]"), 3) <> "CH D") Then
	;  Call("SleepMe", False)
	;  Call("SleepMe", False)
	;  ControlClick($hGUI , "", "[CLASSNN:Button45]")
	;  Call("SleepMe", False)
	;  Call("SleepMe", False)
   ;EndIf

   ; Channel Alias
   ;Traytip("CPS", "Alias", 1)
   ControlClick($hGUI , "", "[CLASSNN:Edit1]")
   ControlSetText($hGUI , "", "[CLASSNN:Edit1]", $name)
   Call("SleepMe")

   ; Timeslot
   ControlClick($hGUI , "", "[CLASSNN:ComboBox2]")
   Call("SleepMe")
   if($ts < 2) Then
	  ; nothing, aleady selected
   Else
	  Send("{DOWN}")
   EndIf
   Call("SleepMe")
   Send("{ENTER}")
   Call("SleepMe")

   ; RX Frequency
   ;Traytip("CPS", "RX Frequency", 1)
   ControlClick($hGUI , "", "[CLASSNN:Edit3]")
   Call("SleepMe")
   Send("{BS 10}")
   Call("SleepMe")
   Send("{DEL 10}")
   Call("SleepMe")
   Send($rx)
   Call("SleepMe", false)
   Send("{ENTER}")
   Call("SleepMe", false)

   ; RX Group List set to None
   ;ControlClick($hGUI , "", "[CLASSNN:ComboBox4]")
   ;Call("SleepMe")
   ;if($ts < 2) Then
	;  Send("{DOWN}")
	;  Call("SleepMe")
   ;Else
	;  Send("{DOWN}")
	;  Call("SleepMe")
	;  Send("{DOWN}")
	;  Call("SleepMe")
   ;EndIf
   ;Send("{ENTER}")
   ;Call("SleepMe", false)

   ; Offset
   ControlClick($hGUI , "", "[CLASSNN:Edit4]")
   Call("SleepMe", false)
   Send("{BS 10}")
   Call("SleepMe")
   Send("{DEL 10}")
   Send($offset)
   Call("SleepMe", false)
   Send("{ENTER}")
   Call("SleepMe", false)
   Send("{TAB} {ENTER}")
   Call("SleepMe", false)

   ; Copy Offset
   ControlClick($hGUI , "", "[CLASSNN:Button23]")
   Call("SleepMe", false)
   Call("SleepMe", false)

   ; TX Contact Name
   Send("{TAB}")
   Call("SleepMe")
   Send("{TAB}")
   Call("SleepMe")
   Send("t")
   if ($ts < 2) Then
	  for $i=1 to 5
		Send("{DOWN}")
		Call("SleepMe")
	  Next
   Else
	  Send("{END}")
	  Call("SleepMe")
	  ;For $i=1 to 8
		; Send("{UP}")
		; Call("SleepMe")
	  ;Next
   EndIf
   Send("{ENTER}")
   Call("SleepMe")

   ; GPS Revert Channel
   Send("{TAB}")
   Call("SleepMe")
   Send("s")
   Call("SleepMe", False)
   Send("{TAB}")

   ; Enable Roaming / Multisite Access
   ControlFocus($hGUI, "", "[CLASSNN:Button8]")
   Call("SleepMe", false)
   ControlClick($hGUI, "", "[CLASSNN:Button8]")
   Call("SleepMe")


   ControlClick($hGUI , "", "[CLASSNN:ComboBox14]")
   ; Emergency System to None
   Call("SleepMe")
   Send("N")
   Send("{ENTER}")
   Call("SleepMe")

   ; Power to High
   ControlClick($hGUI , "", "[CLASSNN:ComboBox16]")
   Call("SleepMe")
   Send("h")
   Send("{ENTER}")
   Call("SleepMe")
   Send("h")
   Send("{ENTER}")
   Call("SleepMe", false)


   ; TX Admit in Call to Always
   ;ControlClick("Customer Programming Software", "", "[CLASSNN:ComboBox18]")
   ;Sleep(600)
   ;Send("a")
   ;Send("{ENTER}")
   ;Sleep(600)
   ;Send("a")
   ;Send("{ENTER}")
   ;Sleep(600)

   ;$roaminglist = 0
   ;if($roaminglist > 0) Then
	  ; Select Roaming List
	;  ControlClick("Customer Programming Software", "", "[CLASSNN:Edit8]")
	;  Sleep(600)
	;  Send("{TAB}")
	;  if ($ts < 2) Then
	;	 Send("{END}")
	;	 Sleep(600)
	;  Else
	;	 Send("{DOWN}")
	;	 Sleep(600)
	;	 Send("{DOWN}")
	;	 Sleep(600)
	;	 Send("{DOWN}")
	;	 Sleep(600)
	;	 Send("{DOWN}")
	;	 Sleep(600)
	;	 Send("{DOWN}")
	;	 Sleep(600)
	;	 Send("{DOWN}")
	;	 Sleep(600)
	;	 Send("{DOWN}")
	;	 Sleep(600)
	;	 Send("{DOWN}")
	;	 Sleep(600)
    ;  EndIf
	;  Send("{ENTER}")
	;  Sleep(600)

    ; Start Auto Roam
	;  ControlClick("Customer Programming Software", "", "[CLASSNN:Button9]")
	;  Sleep(600)
   ;Endif

   if($roamlist>-1) Then
	  ; Select Roaming List
	  Call("SleepMe", false)
	  ControlClick($hGUI , "", "[CLASSNN:Edit8]")
	  Call("SleepMe", false)
	  Send("{TAB}")
	  Call("SleepMe", false)
	  Send("r")
	  Call("SleepMe", false)
	  if($roamlist>0) Then
		 For $i=1 to $roamlist
			Send("{DOWN}")
			Call("SleepMe", false)
		 Next
	  EndIf
	  Send("{TAB}")

	  ; Start Auto Roam
	  ControlClick($hGUI , "", "[CLASSNN:Button9]")
	  Call("SleepMe", false)
   EndIf

   if($scanlist>-1) Then
	  ; Select Scan List
	  Call("SleepMe", false)
	  ControlClick($hGUI , "", "[CLASSNN:Edit8]")
	  Call("SleepMe", false)
	  Send("{TAB}")
	  Call("SleepMe", false)
	  Send("s")
	  Call("SleepMe", false)
	  if($scanlist>0) Then
		 For $i=1 to $scanlist
			Send("{DOWN}")
			Call("SleepMe", false)
		 Next
	  EndIf
	  Send("{TAB}")

	  ; Start Auto Scan
	  ControlClick($hGUI , "", "[CLASSNN:Button1]")
	  Call("SleepMe", false)
   EndIf


EndFunc

Func AddChannelAnalog($name, $rx, $offset, $ctcss)
   ;Traytip("CPS", "Please select CPS Tool in Channel Mask...", 1)
   Call("SleepMe")

   ; Click ADD New Channel
   ;Traytip("CPS", "New Channel", 1)
   ControlFocus($hGUI , "", "[CLASSNN:Button32]")
   Call("SleepMe")
   Send("{SPACE}")
   Call("SleepMe")

   ; Channel Alias
   ;Traytip("CPS", "Alias", 1)
   ControlClick($hGUI , "", "[CLASSNN:Edit1]")
   ControlSetText($hGUI , "", "[CLASSNN:Edit1]", $name)
   Call("SleepMe")

   ; 2-Tone
   ControlFocus($hGUI , "", "[CLASSNN:ComboBox4]")
   ControlClick($hGUI , "", "[CLASSNN:ComboBox4]")
   Call("SleepMe")
   Send("{DOWN}")
   Call("SleepMe")
   Send("{ENTER}")
   Call("SleepMe")

   ; 2-Tone
   ControlClick($hGUI , "", "[CLASSNN:ComboBox5]")
   ControlFocus($hGUI , "", "[CLASSNN:ComboBox5]")
   Call("SleepMe")
   Send("{UP}")
   Call("SleepMe")
   Send("{ENTER}")
   Call("SleepMe")

   ; Disable Emergency
   ControlClick($hGUI , "", "[CLASSNN:ComboBox21]")
   Call("SleepMe")
   Send("n")
   Call("SleepMe")
   Send("{ENTER}")
   Call("SleepMe")

   ; High Power
   ControlClick($hGUI , "", "[CLASSNN:ComboBox23]")
   Call("SleepMe")
   Send("h")
   Call("SleepMe")
   Send("{ENTER}")
   Call("SleepMe")

   ; RX Frequency
   ;Traytip("CPS", "RX Frequency", 1)
   ControlClick($hGUI , "", "[CLASSNN:Edit2]")
   Call("SleepMe", false)
   Send("{BS 10}")
   Call("SleepMe")
   Send("{DEL 10}")
   Call("SleepMe")
   Send($rx)
   Call("SleepMe")
   Send("{ENTER}")
   Call("SleepMe", false)


   ; Offset
   ControlClick($hGUI , "", "[CLASSNN:Edit5]")
   Call("SleepMe")
   Send("{BS 10}")
   Call("SleepMe")
   Send("{DEL 10}")
   Send($offset)
   Call("SleepMe", false)
   Send("{ENTER}")
   Call("SleepMe", false)

   ; Copy Offset
   Send("{TAB}")
   Call("SleepMe")
   Send("{SPACE}")
   Call("SleepMe")
   ControlClick($hGUI , "", "[CLASSNN:Button15]")
   Call("SleepMe", false)

   ; CTCSS
   if($ctcss <> "") Then
	  ControlFocus($hGUI , "", "[CLASSNN:ComboBox10]")
	  ControlClick($hGUI , "", "[CLASSNN:ComboBox10]")
	  Call("SleepMe", false)
	  Send("{DOWN}")
	  Call("SleepMe")
	  Send("{ENTER}")
	  Call("SleepMe")

	  ControlFocus($hGUI , "", "[CLASSNN:ComboBox11]")
	  ControlClick($hGUI , "", "[CLASSNN:ComboBox11]")
	  Call("SleepMe")
	  Send("{BS 10}")
	  Call("SleepMe")
	  Send("{DEL 10}")
	  Call("SleepMe")
	  Send($ctcss)
	  Call("SleepMe", false)
	  Send("{ENTER}")
	  Call("SleepMe")
   EndIf

EndFunc

Func selectit($listview, $item)
   Call("SleepMe", false)
   ControlFocus($hGUI, "", "[CLASSNN:"&$listview&"]")
   Call("SleepMe", false)
   ControlFocus($hGUI, "", "[CLASSNN:"&$listview&"]")
   ControlClick($hGUI, "", "[CLASSNN:"&$listview&"]")
   Call("SleepMe", false)
   Send("{HOME}")
   Call("SleepMe")
   $oldSelect = ""
   $count=1
   while 1
	  $iSelect = ControlListView($hGUI, "", $listview, "GetSelected")
	  $sSelect = ControlListView($hGUI, "", $listview, "GetText", $iSelect)
	  if($sSelect = $item) Then
		 ExitLoop
	  EndIf
	  Send("{DOWN}")
	  $count=$count+1
	  if($sSelect = $oldSelect) Then
		 ExitLoop
	  EndIf
	  $oldSelect = $sSelect
   WEnd
   ;Call("SleepMe")
   $clicker=35
   ;$ctlpos=ControlGetPos($hGUI, "", $listview)
   ;$clicker=$ctlpos[1]+8
   $oldSelect = ""
   $count=$count-1
   $hWnd = ControlGetHandle($hGUI,"",$listview)
   while 1
	  _GUICtrlListView_ClickItem($hWnd, $count)
	  Sleep(300)
	  ;ControlClick($hGUI, "", "[CLASSNN:"&$listview&"]", "left", 1, 60, $clicker)
	  ;MouseClick("left", $ctlpos[0]+40, $clicker)
	  $clicker = $clicker + 18
	  $iSelect = ControlListView($hGUI, "", $listview, "GetSelected")
	  $sSelect = ControlListView($hGUI, "", $listview, "GetText", $iSelect)
	  if($sSelect = $item) Then
		 ExitLoop
	  EndIf
	  if($sSelect = $oldSelect) Then
		 ExitLoop
	  EndIf
	  $oldSelect = $sSelect
	  $count=$count+1
   WEnd
EndFunc

Func AddChannelListRoaming($name)
   ;Traytip("CPS", "Please select CPS Tool in Channel Mask...", 1)
   Call("SleepMe", false)
   ; Click ADD New Channel
   ;Traytip("CPS", "New Channel", 1)
   Call("selectit", "SysListView321", $name)
   Call("SleepMe", false)
   ControlFocus($hGUI , "", "[CLASSNN:Button1]")
   Call("SleepMe", false)
   Send("{SPACE}")
   Call("SleepMe", false)
EndFunc

Func AddListRoaming($name)
   Call("SleepMe")
   ; Click ADD New Channel
   ControlFocus($hGUI, "", "[CLASSNN:Button16]")
   Call("SleepMe")
   Send("{SPACE}")
   Call("SleepMe", false)
   ; List Name
   ControlFocus($hGUI, "", "[CLASSNN:Edit1]")
   ControlClick($hGUI, "", "[CLASSNN:Edit1]")
   ControlSetText($hGUI, "", "[CLASSNN:Edit1]", $name)
   Call("SleepMe")
EndFunc

Func AddChannelListScan($name)
   ;Traytip("CPS", "Please select CPS Tool in Channel Mask...", 1)
   Call("SleepMe", false)
   ; Click ADD New Channel
   ;Traytip("CPS", "New Channel", 1)
   Call("selectit", "SysListView321", $name)
   Call("SleepMe", false)
   ControlFocus($hGUI , "", "[CLASSNN:Button1]")
   Send("{SPACE}")
   Call("SleepMe", false)
EndFunc

Func AddListScan($name)
   Call("SleepMe")
   ; Click ADD New Channel
   ControlFocus($hGUI , "", "[CLASSNN:Button19]")
   ControlClick($hGUI , "", "[CLASSNN:Button19]")
   Call("SleepMe")

   ; Last Active Channel
   ControlFocus($hGUI , "", "[CLASSNN:ComboBox4]")
   ControlClick($hGUI , "", "[CLASSNN:ComboBox4]")
   Call("SleepMe", false)
   Send("{DOWN}")
   Call("SleepMe", false)
   Send("{ENTER}")

   ; List Name
   ControlFocus($hGUI , "", "[CLASSNN:Edit1]")
   ControlClick($hGUI , "", "[CLASSNN:Edit1]")
   ControlSetText($hGUI , "", "[CLASSNN:Edit1]", $name)
   Call("SleepMe")
EndFunc

Func AddChannelZone($name)
   ;Traytip("CPS", "Please select CPS Tool in Channel Mask...", 1)
   Call("SleepMe", false)
   ; Click ADD New Channel
   ;Traytip("CPS", "New Channel", 1)
   Call("selectit", "SysListView321", $name)
   Call("SleepMe", false)
   ControlFocus($hGUI, "", "[CLASSNN:Button2]")
   Call("SleepMe")
   Send("{SPACE}")
   Call("SleepMe", false)
EndFunc

Func AddZone($name)
   Call("SleepMe", false)
   ; Click ADD New Channel
   ControlFocus($hGUI, "", "[CLASSNN:Button14]")
   Call("SleepMe", false)
   Send("{SPACE}")
   Call("SleepMe", false)
   ; List Name
   ControlFocus($hGUI, "", "[CLASSNN:Edit1]")
   ControlClick($hGUI, "", "[CLASSNN:Edit1]")
   ControlSetText($hGUI, "", "[CLASSNN:Edit1]", $name)
   Call("SleepMe", false)
EndFunc

 

Mithilfe des Skriptes ist es mir nun möglich, alle Relais in Deutschland ohne manuellen Aufwand in die Hytera CPS zu importieren. Lediglich muss gewartet werden, bis das Skript alle Einträge in der CSV abgearbeitet hat.

Generell – ist nur eine persönliche Empfindung – finde ich es charmanter, die Relais mit Rufzeichen auf dem Gerät zu haben; als doch wieder das Handy aus der Tasche zu nehmen und eine Recherche auf die mir in der Nähe liegenden Relais zu fahren :-)

 

Viel Spaß damit!

 

73,
Simon

Empfohlene Beiträge

3 Kommentare

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert.

Empfehlungen
Schließen
Schaltfläche "Zurück zum Anfang"