Modification du 2 dec 2016
j'ai réécrit 80% du prg (et en particulier la recherche initiale des multiplex)
http://www.cs.usyd.edu.au/~efax/DVPiper.html
un peu d'info
http://forum.hardware.fr/hfr/VideoSon/H ... 1207_1.htm
-------------------------------------------
ce que j'appris de tous ces soft TV:
http://www.tvnt.net/forum/les-softs-pou ... s-t19.html
la recherche initiale des chaines c'est très compliqué, la plupart n'y arrive pas, les 'meilleurs' : le média center de Win7 (mais je l'ai viré il y a 3 ans), les softs fourni avec les clés usb (mais ils sont très très lourd).
PouchinTVMod fait 1Mo, TOUS les autres soft TV vont de 30GO à 100GO
DVPiper trouve les 6 multiplex sur 2 clés et 5 sur l'avermedia (je reçois le même multiplex(fr2) de 2 endroits
Pouchin trouve (et encore pas tjrs) 5 multiplex sur 2 clés et 4 sur l'avermedia
recherche des multiplex: une boucle de 21 a 60
En UHF la règle de calcul est simple :
N° de canal x8 + 306 = Fréquence en Mhz , auquel il convient d'ajouter le shift décalage de 0,167 Mhz
Exemple canal 42 :
42 x 8 = 336 336+306 = 642 642+0,167 = 642,167Mhz
voir la fonction RechercheMultiplex()
-------------------------------------------
envoyer le signal TV sur le poste 192.168.1.200 (en udp) pour le lire avec un player type Vlc,SMplayer,MPC-HD...
DVPiper.exe -devicenum 1 -type DVB-T -frequency 522167 -bandwidth 8 -command record(rid(1237),progid(1031),buildpat,send(udp(192.168.1.200,1234)))"
liste des devices TNT il m'a trouvé mes 3 clés usb (avermedia,hautpage,conceptronic)
DVPiper.exe -listdevicexml
programme télé (epg)
DVPiper -devicenum 1 -type dvb-t -frequency 522167 -bandwidth 8 -epg "epg.xml"
recherche les chaines du multiplex
DVPiper.exe -devicenum 1 -type DVB-T -frequency 746167 -bandwidth 8 -command scan
enregistre la chaine 1031 (Arte) dans un fichier TS
DVPiper.exe -devicenum 1 -type DVB-T -frequency 522167 -bandwidth 8
-command "record(rid(1),progid(1031),buildpat,send(file('fichier.ts')))"
Qualité du signal du multiplex
DVPiper.exe -devicename "DVB-T Dongle" -type DVB-T -frequency 594167 -bandwidth 8 -command signal
je n'ai découvert ce prg que depuis peu, à part la doc du concepteur, il n'existe que peu de doc sur le web
mes compétences réseaux (multicast etc..) sont limitées, il y a certainement d'autres commandes à explorer
la prochaine étape sera de programmer des enregistrements histoire de concurrencer PoutchinTV http://www.pouchintv.fr/
A+
dir /b
474167.xml
498167.xml
522167.xml
578167.xml
594167.xml
610167.xml
746167.xml
device.xml
DVPiper.exe
DVPiperUDP.au3
horse.ani
install.bat
kangaroo bleu 32.ico
Streamer.dll
uninstall.bat
498167.xml
522167.xml
578167.xml
594167.xml
610167.xml
746167.xml
device.xml
DVPiper.exe
DVPiperUDP.au3
horse.ani
install.bat
kangaroo bleu 32.ico
Streamer.dll
uninstall.bat
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Icon=kangaroo bleu 32.ico
#AutoIt3Wrapper_UseX64=y
#AutoIt3Wrapper_Run_Tidy=y
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
;http://www.cs.usyd.edu.au/~efax/DVPiper.html
;
;un peu d'info
;http://forum.hardware.fr/hfr/VideoSon/HiFi-HomeCinema/dvpiper-streaming-tnt-sujet_121207_1.htm
;
;ce que j'appris de tous ces soft TV
;http://www.tvnt.net/forum/les-softs-pouchintv-vlc-wintv2k-et-autres-mediacenters-t19.html
;la recherche initiale des chaines c'est très compliqué, la plupart n'y arrive pas
;les 'meilleurs' : le média center de Win7 (mais je l'ai viré il y a 3 ans),
;les softs fourni avec les cle usb (mais ils sont trés trés lourd)
;PouchinTVMod fait 1Mo, TOUS les autres vont de 30GO à 100GO
;DVPiper trouve les 6 multiplex sur 2 cles et 5 sur l'avermedia
;Pouchin trouve (et encore pas tjrs) 5 multiplex sur 2 cles et 4 sur l'avermedia
;
;En UHF la règle de calcul est simple :
;N° de canal x8 + 306 = Fréquence en Mhz , auquel il convient d'ajouter le shift décalage de 0,167 Mhz
;Exemple canal 42 :
;42 x 8 = 336 ; 336+306 = 642 ; 642+0,167 = 642,167Mhz
;voir la fonction RechercheMultiplex()
;
;-------------------------------------------------
;envoyer le signal TV sur le poste 192.168.1.200 (en udp) pour le lire avec un player type Vlc(udp://@:1234),SMplayer,MPC-HD...
;DVPiper.exe -devicenum 1 -type DVB-T -frequency 522167 -bandwidth 8 -command "record(rid(1237),progid(1031),buildpat,send(udp(192.168.1.200,1234)))"
;perso je lis sans probleme du 1920x1080 sur un reseau en cpl
;
;liste des devices TNT (BDA) il m'a trouve mes 3 cles usb (avermedia,hautpage,conceptronic)
;DVPiper.exe -listdevicexml
;
;les programmes tele (epg)
;DVPiper -devicenum 1 -type dvb-t -frequency 522167 -bandwidth 8 -epg "epg.xml"
;
;recherche les canaux du multiplex
;DVPiper.exe -devicenum 1 -type DVB-T -frequency 746167 -bandwidth 8 -command scan
;
;enregistre le canal 1031 (Arte) dans un fichier TS
;DVPiper.exe -devicenum 1 -type DVB-T -frequency 522167 -bandwidth 8 _
;-command "record(rid(1),progid(1031),buildpat,send(file('fichier.ts')))"
;
;Qualite du signal du multiplex
;DVPiper.exe -devicename "DVB-T Dongle" -type DVB-T -frequency 594167 -bandwidth 8 -command signal
;
;regexp un grand merci a mikell https://autoitscript.fr/forum
;
#include <GuiListView.au3>
#include <GuiButton.au3>
#include <TrayConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GuiComboBox.au3>
#include <array.au3>
#include <File.au3> ;_FileWriteFromArray
#include <_XML.au3> ;https://www.autoitscript.com/forum/files/file/358-xmlau3-formerly-xmlwrapperexau3/
Opt('MustDeclareVars', 1)
Opt("GUIOnEventMode", 1)
Opt("GUICloseOnESC", 0)
Opt("TrayMenuMode", 3)
Opt("TrayOnEventMode", 1)
Global Const $shorse = @ScriptDir & '\horse.ani' ;l'icone horse anime ....\AutoIt3\Examples\Helpfile\Extras\horse.ani
Global Const $g_sDVPiper = @ScriptDir & '\DVPiper.exe'
Global Const $g_sIP = '192.168.1.100|192.168.1.101|192.168.1.102' ; mes 3 PC (win7 pro)
Global Const $g_sdevicexml = @ScriptDir & '\device.xml' ; fichier xml des tuner TNT a creer dans le menu de la GUI
Global Const $g_iW = 700, $g_iH = 300
Global $g_iPID, $g_hListView, $g_hGui, $g_idComboIP, $g_idComboDevice, $g_idComboFernsehKanal
Global $g_idBtnAnhalten, $g_idBtnStart, $g_idani, $g_hCopy
Init()
While 1
Sleep(100)
WEnd
Func Init()
GUI()
Tray()
If Not FileExists(@ScriptDir & '\log\') Then DirCreate(@ScriptDir & '\log\')
ComboDevice() ;combo dongle TNT
If Not @error Then ComboFernsehKanal() ;combo chaines
EndFunc ;==>Init
Func SignalQualitat() ;Qualite du signal du multiplex
;DVPiper.exe -devicename "DVB-T Dongle" -type DVB-T -frequency 594167 -bandwidth 8 -command signal
Local $i, $T, $scmd, $sdevice, $sfreq
GUICtrlSetImage($g_idani, $shorse)
_GUICtrlButton_Enable($g_idBtnStart, False) ;empeche d'appuyer sur start
$sdevice = '-log .\log\SignalQualitat.log -devicename ' & Cote(GUICtrlRead($g_idComboDevice))
$sfreq = GUICtrlRead($g_idComboFernsehKanal)
$sfreq = StringRegExpReplace($sfreq, '(.*bandwidth \d).*', '${1}') ;-type DVB-T -frequency 522167 -bandwidth 8........
$scmd = $g_sDVPiper & ' ' & $sdevice & ' ' & $sfreq & ' -command signal'
$T = StdoutR($scmd, 0) ; 0 = ne pas attendre que le process s'arrete
$i = srch($T, 'Strength') ; recupere la force du signal
Switch $i
Case -1
WinSetTitle($g_hGui, '', 'Pas de signal')
Case Else
WinSetTitle($g_hGui, '', $T[$i])
EndSwitch
StdinWrite($g_iPID, 'stopany' & @CRLF) ;envoie des commandes a DVPiper pour l'arreter
Sleep(1000 * 2)
StdinWrite($g_iPID, 'exit' & @CRLF)
GUICtrlSetImage($g_idani, "shell32.dll", 253)
_GUICtrlButton_Enable($g_idBtnStart, True) ; on peut appuyer sur start
EndFunc ;==>SignalQualitat
Func Starten() ; demarre un send(udp(192.168....
;DVPiper.exe -devicenum 2 -type DVB-T -frequency 746167 -bandwidth 8
;-command "record(rid(1237),progid(262),buildpat,send(udp(192.168.1.200,1234)))"
Local $i, $T, $scmd, $sout, $sdevice, $sfreq, $sprogid, $sIP
_GUICtrlButton_Enable($g_idBtnStart, False) ; empeche de reappuyer
GUICtrlSetImage($g_idani, $shorse)
$sIP = GUICtrlRead($g_idComboIP)
$sdevice = ' -log .\log\send_udp.log -devicename ' & Cote(GUICtrlRead($g_idComboDevice))
$sfreq = GUICtrlRead($g_idComboFernsehKanal)
$sfreq = StringRegExpReplace($sfreq, '(.*bandwidth \d).*', '${1}')
$sprogid = GUICtrlRead($g_idComboFernsehKanal)
$sprogid = StringRegExpReplace($sprogid, '.*bandwidth \d (\d{1,4}) .*', '${1}')
$scmd = $g_sDVPiper & ' ' & $sdevice & ' ' & $sfreq & _
' -signalstart -command "record(rid(1237),progid(' & $sprogid & '),buildpat,send(udp(' & $sIP & ',1234)))"'
$T = StdoutR($scmd, 0) ;ne pas attendre que le process s'arrete
$i = srch($T, 'Strength') ; recupere la force du signal
Switch $i
Case -1
WinSetTitle($g_hGui, '', 'Pas de signal')
Case Else
WinSetTitle($g_hGui, '', $T[$i])
EndSwitch
AdlibRegister("StdoutDVPiper", 1000 * 5) ; lit le stdout toutes les 5s
EndFunc ;==>Starten
Func StdoutDVPiper() ;recupere le Stdout pour l'afficher et verifie que ProcessExists("DVPiper.exe")
Local $icount, $sout = StdoutRead($g_iPID)
If $sout <> '' Then
_GUICtrlListView_AddItem($g_hListView, $sout)
$icount = _GUICtrlListView_GetItemCount($g_hListView)
_GUICtrlListView_Scroll($g_hListView, 0, $icount)
EndIf
If Not ProcessExists($g_iPID) Then
_GUICtrlButton_Enable($g_idBtnStart, True)
GUICtrlSetImage($g_idani, "shell32.dll", 253)
AdlibUnRegister("StdoutDVPiper")
EndIf
EndFunc ;==>StdoutDVPiper
Func Anhalten() ;envoie des commandes a DVPIper pour l'arreter
ErreurNonFatale("Stoppe dans 10s", $g_hGui)
_GUICtrlButton_Enable($g_idBtnStart, True)
GUICtrlSetImage($g_idani, "shell32.dll", 253)
If Not ProcessExists('DVPiper.exe') Then Return
StdinWrite($g_iPID, 'stopany' & @CRLF)
Sleep(1000 * 5)
StdinWrite($g_iPID, 'exit' & @CRLF)
AdlibUnRegister("StdoutDVPiper")
EndFunc ;==>Anhalten
Func ComboDevice() ; rempli le combo device avec le fichier device.xml
If Not FileExists($g_sdevicexml) Then
ErreurNonFatale("(Menu) Commencer par chercher le(s) Tuner TNT/DVB-T", $g_hGui)
Return SetError(1, 0, '')
EndIf
Local $i, $T = SelectNodes($g_sdevicexml, '/devices/device/name')
If @error Then Return SetError(1, 0, '')
$i = 1
While 1
GUICtrlSetData($g_idComboDevice, $T[$i][3])
$i += 1
If $i > UBound($T) - 1 Then ExitLoop
WEnd
;ControlCommand($g_hGui, '', $g_idComboDevice, "SetCurrentSelection", 0)
GUICtrlSetData($g_idComboDevice, "DVB-T Dongle", "DVB-T Dongle")
EndFunc ;==>ComboDevice
Func ComboFernsehKanal() ;rempli le combo chaines avec les fichiers *167.xml......
Local $selement, $sfreq, $aenum
$aenum = _FileListToArray(@ScriptDir, '*167.xml', 1, 0)
$aenum = DeleteBlankLine($aenum)
If @error Then
ErreurNonFatale('(Menu) Commencer par chercher les Multiplex (15-20mn)', $g_hGui)
Return SetError(1, 0, '')
EndIf
For $selement In $aenum
$sfreq = Frequenz($selement)
Kanal($selement, $sfreq)
Next
ControlCommand($g_hGui, '', $g_idComboFernsehKanal, "SetCurrentSelection", 0)
EndFunc ;==>ComboFernsehKanal
Func Frequenz($selement)
;a priori l'UDF XML ne sait pas lire des 'nodes' tel que
;programs date="20161118003625 +0000" generator-info-name="DVPiper" networkType="DVB-T" frequency="522167" bandwidth="8"
;donc je fais des RegExp
Local $sfreq, $snode = "/programs"
Local $T = SelectNodes($selement, $snode)
If @error Then Return SetError(1, 0, '')
;<programs date="20161120040859 +0000" generator-info-name="DVPiper" networkType="DVB-T" frequency="594167" bandwidth="8">
;<program id="1537" name="TF1" provider="SMR6" access="FTA" originalNetworkId="8442" transportStreamId="6">
; <packet pid="100" type="PMT"/>
;.....
;ad($T)
$sfreq = $T[1][5]
$sfreq = StringRegExpReplace($sfreq, '(.*)\s.*', '${1}') ; ne garde que la premiere ligne
;<programs date="20161118003625 +0000" generator-info-name="DVPiper" networkType="DVB-T" frequency="522167" bandwidth="8">
$sfreq = StringRegExpReplace($sfreq, '.*DVPiper"(.*)>', '${1}')
$sfreq = StringRegExpReplace($sfreq, '="', ' ')
$sfreq = StringRegExpReplace($sfreq, '"', '')
$sfreq = StringRegExpReplace($sfreq, 'networkType', '-type')
$sfreq = StringRegExpReplace($sfreq, 'frequency', '-frequency')
$sfreq = StringRegExpReplace($sfreq, 'bandwidth', '-bandwidth')
;cw($sfreq)
Return $sfreq
EndFunc ;==>Frequenz
Func Kanal($selement, $sfreq) ; rempli le combo chaines
Local $T, $sKanal, $spattern
Local $snode = "/programs/program"
$T = SelectNodes($selement, $snode)
If @error Then Return SetError(1, 0, '')
;ad($T)
For $i = 1 To UBound($T) - 1
;<program id="1025" name="M6" provider="Multi4"......
$sKanal = $T[$i][5]
$sKanal = StringRegExpReplace($sKanal, '(.*)\s.*', '${1}')
$spattern = '<program id="(.*)" name="(.*)" provider.*'
$sKanal = StringRegExpReplace($sKanal, $spattern, '${1} ${2}')
$sKanal = $sfreq & ' ' & $sKanal
GUICtrlSetData($g_idComboFernsehKanal, $sKanal)
Next
EndFunc ;==>Kanal
Func DeviceXml() ;DVPiper.exe -listdevicexml
Local $scmd, $i, $T
GUICtrlSetData($g_idComboDevice, '')
FileDelete($g_sdevicexml)
$scmd = $g_sDVPiper & ' -log .\log\Device.log -input BDA -type dvb-t -listdevicexml -emptyexit '
$T = StdoutR($scmd)
If Not IsArray($T) Then
ErreurFatale('ne trouve pas de clé tnt')
EndIf
;retour de la commande:
;
;Parameters: DVPiper.exe -log .\log\Device.log -input BDA -type dvb-t -listdevicexml -emptyexit
;2016/11/21 09:53:10.307: Set type: DVB-T
;<devices>
;<device><id>1</id><name>DVB-T
For $i = 0 To UBound($T) - 1
$T[$i] = StringRegExpReplace($T[$i], '^[^<].*', '') ; supprime tout ce qui ne commence par <
Next
$T = DeleteBlankLine($T)
If Not IsArray($T) Then
ErreurFatale('ne trouve pas de clé tnt')
EndIf
Local $hFileOpen = FileOpen($g_sdevicexml, 2 + 128) ; write+utf8
_FileWriteFromArray($hFileOpen, $T)
FileClose($hFileOpen)
ComboDevice() ; rempli le combo device avec le fichier device.xml
EndFunc ;==>DeviceXml
Func RechercheMultiplex()
Local $sdevice = '-devicename ' & Cote(GUICtrlRead($g_idComboDevice)) ; avec quelle cle usb
Local $scmd, $i, $T, $ifreq, $sxml
GUICtrlSetData($g_idComboFernsehKanal, '') ; efface les anciens multiplex
If _GUICtrlComboBox_GetCount($g_idComboDevice) = 0 Then
ErreurNonFatale('Commencer par DeviceXml', $g_hGui)
Return SetError(1, 0, '')
EndIf
GUICtrlSetImage($g_idani, $shorse)
_GUICtrlButton_Enable($g_idBtnStart, False) ; empeche d'appuyer sur le button bleu
Local $hTimer = TimerInit()
For $i = 21 To 60
;http://www.tvnt.net/forum/tableau-de-conversion-des-canaux-uhf-en-frequences-t23059.html
;( Canal x 8 ) + 306 +0.167 = Fréquence (MHz)
$ifreq = ((($i * 8) + 306) + 0.167) * 1000
$sxml = $ifreq & '.xml'
$scmd = $g_sDVPiper & ' ' & $sdevice & _
' -log .\log\Multiplex.log -type dvb-t -frequency ' & _
$ifreq & ' -bandwidth 8 -command scan(filedec(' & _
Cote($sxml) & ')) -emptyexit'
;DVPiper.exe -devicenum 2 -type DVB-T -frequency 522167 -bandwidth 8 -command scan(filedec('522167.xml'))
StdoutR($scmd) ;creer le fichier $sfreq.xml
If FileGetSize($sxml) < 10 Then FileDelete($sxml) ; un fichier normal fait plus de 4000
Next
_GUICtrlListView_AddItem($g_hListView, Round((TimerDiff($hTimer) / 1000 / 60)) & 'mn')
_GUICtrlListView_AddItem($g_hListView, '')
Run('rundll32 user32.dll,MessageBeep')
ComboFernsehKanal() ;rempli le combo FernsehKanal avec les fichiers $sfreq.xml
GUICtrlSetImage($g_idani, "shell32.dll", 253)
_GUICtrlButton_Enable($g_idBtnStart, True) ; on peut appuyer sur start
EndFunc ;==>RechercheMultiplex
Func StdoutR($scmd, $sProcessClose = 1)
;parfois la cmd ne s'arrete jamais par ex un send(udp:168.....)
;c'est à moi de l'arreter avec un StdinWrite($g_iPID, 'stopany' & @CRLF)
Local $icount, $sout, $serr, $T
$scmd = StringStripWS($scmd, 7) ; double space
_GUICtrlListView_AddItem($g_hListView, $scmd)
_GUICtrlListView_AddItem($g_hListView, '')
$icount = _GUICtrlListView_GetItemCount($g_hListView)
_GUICtrlListView_Scroll($g_hListView, 0, $icount)
$g_iPID = Run($scmd, "", @SW_HIDE, $STDIN_CHILD + $STDOUT_CHILD)
Switch $sProcessClose
Case 1
ProcessWaitClose($g_iPID)
Case 0
Sleep(1000 * 10) ; attend un peu que la cmd envoie des infos
EndSwitch
While 1
$sout = StdoutRead($g_iPID)
If @error Then ExitLoop
If $sout <> '' Then
$T = StringSplit($sout, @CRLF, 2)
$T = DeleteBlankLine($T)
Return $T
EndIf
WEnd
EndFunc ;==>StdoutR
Func GUI()
Local $T, $iStyle, $iexStyle
$iStyle = -1
$g_hGui = GUICreate('DVPiper --> send(udp(192.168.x.xxx,1234))', $g_iW, $g_iH, 1, 1, $iStyle)
GUISetOnEvent($GUI_EVENT_CLOSE, "Fertig", $g_hGui)
;----------------------------- Menu
Local $idFilemenu = GUICtrlCreateMenu("&Menu")
GUICtrlCreateMenuItem("Qualité du signal", $idFilemenu)
GUICtrlSetOnEvent(-1, "SignalQualitat")
GUICtrlCreateMenuItem('', $idFilemenu)
GUICtrlCreateMenuItem("Chercher le(s) Tuner TNT/DVB-T", $idFilemenu)
GUICtrlSetOnEvent(-1, "DeviceXml")
GUICtrlCreateMenuItem("Chercher les Multiplex (60s x 40canaux)", $idFilemenu)
GUICtrlSetOnEvent(-1, "RechercheMultiplex")
GUICtrlCreateMenuItem("Suivi", $idFilemenu)
GUICtrlSetOnEvent(-1, "Mini")
;----------------------------- Button
$g_idBtnStart = GUICtrlCreateButton('', 5, 5, 32, 32, BitOR($BS_DEFPUSHBUTTON, $BS_ICON))
GUICtrlSetOnEvent($g_idBtnStart, "Starten")
GUICtrlSetTip($g_idBtnStart, 'Envoyer le signal TV sur le poste 192.168.....')
GUICtrlSetImage($g_idBtnStart, 'shell32.dll', 221, 1)
$g_idBtnAnhalten = GUICtrlCreateButton('', l($g_idBtnStart), 5, 32, 32, $BS_ICON)
GUICtrlSetOnEvent($g_idBtnAnhalten, "Anhalten")
GUICtrlSetTip($g_idBtnAnhalten, 'Cesser le flux udp')
GUICtrlSetImage($g_idBtnAnhalten, 'shell32.dll', 28, 1)
;----------------------------- icon
$g_idani = GUICtrlCreateIcon("shell32.dll", 253, l($g_idBtnAnhalten), 5, 32, 32)
;----------------------------- Combo
$g_idComboIP = GUICtrlCreateCombo('', l($g_idani), 5, $g_iW / 6, 20, 0x0003)
GUICtrlSetData($g_idComboIP, $g_sIP)
ControlCommand($g_hGui, '', $g_idComboIP, "SetCurrentSelection", 2) ;
$g_idComboDevice = GUICtrlCreateCombo('', l($g_idComboIP), 5, $g_iW / 6, 20) ;, 0x0003)
$T = ControlGetPos($g_hGui, '', $g_idComboDevice)
$g_idComboFernsehKanal = GUICtrlCreateCombo('', l($g_idComboDevice), 5, $g_iW - ($T[0] + $T[2]) - 10, 20) ;, 0x0003)
;----------------------------- listview
$T = ControlGetPos($g_hGui, '', $g_idBtnStart)
$iStyle = -1
$iexStyle = -1
$g_hListView = GUICtrlCreateListView('', 5, t($g_idBtnStart), $g_iW - 10, $g_iH - ($T[1] + $T[3]) - 50, $iStyle, $iexStyle)
;$g_hListView = ControlGetHandle($g_hGui, '', $g_hListView)
_GUICtrlListView_AddColumn($g_hListView, 'command:', $g_iW - 20)
$g_hCopy = GUICtrlCreateButton("Copy Selected", 5, t($g_hListView), $g_iW - 10, 20)
GUICtrlSetOnEvent(-1, "SuiviClip")
GUISetState(@SW_SHOW, $g_hGui)
EndFunc ;==>GUI
Func SuiviClip() ; copie une commande dans le presse-papier
Local $string, $T
;~ $string=ControlListView ($g_hGUISuivi,'',$g_hListView, "GetSelected")
;~ cw(@error&@TAB&$string)
;~ $idx=_GUICtrlListView_GetHotItem ($g_hListView)
;~ $string= _GUICtrlListView_GetItemText ($g_hListView, $idx)
;~ cw($idx&@TAB&$string)
$T = _GUICtrlListView_GetSelectedIndices($g_hListView, True)
$string = _GUICtrlListView_GetItemText($g_hListView, $T[1])
ClipPut($string)
EndFunc ;==>SuiviClip
Func Mini() ;cache la listview
Local $T = WinGetPos($g_hGui)
cw($T[3])
Select
Case $T[3] > 100
ControlHide($g_hGui, '', $g_hListView)
ControlHide($g_hGui, '', $g_hCopy)
WinMove($g_hGui, '', Default, Default, Default, 80)
Case Else
WinMove($g_hGui, '', Default, Default, Default, $g_iH)
ControlShow($g_hGui, '', $g_hListView)
ControlShow($g_hGui, '', $g_hCopy)
EndSelect
EndFunc ;==>Mini
Func SelectNodes($sfile, $snode)
;cw($sfile&@tab&$snode)
If Not FileExists($sfile) Then Return SetError(1, 0, '')
Local $oErrorHandler = ObjEvent("AutoIt.Error", ErrFunc_CustomUserHandler_MAIN)
#forceref $oErrorHandler
; first you must create $oXmlDoc object
Local $oXMLDoc = _XML_CreateDOMDocument(Default)
If @error Then
wt(XML_My_ErrorParser(@error))
Return SetError(1, 0, '')
EndIf
; now you can add EVENT Handler
Local $oXMLDOM_EventsHandler = ObjEvent($oXMLDoc, "XML_DOM_EVENT_")
#forceref $oXMLDOM_EventsHandler
; Load file to $oXmlDoc
Local $sXmlFile = $sfile
_XML_Load($oXMLDoc, $sXmlFile)
If @error Then
wt(XML_My_ErrorParser(@error))
Return SetError(1, 0, '')
EndIf
;simple display $oXmlDoc - for checking only
_XML_TIDY($oXMLDoc)
If @error Then
wt(XML_My_ErrorParser(@error))
Return SetError(1, 0, '')
EndIf
Local $oNodesColl = _XML_SelectNodes($oXMLDoc, $snode)
If @error Then
wt(XML_My_ErrorParser(@error))
Return SetError(1, 0, '')
EndIf
Local $aNodesColl = _XML_Array_GetNodesProperties($oNodesColl)
If @error Then
wt(XML_My_ErrorParser(@error))
Return SetError(1, 0, '')
EndIf
;ad($aNodesColl)
Return $aNodesColl
EndFunc ;==>SelectNodes
; #FUNCTION# ====================================================================================================================
; Name ..........: XML_My_ErrorParser
; Description ...: Changing $XML_ERR_ ... to human readable description
; Syntax ........: XML_My_ErrorParser($iXMLWrapper_Error, $iXMLWrapper_Extended)
; Parameters ....: $iXMLWrapper_Error - an integer value.
; $iXMLWrapper_Extended - an integer value.
; Return values .: description as string
; Author ........: mLipok
; Modified ......:
; Remarks .......: This function is only example of how user can parse @error and @extended to human readable description
; Related .......:
; Link ..........:
; Example .......: No
; ===============================================================================================================================
Func XML_My_ErrorParser($iXMLWrapper_Error, $iXMLWrapper_Extended = 0)
Local $XML_ERR_OK, $sErrorInfo = ''
Switch $iXMLWrapper_Error
Case $XML_ERR_OK
$sErrorInfo = '$XML_ERR_OK=' & $XML_ERR_OK & @CRLF & 'All is ok.'
Case $XML_ERR_GENERAL
$sErrorInfo = '$XML_ERR_GENERAL=' & $XML_ERR_GENERAL & @CRLF & 'The error which is not specifically defined.'
Case $XML_ERR_COMERROR
$sErrorInfo = '$XML_ERR_COMERROR=' & $XML_ERR_COMERROR & @CRLF & 'COM ERROR OCCURED. Check @extended and your own error handler function for details.'
Case $XML_ERR_ISNOTOBJECT
$sErrorInfo = '$XML_ERR_ISNOTOBJECT=' & $XML_ERR_ISNOTOBJECT & @CRLF & 'No object passed to function'
Case $XML_ERR_INVALIDDOMDOC
$sErrorInfo = '$XML_ERR_INVALIDDOMDOC=' & $XML_ERR_INVALIDDOMDOC & @CRLF & 'Invalid object passed to function'
Case $XML_ERR_INVALIDATTRIB
$sErrorInfo = '$XML_ERR_INVALIDATTRIB=' & $XML_ERR_INVALIDATTRIB & @CRLF & 'Invalid object passed to function.'
Case $XML_ERR_INVALIDNODETYPE
$sErrorInfo = '$XML_ERR_INVALIDNODETYPE=' & $XML_ERR_INVALIDNODETYPE & @CRLF & 'Invalid object passed to function.'
Case $XML_ERR_OBJCREATE
$sErrorInfo = '$XML_ERR_OBJCREATE=' & $XML_ERR_OBJCREATE & @CRLF & 'Object can not be created.'
Case $XML_ERR_NODECREATE
$sErrorInfo = '$XML_ERR_NODECREATE=' & $XML_ERR_NODECREATE & @CRLF & 'Can not create Node - check also COM Error Handler'
Case $XML_ERR_NODEAPPEND
$sErrorInfo = '$XML_ERR_NODEAPPEND=' & $XML_ERR_NODEAPPEND & @CRLF & 'Can not append Node - check also COM Error Handler'
Case $XML_ERR_PARSE
$sErrorInfo = '$XML_ERR_PARSE=' & $XML_ERR_PARSE & @CRLF & 'Error: with Parsing objects, .parseError.errorCode=' & $iXMLWrapper_Extended & ' Use _XML_ErrorParser_GetDescription() for get details.'
Case $XML_ERR_PARSE_XSL
$sErrorInfo = '$XML_ERR_PARSE_XSL=' & $XML_ERR_PARSE_XSL & @CRLF & 'Error with Parsing XSL objects .parseError.errorCode=' & $iXMLWrapper_Extended & ' Use _XML_ErrorParser_GetDescription() for get details.'
Case $XML_ERR_LOAD
$sErrorInfo = '$XML_ERR_LOAD=' & $XML_ERR_LOAD & @CRLF & 'Error opening specified file.'
Case $XML_ERR_SAVE
$sErrorInfo = '$XML_ERR_SAVE=' & $XML_ERR_SAVE & @CRLF & 'Error saving file.'
Case $XML_ERR_PARAMETER
$sErrorInfo = '$XML_ERR_PARAMETER=' & $XML_ERR_PARAMETER & @CRLF & 'Wrong parameter passed to function.'
Case $XML_ERR_ARRAY
$sErrorInfo = '$XML_ERR_ARRAY=' & $XML_ERR_ARRAY & @CRLF & 'Wrong array parameter passed to function. Check array dimension and conent.'
Case $XML_ERR_XPATH
$sErrorInfo = '$XML_ERR_XPATH=' & $XML_ERR_XPATH & @CRLF & 'XPath syntax error - check also COM Error Handler.'
Case $XML_ERR_NONODESMATCH
$sErrorInfo = '$XML_ERR_NONODESMATCH=' & $XML_ERR_NONODESMATCH & @CRLF & 'No nodes match the XPath expression'
Case $XML_ERR_NOCHILDMATCH
$sErrorInfo = '$XML_ERR_NOCHILDMATCH=' & $XML_ERR_NOCHILDMATCH & @CRLF & 'There is no Child in nodes matched by XPath expression.'
Case $XML_ERR_NOATTRMATCH
$sErrorInfo = '$XML_ERR_NOATTRMATCH=' & $XML_ERR_NOATTRMATCH & @CRLF & 'There is no such attribute in selected node.'
Case $XML_ERR_DOMVERSION
$sErrorInfo = '$XML_ERR_DOMVERSION=' & $XML_ERR_DOMVERSION & @CRLF & 'DOM Version: ' & 'MSXML Version ' & $iXMLWrapper_Extended & ' or greater required for this function'
Case $XML_ERR_EMPTYCOLLECTION
$sErrorInfo = '$XML_ERR_EMPTYCOLLECTION=' & $XML_ERR_EMPTYCOLLECTION & @CRLF & 'Collections of objects was empty'
Case $XML_ERR_EMPTYOBJECT
$sErrorInfo = '$XML_ERR_EMPTYOBJECT=' & $XML_ERR_EMPTYOBJECT & @CRLF & 'Object is empty'
Case Else
$sErrorInfo = '=' & $iXMLWrapper_Error & @CRLF & 'NO ERROR DESCRIPTION FOR THIS @error'
EndSwitch
Local $sExtendedInfo = ''
Switch $iXMLWrapper_Error
Case $XML_ERR_COMERROR, $XML_ERR_NODEAPPEND, $XML_ERR_NODECREATE
$sExtendedInfo = 'COM ERROR NUMBER (@error returned via @extended) =' & $iXMLWrapper_Extended
Case $XML_ERR_PARAMETER
$sExtendedInfo = 'This @error was fired by parameter: #' & $iXMLWrapper_Extended
Case Else
Switch $iXMLWrapper_Extended
Case $XML_EXT_DEFAULT
$sExtendedInfo = '$XML_EXT_DEFAULT=' & $XML_EXT_DEFAULT & @CRLF & 'Default - Do not return any additional information'
Case $XML_EXT_XMLDOM
$sExtendedInfo = '$XML_EXT_XMLDOM=' & $XML_EXT_XMLDOM & @CRLF & '"Microsoft.XMLDOM" related Error'
Case $XML_EXT_DOMDOCUMENT
$sExtendedInfo = '$XML_EXT_DOMDOCUMENT=' & $XML_EXT_DOMDOCUMENT & @CRLF & '"Msxml2.DOMDocument" related Error'
Case $XML_EXT_XSLTEMPLATE
$sExtendedInfo = '$XML_EXT_XSLTEMPLATE=' & $XML_EXT_XSLTEMPLATE & @CRLF & '"Msxml2.XSLTemplate" related Error'
Case $XML_EXT_SAXXMLREADER
$sExtendedInfo = '$XML_EXT_SAXXMLREADER=' & $XML_EXT_SAXXMLREADER & @CRLF & '"MSXML2.SAXXMLReader" related Error'
Case $XML_EXT_MXXMLWRITER
$sExtendedInfo = '$XML_EXT_MXXMLWRITER=' & $XML_EXT_MXXMLWRITER & @CRLF & '"MSXML2.MXXMLWriter" related Error'
Case $XML_EXT_FREETHREADEDDOMDOCUMENT
$sExtendedInfo = '$XML_EXT_FREETHREADEDDOMDOCUMENT=' & $XML_EXT_FREETHREADEDDOMDOCUMENT & @CRLF & '"Msxml2.FreeThreadedDOMDocument" related Error'
Case $XML_EXT_XMLSCHEMACACHE
$sExtendedInfo = '$XML_EXT_XMLSCHEMACACHE=' & $XML_EXT_XMLSCHEMACACHE & @CRLF & '"Msxml2.XMLSchemaCache." related Error'
Case $XML_EXT_STREAM
$sExtendedInfo = '$XML_EXT_STREAM=' & $XML_EXT_STREAM & @CRLF & '"ADODB.STREAM" related Error'
Case $XML_EXT_ENCODING
$sExtendedInfo = '$XML_EXT_ENCODING=' & $XML_EXT_ENCODING & @CRLF & 'Encoding related Error'
Case Else
$sExtendedInfo = '$iXMLWrapper_Extended=' & $iXMLWrapper_Extended & @CRLF & 'NO ERROR DESCRIPTION FOR THIS @extened'
EndSwitch
EndSwitch
; return back @error and @extended for further debuging
Return SetError($iXMLWrapper_Error, $iXMLWrapper_Extended, _
'@error description:' & @CRLF & _
$sErrorInfo & @CRLF & _
@CRLF & _
'@extended description:' & @CRLF & _
$sExtendedInfo & @CRLF & _
'')
EndFunc ;==>XML_My_ErrorParser
#EndRegion XMLWrapperEx__Examples.au3 - XML DOM Error/Event Handling
Func ErrFunc_CustomUserHandler_MAIN($oError)
cw(@ScriptName & " (" & $oError.scriptline & ") : MainScript ==> COM Error intercepted !" & @CRLF & _
@TAB & "err.number is: " & @TAB & @TAB & "0x" & Hex($oError.number) & @CRLF & _
@TAB & "err.windescription:" & @TAB & $oError.windescription & @CRLF & _
@TAB & "err.description is: " & @TAB & $oError.description & @CRLF & _
@TAB & "err.source is: " & @TAB & @TAB & $oError.source & @CRLF & _
@TAB & "err.helpfile is: " & @TAB & $oError.helpfile & @CRLF & _
@TAB & "err.helpcontext is: " & @TAB & $oError.helpcontext & @CRLF & _
@TAB & "err.lastdllerror is: " & @TAB & $oError.lastdllerror & @CRLF & _
@TAB & "err.scriptline is: " & @TAB & $oError.scriptline & @CRLF & _
@TAB & "err.retcode is: " & @TAB & "0x" & Hex($oError.retcode) & @CRLF & @CRLF)
EndFunc ;==>ErrFunc_CustomUserHandler_MAIN
Func Fertig()
Local $T = WinGetPos($g_hGui)
GUISetState(@SW_HIDE, $g_hGui)
If ProcessExists('DVPiper.exe') Then
Run('rundll32 user32.dll,MessageBeep')
ToolTip('le prg stoppe dans 10s', $T[0], $T[1] + 100, '', 3, 4 + 1)
StdinWrite($g_iPID, 'stopany' & @CRLF)
Sleep(1000 * 3)
StdinWrite($g_iPID, 'exit' & @CRLF)
Sleep(1000 * 2)
EndIf
If ProcessExists('DVPiper.exe') Then
ProcessClose('DVPiper.exe')
EndIf
Exit
EndFunc ;==>Fertig
Func Aide()
MsgBox($MB_SYSTEMMODAL, "", "But: envoyer le signal TV sur le poste 192.168.x.xxx (en udp) pour le lire avec un player type Vlc,SMplayer,MPC-HD..." & @CRLF & _
"Dans le player: ouvrir url(ou fichier) 'udp://192.168.x.xxx:1234' " & @CRLF & _
"--------------------------------------" & @CRLF & _
"La 1° fois (Menu):" & @CRLF & @CRLF & _
"1 Chercher le(s) Tuner TNT/DVB-T" & @CRLF & @CRLF & _
"2 Chercher les canaux de votre région (40 canaux 15-20 mn)" & @CRLF & @CRLF & _
"3 Vérifier la qualité du signal du multiplex" & @CRLF & _
"--------------------------------------" & @CRLF & @CRLF & _
"Bouton bleu: envoyer le signal TV sur l'adresse IP du poste client" & @CRLF & @CRLF & _
"Bouton Rouge: cesser le flux udp" & @CRLF & @CRLF & _
"Cheval au galop --> le process dvpiper est lancé (regarder dans le gestionnaire de tache)" & @CRLF & _
"--------------------------------------" & @CRLF & @CRLF & _
"Fenêtre suivi(Show/Hide): copier la ligne de commande dans le presse-papier" & @CRLF & @CRLF & _
"Clic sur l'icône de la barre de tâches --> tout cacher")
EndFunc ;==>Aide
Func TrayEvent()
;cw('TrayEvent'&@TAB&@TRAY_ID)
Local $iState
Switch @TRAY_ID
Case $TRAY_EVENT_PRIMARYDOWN
$iState = WinGetState($g_hGui, '')
;cw('WinGetState'&@TAB&$iState)
Switch BitAND($iState, 2)
Case False
GUISetState(@SW_SHOW, $g_hGui)
TraySetState($TRAY_ICONSTATE_STOPFLASH)
Case True
GUISetState(@SW_HIDE, $g_hGui)
TraySetState($TRAY_ICONSTATE_FLASH)
EndSwitch
EndSwitch
EndFunc ;==>TrayEvent
Func Tray()
TraySetClick(8) ;8 = Pressing secondary mouse button mouseclicks will display the tray menu
TrayCreateItem("Aide")
TrayItemSetOnEvent(-1, "Aide")
TrayCreateItem("")
TrayCreateItem("Quitter")
TrayItemSetOnEvent(-1, "Fertig")
TraySetIcon("kangaroo bleu 32.ico")
TraySetOnEvent($TRAY_EVENT_PRIMARYDOWN, "TrayEvent")
TraySetState($TRAY_ICONSTATE_SHOW)
EndFunc ;==>Tray
Func l($id) ;place le prochain crtl a droite+5
Local $P = ControlGetPos($g_hGui, '', $id)
Return $P[0] + $P[2] + 5
EndFunc ;==>l
Func t($id) ;place le prochain crtl en bas+5
Local $P = ControlGetPos($g_hGui, '', $id)
Return $P[1] + $P[3] + 5
EndFunc ;==>t
Func Cote($value, $delim = '"')
Return $delim & $value & $delim
EndFunc ;==>Cote
Func ErreurFatale($message)
ToolTip($message, 1, 1, '', 1, 1)
Run('rundll32 user32.dll,MessageBeep')
Sleep(10 * 1000)
ToolTip('')
Fertig()
EndFunc ;==>ErreurFatale
Func ErreurNonFatale($message, $hWnd) ; attache a la fenetre
Local $T = WinGetPos($hWnd)
Run('rundll32 user32.dll,MessageBeep')
ToolTip($message, $T[0], $T[1] + 100, '', 3, 4 + 1)
Sleep(1000 * 7)
ToolTip('')
EndFunc ;==>ErreurNonFatale
Func DeleteBlankLine($T)
If Not IsArray($T) Then Return SetError(1, 0, '')
Local $i, $Count = 0
If $T[0] = UBound($T) - 1 Then _ArrayDelete($T, 0) ;delete l'index de la 1° ligne
For $i = 0 To UBound($T) - 1
If StringRegExp($T[$i], '\w') = 1 Then ;Match any "word" character: a-z, A-Z, 0-9 or underscore (_).
$T[$Count] = $T[$i]
$Count += 1
EndIf
Next
If $Count = 0 Then Return SetError(1, 0, '')
ReDim $T[$Count]
Return $T
EndFunc ;==>DeleteBlankLine
Func srch($T, $value, $iForward = 1)
Local $i = -1
Local $iStart = 0, $iEnd = 0, $iCase = 0, $iCompare = 1
If Not IsArray($T) Then Return $i
$i = _ArraySearch($T, $value, $iStart, $iEnd, $iCase, $iCompare, $iForward)
Return SetError(@error, 0, $i)
EndFunc ;==>srch
Func AD($T, $line = @ScriptLineNumber)
If Not IsArray($T) Then Return
_ArrayDisplay($T, $line)
EndFunc ;==>AD
Func cw($text = @ScriptLineNumber, $line = @ScriptLineNumber)
ConsoleWrite(StringFormat("%04d", $line) & @TAB & '|')
ConsoleWrite($text)
ConsoleWrite('|' & @LF)
EndFunc ;==>cw
Func wt($texte = @ScriptLineNumber, $titre = @ScriptLineNumber)
If MsgBox(1, $titre, '|' & $texte & '|') <> 1 Then Exit
EndFunc ;==>wt
#AutoIt3Wrapper_Icon=kangaroo bleu 32.ico
#AutoIt3Wrapper_UseX64=y
#AutoIt3Wrapper_Run_Tidy=y
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
;http://www.cs.usyd.edu.au/~efax/DVPiper.html
;
;un peu d'info
;http://forum.hardware.fr/hfr/VideoSon/HiFi-HomeCinema/dvpiper-streaming-tnt-sujet_121207_1.htm
;
;ce que j'appris de tous ces soft TV
;http://www.tvnt.net/forum/les-softs-pouchintv-vlc-wintv2k-et-autres-mediacenters-t19.html
;la recherche initiale des chaines c'est très compliqué, la plupart n'y arrive pas
;les 'meilleurs' : le média center de Win7 (mais je l'ai viré il y a 3 ans),
;les softs fourni avec les cle usb (mais ils sont trés trés lourd)
;PouchinTVMod fait 1Mo, TOUS les autres vont de 30GO à 100GO
;DVPiper trouve les 6 multiplex sur 2 cles et 5 sur l'avermedia
;Pouchin trouve (et encore pas tjrs) 5 multiplex sur 2 cles et 4 sur l'avermedia
;
;En UHF la règle de calcul est simple :
;N° de canal x8 + 306 = Fréquence en Mhz , auquel il convient d'ajouter le shift décalage de 0,167 Mhz
;Exemple canal 42 :
;42 x 8 = 336 ; 336+306 = 642 ; 642+0,167 = 642,167Mhz
;voir la fonction RechercheMultiplex()
;
;-------------------------------------------------
;envoyer le signal TV sur le poste 192.168.1.200 (en udp) pour le lire avec un player type Vlc(udp://@:1234),SMplayer,MPC-HD...
;DVPiper.exe -devicenum 1 -type DVB-T -frequency 522167 -bandwidth 8 -command "record(rid(1237),progid(1031),buildpat,send(udp(192.168.1.200,1234)))"
;perso je lis sans probleme du 1920x1080 sur un reseau en cpl
;
;liste des devices TNT (BDA) il m'a trouve mes 3 cles usb (avermedia,hautpage,conceptronic)
;DVPiper.exe -listdevicexml
;
;les programmes tele (epg)
;DVPiper -devicenum 1 -type dvb-t -frequency 522167 -bandwidth 8 -epg "epg.xml"
;
;recherche les canaux du multiplex
;DVPiper.exe -devicenum 1 -type DVB-T -frequency 746167 -bandwidth 8 -command scan
;
;enregistre le canal 1031 (Arte) dans un fichier TS
;DVPiper.exe -devicenum 1 -type DVB-T -frequency 522167 -bandwidth 8 _
;-command "record(rid(1),progid(1031),buildpat,send(file('fichier.ts')))"
;
;Qualite du signal du multiplex
;DVPiper.exe -devicename "DVB-T Dongle" -type DVB-T -frequency 594167 -bandwidth 8 -command signal
;
;regexp un grand merci a mikell https://autoitscript.fr/forum
;
#include <GuiListView.au3>
#include <GuiButton.au3>
#include <TrayConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GuiComboBox.au3>
#include <array.au3>
#include <File.au3> ;_FileWriteFromArray
#include <_XML.au3> ;https://www.autoitscript.com/forum/files/file/358-xmlau3-formerly-xmlwrapperexau3/
Opt('MustDeclareVars', 1)
Opt("GUIOnEventMode", 1)
Opt("GUICloseOnESC", 0)
Opt("TrayMenuMode", 3)
Opt("TrayOnEventMode", 1)
Global Const $shorse = @ScriptDir & '\horse.ani' ;l'icone horse anime ....\AutoIt3\Examples\Helpfile\Extras\horse.ani
Global Const $g_sDVPiper = @ScriptDir & '\DVPiper.exe'
Global Const $g_sIP = '192.168.1.100|192.168.1.101|192.168.1.102' ; mes 3 PC (win7 pro)
Global Const $g_sdevicexml = @ScriptDir & '\device.xml' ; fichier xml des tuner TNT a creer dans le menu de la GUI
Global Const $g_iW = 700, $g_iH = 300
Global $g_iPID, $g_hListView, $g_hGui, $g_idComboIP, $g_idComboDevice, $g_idComboFernsehKanal
Global $g_idBtnAnhalten, $g_idBtnStart, $g_idani, $g_hCopy
Init()
While 1
Sleep(100)
WEnd
Func Init()
GUI()
Tray()
If Not FileExists(@ScriptDir & '\log\') Then DirCreate(@ScriptDir & '\log\')
ComboDevice() ;combo dongle TNT
If Not @error Then ComboFernsehKanal() ;combo chaines
EndFunc ;==>Init
Func SignalQualitat() ;Qualite du signal du multiplex
;DVPiper.exe -devicename "DVB-T Dongle" -type DVB-T -frequency 594167 -bandwidth 8 -command signal
Local $i, $T, $scmd, $sdevice, $sfreq
GUICtrlSetImage($g_idani, $shorse)
_GUICtrlButton_Enable($g_idBtnStart, False) ;empeche d'appuyer sur start
$sdevice = '-log .\log\SignalQualitat.log -devicename ' & Cote(GUICtrlRead($g_idComboDevice))
$sfreq = GUICtrlRead($g_idComboFernsehKanal)
$sfreq = StringRegExpReplace($sfreq, '(.*bandwidth \d).*', '${1}') ;-type DVB-T -frequency 522167 -bandwidth 8........
$scmd = $g_sDVPiper & ' ' & $sdevice & ' ' & $sfreq & ' -command signal'
$T = StdoutR($scmd, 0) ; 0 = ne pas attendre que le process s'arrete
$i = srch($T, 'Strength') ; recupere la force du signal
Switch $i
Case -1
WinSetTitle($g_hGui, '', 'Pas de signal')
Case Else
WinSetTitle($g_hGui, '', $T[$i])
EndSwitch
StdinWrite($g_iPID, 'stopany' & @CRLF) ;envoie des commandes a DVPiper pour l'arreter
Sleep(1000 * 2)
StdinWrite($g_iPID, 'exit' & @CRLF)
GUICtrlSetImage($g_idani, "shell32.dll", 253)
_GUICtrlButton_Enable($g_idBtnStart, True) ; on peut appuyer sur start
EndFunc ;==>SignalQualitat
Func Starten() ; demarre un send(udp(192.168....
;DVPiper.exe -devicenum 2 -type DVB-T -frequency 746167 -bandwidth 8
;-command "record(rid(1237),progid(262),buildpat,send(udp(192.168.1.200,1234)))"
Local $i, $T, $scmd, $sout, $sdevice, $sfreq, $sprogid, $sIP
_GUICtrlButton_Enable($g_idBtnStart, False) ; empeche de reappuyer
GUICtrlSetImage($g_idani, $shorse)
$sIP = GUICtrlRead($g_idComboIP)
$sdevice = ' -log .\log\send_udp.log -devicename ' & Cote(GUICtrlRead($g_idComboDevice))
$sfreq = GUICtrlRead($g_idComboFernsehKanal)
$sfreq = StringRegExpReplace($sfreq, '(.*bandwidth \d).*', '${1}')
$sprogid = GUICtrlRead($g_idComboFernsehKanal)
$sprogid = StringRegExpReplace($sprogid, '.*bandwidth \d (\d{1,4}) .*', '${1}')
$scmd = $g_sDVPiper & ' ' & $sdevice & ' ' & $sfreq & _
' -signalstart -command "record(rid(1237),progid(' & $sprogid & '),buildpat,send(udp(' & $sIP & ',1234)))"'
$T = StdoutR($scmd, 0) ;ne pas attendre que le process s'arrete
$i = srch($T, 'Strength') ; recupere la force du signal
Switch $i
Case -1
WinSetTitle($g_hGui, '', 'Pas de signal')
Case Else
WinSetTitle($g_hGui, '', $T[$i])
EndSwitch
AdlibRegister("StdoutDVPiper", 1000 * 5) ; lit le stdout toutes les 5s
EndFunc ;==>Starten
Func StdoutDVPiper() ;recupere le Stdout pour l'afficher et verifie que ProcessExists("DVPiper.exe")
Local $icount, $sout = StdoutRead($g_iPID)
If $sout <> '' Then
_GUICtrlListView_AddItem($g_hListView, $sout)
$icount = _GUICtrlListView_GetItemCount($g_hListView)
_GUICtrlListView_Scroll($g_hListView, 0, $icount)
EndIf
If Not ProcessExists($g_iPID) Then
_GUICtrlButton_Enable($g_idBtnStart, True)
GUICtrlSetImage($g_idani, "shell32.dll", 253)
AdlibUnRegister("StdoutDVPiper")
EndIf
EndFunc ;==>StdoutDVPiper
Func Anhalten() ;envoie des commandes a DVPIper pour l'arreter
ErreurNonFatale("Stoppe dans 10s", $g_hGui)
_GUICtrlButton_Enable($g_idBtnStart, True)
GUICtrlSetImage($g_idani, "shell32.dll", 253)
If Not ProcessExists('DVPiper.exe') Then Return
StdinWrite($g_iPID, 'stopany' & @CRLF)
Sleep(1000 * 5)
StdinWrite($g_iPID, 'exit' & @CRLF)
AdlibUnRegister("StdoutDVPiper")
EndFunc ;==>Anhalten
Func ComboDevice() ; rempli le combo device avec le fichier device.xml
If Not FileExists($g_sdevicexml) Then
ErreurNonFatale("(Menu) Commencer par chercher le(s) Tuner TNT/DVB-T", $g_hGui)
Return SetError(1, 0, '')
EndIf
Local $i, $T = SelectNodes($g_sdevicexml, '/devices/device/name')
If @error Then Return SetError(1, 0, '')
$i = 1
While 1
GUICtrlSetData($g_idComboDevice, $T[$i][3])
$i += 1
If $i > UBound($T) - 1 Then ExitLoop
WEnd
;ControlCommand($g_hGui, '', $g_idComboDevice, "SetCurrentSelection", 0)
GUICtrlSetData($g_idComboDevice, "DVB-T Dongle", "DVB-T Dongle")
EndFunc ;==>ComboDevice
Func ComboFernsehKanal() ;rempli le combo chaines avec les fichiers *167.xml......
Local $selement, $sfreq, $aenum
$aenum = _FileListToArray(@ScriptDir, '*167.xml', 1, 0)
$aenum = DeleteBlankLine($aenum)
If @error Then
ErreurNonFatale('(Menu) Commencer par chercher les Multiplex (15-20mn)', $g_hGui)
Return SetError(1, 0, '')
EndIf
For $selement In $aenum
$sfreq = Frequenz($selement)
Kanal($selement, $sfreq)
Next
ControlCommand($g_hGui, '', $g_idComboFernsehKanal, "SetCurrentSelection", 0)
EndFunc ;==>ComboFernsehKanal
Func Frequenz($selement)
;a priori l'UDF XML ne sait pas lire des 'nodes' tel que
;programs date="20161118003625 +0000" generator-info-name="DVPiper" networkType="DVB-T" frequency="522167" bandwidth="8"
;donc je fais des RegExp
Local $sfreq, $snode = "/programs"
Local $T = SelectNodes($selement, $snode)
If @error Then Return SetError(1, 0, '')
;<programs date="20161120040859 +0000" generator-info-name="DVPiper" networkType="DVB-T" frequency="594167" bandwidth="8">
;<program id="1537" name="TF1" provider="SMR6" access="FTA" originalNetworkId="8442" transportStreamId="6">
; <packet pid="100" type="PMT"/>
;.....
;ad($T)
$sfreq = $T[1][5]
$sfreq = StringRegExpReplace($sfreq, '(.*)\s.*', '${1}') ; ne garde que la premiere ligne
;<programs date="20161118003625 +0000" generator-info-name="DVPiper" networkType="DVB-T" frequency="522167" bandwidth="8">
$sfreq = StringRegExpReplace($sfreq, '.*DVPiper"(.*)>', '${1}')
$sfreq = StringRegExpReplace($sfreq, '="', ' ')
$sfreq = StringRegExpReplace($sfreq, '"', '')
$sfreq = StringRegExpReplace($sfreq, 'networkType', '-type')
$sfreq = StringRegExpReplace($sfreq, 'frequency', '-frequency')
$sfreq = StringRegExpReplace($sfreq, 'bandwidth', '-bandwidth')
;cw($sfreq)
Return $sfreq
EndFunc ;==>Frequenz
Func Kanal($selement, $sfreq) ; rempli le combo chaines
Local $T, $sKanal, $spattern
Local $snode = "/programs/program"
$T = SelectNodes($selement, $snode)
If @error Then Return SetError(1, 0, '')
;ad($T)
For $i = 1 To UBound($T) - 1
;<program id="1025" name="M6" provider="Multi4"......
$sKanal = $T[$i][5]
$sKanal = StringRegExpReplace($sKanal, '(.*)\s.*', '${1}')
$spattern = '<program id="(.*)" name="(.*)" provider.*'
$sKanal = StringRegExpReplace($sKanal, $spattern, '${1} ${2}')
$sKanal = $sfreq & ' ' & $sKanal
GUICtrlSetData($g_idComboFernsehKanal, $sKanal)
Next
EndFunc ;==>Kanal
Func DeviceXml() ;DVPiper.exe -listdevicexml
Local $scmd, $i, $T
GUICtrlSetData($g_idComboDevice, '')
FileDelete($g_sdevicexml)
$scmd = $g_sDVPiper & ' -log .\log\Device.log -input BDA -type dvb-t -listdevicexml -emptyexit '
$T = StdoutR($scmd)
If Not IsArray($T) Then
ErreurFatale('ne trouve pas de clé tnt')
EndIf
;retour de la commande:
;
;Parameters: DVPiper.exe -log .\log\Device.log -input BDA -type dvb-t -listdevicexml -emptyexit
;2016/11/21 09:53:10.307: Set type: DVB-T
;<devices>
;<device><id>1</id><name>DVB-T
For $i = 0 To UBound($T) - 1
$T[$i] = StringRegExpReplace($T[$i], '^[^<].*', '') ; supprime tout ce qui ne commence par <
Next
$T = DeleteBlankLine($T)
If Not IsArray($T) Then
ErreurFatale('ne trouve pas de clé tnt')
EndIf
Local $hFileOpen = FileOpen($g_sdevicexml, 2 + 128) ; write+utf8
_FileWriteFromArray($hFileOpen, $T)
FileClose($hFileOpen)
ComboDevice() ; rempli le combo device avec le fichier device.xml
EndFunc ;==>DeviceXml
Func RechercheMultiplex()
Local $sdevice = '-devicename ' & Cote(GUICtrlRead($g_idComboDevice)) ; avec quelle cle usb
Local $scmd, $i, $T, $ifreq, $sxml
GUICtrlSetData($g_idComboFernsehKanal, '') ; efface les anciens multiplex
If _GUICtrlComboBox_GetCount($g_idComboDevice) = 0 Then
ErreurNonFatale('Commencer par DeviceXml', $g_hGui)
Return SetError(1, 0, '')
EndIf
GUICtrlSetImage($g_idani, $shorse)
_GUICtrlButton_Enable($g_idBtnStart, False) ; empeche d'appuyer sur le button bleu
Local $hTimer = TimerInit()
For $i = 21 To 60
;http://www.tvnt.net/forum/tableau-de-conversion-des-canaux-uhf-en-frequences-t23059.html
;( Canal x 8 ) + 306 +0.167 = Fréquence (MHz)
$ifreq = ((($i * 8) + 306) + 0.167) * 1000
$sxml = $ifreq & '.xml'
$scmd = $g_sDVPiper & ' ' & $sdevice & _
' -log .\log\Multiplex.log -type dvb-t -frequency ' & _
$ifreq & ' -bandwidth 8 -command scan(filedec(' & _
Cote($sxml) & ')) -emptyexit'
;DVPiper.exe -devicenum 2 -type DVB-T -frequency 522167 -bandwidth 8 -command scan(filedec('522167.xml'))
StdoutR($scmd) ;creer le fichier $sfreq.xml
If FileGetSize($sxml) < 10 Then FileDelete($sxml) ; un fichier normal fait plus de 4000
Next
_GUICtrlListView_AddItem($g_hListView, Round((TimerDiff($hTimer) / 1000 / 60)) & 'mn')
_GUICtrlListView_AddItem($g_hListView, '')
Run('rundll32 user32.dll,MessageBeep')
ComboFernsehKanal() ;rempli le combo FernsehKanal avec les fichiers $sfreq.xml
GUICtrlSetImage($g_idani, "shell32.dll", 253)
_GUICtrlButton_Enable($g_idBtnStart, True) ; on peut appuyer sur start
EndFunc ;==>RechercheMultiplex
Func StdoutR($scmd, $sProcessClose = 1)
;parfois la cmd ne s'arrete jamais par ex un send(udp:168.....)
;c'est à moi de l'arreter avec un StdinWrite($g_iPID, 'stopany' & @CRLF)
Local $icount, $sout, $serr, $T
$scmd = StringStripWS($scmd, 7) ; double space
_GUICtrlListView_AddItem($g_hListView, $scmd)
_GUICtrlListView_AddItem($g_hListView, '')
$icount = _GUICtrlListView_GetItemCount($g_hListView)
_GUICtrlListView_Scroll($g_hListView, 0, $icount)
$g_iPID = Run($scmd, "", @SW_HIDE, $STDIN_CHILD + $STDOUT_CHILD)
Switch $sProcessClose
Case 1
ProcessWaitClose($g_iPID)
Case 0
Sleep(1000 * 10) ; attend un peu que la cmd envoie des infos
EndSwitch
While 1
$sout = StdoutRead($g_iPID)
If @error Then ExitLoop
If $sout <> '' Then
$T = StringSplit($sout, @CRLF, 2)
$T = DeleteBlankLine($T)
Return $T
EndIf
WEnd
EndFunc ;==>StdoutR
Func GUI()
Local $T, $iStyle, $iexStyle
$iStyle = -1
$g_hGui = GUICreate('DVPiper --> send(udp(192.168.x.xxx,1234))', $g_iW, $g_iH, 1, 1, $iStyle)
GUISetOnEvent($GUI_EVENT_CLOSE, "Fertig", $g_hGui)
;----------------------------- Menu
Local $idFilemenu = GUICtrlCreateMenu("&Menu")
GUICtrlCreateMenuItem("Qualité du signal", $idFilemenu)
GUICtrlSetOnEvent(-1, "SignalQualitat")
GUICtrlCreateMenuItem('', $idFilemenu)
GUICtrlCreateMenuItem("Chercher le(s) Tuner TNT/DVB-T", $idFilemenu)
GUICtrlSetOnEvent(-1, "DeviceXml")
GUICtrlCreateMenuItem("Chercher les Multiplex (60s x 40canaux)", $idFilemenu)
GUICtrlSetOnEvent(-1, "RechercheMultiplex")
GUICtrlCreateMenuItem("Suivi", $idFilemenu)
GUICtrlSetOnEvent(-1, "Mini")
;----------------------------- Button
$g_idBtnStart = GUICtrlCreateButton('', 5, 5, 32, 32, BitOR($BS_DEFPUSHBUTTON, $BS_ICON))
GUICtrlSetOnEvent($g_idBtnStart, "Starten")
GUICtrlSetTip($g_idBtnStart, 'Envoyer le signal TV sur le poste 192.168.....')
GUICtrlSetImage($g_idBtnStart, 'shell32.dll', 221, 1)
$g_idBtnAnhalten = GUICtrlCreateButton('', l($g_idBtnStart), 5, 32, 32, $BS_ICON)
GUICtrlSetOnEvent($g_idBtnAnhalten, "Anhalten")
GUICtrlSetTip($g_idBtnAnhalten, 'Cesser le flux udp')
GUICtrlSetImage($g_idBtnAnhalten, 'shell32.dll', 28, 1)
;----------------------------- icon
$g_idani = GUICtrlCreateIcon("shell32.dll", 253, l($g_idBtnAnhalten), 5, 32, 32)
;----------------------------- Combo
$g_idComboIP = GUICtrlCreateCombo('', l($g_idani), 5, $g_iW / 6, 20, 0x0003)
GUICtrlSetData($g_idComboIP, $g_sIP)
ControlCommand($g_hGui, '', $g_idComboIP, "SetCurrentSelection", 2) ;
$g_idComboDevice = GUICtrlCreateCombo('', l($g_idComboIP), 5, $g_iW / 6, 20) ;, 0x0003)
$T = ControlGetPos($g_hGui, '', $g_idComboDevice)
$g_idComboFernsehKanal = GUICtrlCreateCombo('', l($g_idComboDevice), 5, $g_iW - ($T[0] + $T[2]) - 10, 20) ;, 0x0003)
;----------------------------- listview
$T = ControlGetPos($g_hGui, '', $g_idBtnStart)
$iStyle = -1
$iexStyle = -1
$g_hListView = GUICtrlCreateListView('', 5, t($g_idBtnStart), $g_iW - 10, $g_iH - ($T[1] + $T[3]) - 50, $iStyle, $iexStyle)
;$g_hListView = ControlGetHandle($g_hGui, '', $g_hListView)
_GUICtrlListView_AddColumn($g_hListView, 'command:', $g_iW - 20)
$g_hCopy = GUICtrlCreateButton("Copy Selected", 5, t($g_hListView), $g_iW - 10, 20)
GUICtrlSetOnEvent(-1, "SuiviClip")
GUISetState(@SW_SHOW, $g_hGui)
EndFunc ;==>GUI
Func SuiviClip() ; copie une commande dans le presse-papier
Local $string, $T
;~ $string=ControlListView ($g_hGUISuivi,'',$g_hListView, "GetSelected")
;~ cw(@error&@TAB&$string)
;~ $idx=_GUICtrlListView_GetHotItem ($g_hListView)
;~ $string= _GUICtrlListView_GetItemText ($g_hListView, $idx)
;~ cw($idx&@TAB&$string)
$T = _GUICtrlListView_GetSelectedIndices($g_hListView, True)
$string = _GUICtrlListView_GetItemText($g_hListView, $T[1])
ClipPut($string)
EndFunc ;==>SuiviClip
Func Mini() ;cache la listview
Local $T = WinGetPos($g_hGui)
cw($T[3])
Select
Case $T[3] > 100
ControlHide($g_hGui, '', $g_hListView)
ControlHide($g_hGui, '', $g_hCopy)
WinMove($g_hGui, '', Default, Default, Default, 80)
Case Else
WinMove($g_hGui, '', Default, Default, Default, $g_iH)
ControlShow($g_hGui, '', $g_hListView)
ControlShow($g_hGui, '', $g_hCopy)
EndSelect
EndFunc ;==>Mini
Func SelectNodes($sfile, $snode)
;cw($sfile&@tab&$snode)
If Not FileExists($sfile) Then Return SetError(1, 0, '')
Local $oErrorHandler = ObjEvent("AutoIt.Error", ErrFunc_CustomUserHandler_MAIN)
#forceref $oErrorHandler
; first you must create $oXmlDoc object
Local $oXMLDoc = _XML_CreateDOMDocument(Default)
If @error Then
wt(XML_My_ErrorParser(@error))
Return SetError(1, 0, '')
EndIf
; now you can add EVENT Handler
Local $oXMLDOM_EventsHandler = ObjEvent($oXMLDoc, "XML_DOM_EVENT_")
#forceref $oXMLDOM_EventsHandler
; Load file to $oXmlDoc
Local $sXmlFile = $sfile
_XML_Load($oXMLDoc, $sXmlFile)
If @error Then
wt(XML_My_ErrorParser(@error))
Return SetError(1, 0, '')
EndIf
;simple display $oXmlDoc - for checking only
_XML_TIDY($oXMLDoc)
If @error Then
wt(XML_My_ErrorParser(@error))
Return SetError(1, 0, '')
EndIf
Local $oNodesColl = _XML_SelectNodes($oXMLDoc, $snode)
If @error Then
wt(XML_My_ErrorParser(@error))
Return SetError(1, 0, '')
EndIf
Local $aNodesColl = _XML_Array_GetNodesProperties($oNodesColl)
If @error Then
wt(XML_My_ErrorParser(@error))
Return SetError(1, 0, '')
EndIf
;ad($aNodesColl)
Return $aNodesColl
EndFunc ;==>SelectNodes
; #FUNCTION# ====================================================================================================================
; Name ..........: XML_My_ErrorParser
; Description ...: Changing $XML_ERR_ ... to human readable description
; Syntax ........: XML_My_ErrorParser($iXMLWrapper_Error, $iXMLWrapper_Extended)
; Parameters ....: $iXMLWrapper_Error - an integer value.
; $iXMLWrapper_Extended - an integer value.
; Return values .: description as string
; Author ........: mLipok
; Modified ......:
; Remarks .......: This function is only example of how user can parse @error and @extended to human readable description
; Related .......:
; Link ..........:
; Example .......: No
; ===============================================================================================================================
Func XML_My_ErrorParser($iXMLWrapper_Error, $iXMLWrapper_Extended = 0)
Local $XML_ERR_OK, $sErrorInfo = ''
Switch $iXMLWrapper_Error
Case $XML_ERR_OK
$sErrorInfo = '$XML_ERR_OK=' & $XML_ERR_OK & @CRLF & 'All is ok.'
Case $XML_ERR_GENERAL
$sErrorInfo = '$XML_ERR_GENERAL=' & $XML_ERR_GENERAL & @CRLF & 'The error which is not specifically defined.'
Case $XML_ERR_COMERROR
$sErrorInfo = '$XML_ERR_COMERROR=' & $XML_ERR_COMERROR & @CRLF & 'COM ERROR OCCURED. Check @extended and your own error handler function for details.'
Case $XML_ERR_ISNOTOBJECT
$sErrorInfo = '$XML_ERR_ISNOTOBJECT=' & $XML_ERR_ISNOTOBJECT & @CRLF & 'No object passed to function'
Case $XML_ERR_INVALIDDOMDOC
$sErrorInfo = '$XML_ERR_INVALIDDOMDOC=' & $XML_ERR_INVALIDDOMDOC & @CRLF & 'Invalid object passed to function'
Case $XML_ERR_INVALIDATTRIB
$sErrorInfo = '$XML_ERR_INVALIDATTRIB=' & $XML_ERR_INVALIDATTRIB & @CRLF & 'Invalid object passed to function.'
Case $XML_ERR_INVALIDNODETYPE
$sErrorInfo = '$XML_ERR_INVALIDNODETYPE=' & $XML_ERR_INVALIDNODETYPE & @CRLF & 'Invalid object passed to function.'
Case $XML_ERR_OBJCREATE
$sErrorInfo = '$XML_ERR_OBJCREATE=' & $XML_ERR_OBJCREATE & @CRLF & 'Object can not be created.'
Case $XML_ERR_NODECREATE
$sErrorInfo = '$XML_ERR_NODECREATE=' & $XML_ERR_NODECREATE & @CRLF & 'Can not create Node - check also COM Error Handler'
Case $XML_ERR_NODEAPPEND
$sErrorInfo = '$XML_ERR_NODEAPPEND=' & $XML_ERR_NODEAPPEND & @CRLF & 'Can not append Node - check also COM Error Handler'
Case $XML_ERR_PARSE
$sErrorInfo = '$XML_ERR_PARSE=' & $XML_ERR_PARSE & @CRLF & 'Error: with Parsing objects, .parseError.errorCode=' & $iXMLWrapper_Extended & ' Use _XML_ErrorParser_GetDescription() for get details.'
Case $XML_ERR_PARSE_XSL
$sErrorInfo = '$XML_ERR_PARSE_XSL=' & $XML_ERR_PARSE_XSL & @CRLF & 'Error with Parsing XSL objects .parseError.errorCode=' & $iXMLWrapper_Extended & ' Use _XML_ErrorParser_GetDescription() for get details.'
Case $XML_ERR_LOAD
$sErrorInfo = '$XML_ERR_LOAD=' & $XML_ERR_LOAD & @CRLF & 'Error opening specified file.'
Case $XML_ERR_SAVE
$sErrorInfo = '$XML_ERR_SAVE=' & $XML_ERR_SAVE & @CRLF & 'Error saving file.'
Case $XML_ERR_PARAMETER
$sErrorInfo = '$XML_ERR_PARAMETER=' & $XML_ERR_PARAMETER & @CRLF & 'Wrong parameter passed to function.'
Case $XML_ERR_ARRAY
$sErrorInfo = '$XML_ERR_ARRAY=' & $XML_ERR_ARRAY & @CRLF & 'Wrong array parameter passed to function. Check array dimension and conent.'
Case $XML_ERR_XPATH
$sErrorInfo = '$XML_ERR_XPATH=' & $XML_ERR_XPATH & @CRLF & 'XPath syntax error - check also COM Error Handler.'
Case $XML_ERR_NONODESMATCH
$sErrorInfo = '$XML_ERR_NONODESMATCH=' & $XML_ERR_NONODESMATCH & @CRLF & 'No nodes match the XPath expression'
Case $XML_ERR_NOCHILDMATCH
$sErrorInfo = '$XML_ERR_NOCHILDMATCH=' & $XML_ERR_NOCHILDMATCH & @CRLF & 'There is no Child in nodes matched by XPath expression.'
Case $XML_ERR_NOATTRMATCH
$sErrorInfo = '$XML_ERR_NOATTRMATCH=' & $XML_ERR_NOATTRMATCH & @CRLF & 'There is no such attribute in selected node.'
Case $XML_ERR_DOMVERSION
$sErrorInfo = '$XML_ERR_DOMVERSION=' & $XML_ERR_DOMVERSION & @CRLF & 'DOM Version: ' & 'MSXML Version ' & $iXMLWrapper_Extended & ' or greater required for this function'
Case $XML_ERR_EMPTYCOLLECTION
$sErrorInfo = '$XML_ERR_EMPTYCOLLECTION=' & $XML_ERR_EMPTYCOLLECTION & @CRLF & 'Collections of objects was empty'
Case $XML_ERR_EMPTYOBJECT
$sErrorInfo = '$XML_ERR_EMPTYOBJECT=' & $XML_ERR_EMPTYOBJECT & @CRLF & 'Object is empty'
Case Else
$sErrorInfo = '=' & $iXMLWrapper_Error & @CRLF & 'NO ERROR DESCRIPTION FOR THIS @error'
EndSwitch
Local $sExtendedInfo = ''
Switch $iXMLWrapper_Error
Case $XML_ERR_COMERROR, $XML_ERR_NODEAPPEND, $XML_ERR_NODECREATE
$sExtendedInfo = 'COM ERROR NUMBER (@error returned via @extended) =' & $iXMLWrapper_Extended
Case $XML_ERR_PARAMETER
$sExtendedInfo = 'This @error was fired by parameter: #' & $iXMLWrapper_Extended
Case Else
Switch $iXMLWrapper_Extended
Case $XML_EXT_DEFAULT
$sExtendedInfo = '$XML_EXT_DEFAULT=' & $XML_EXT_DEFAULT & @CRLF & 'Default - Do not return any additional information'
Case $XML_EXT_XMLDOM
$sExtendedInfo = '$XML_EXT_XMLDOM=' & $XML_EXT_XMLDOM & @CRLF & '"Microsoft.XMLDOM" related Error'
Case $XML_EXT_DOMDOCUMENT
$sExtendedInfo = '$XML_EXT_DOMDOCUMENT=' & $XML_EXT_DOMDOCUMENT & @CRLF & '"Msxml2.DOMDocument" related Error'
Case $XML_EXT_XSLTEMPLATE
$sExtendedInfo = '$XML_EXT_XSLTEMPLATE=' & $XML_EXT_XSLTEMPLATE & @CRLF & '"Msxml2.XSLTemplate" related Error'
Case $XML_EXT_SAXXMLREADER
$sExtendedInfo = '$XML_EXT_SAXXMLREADER=' & $XML_EXT_SAXXMLREADER & @CRLF & '"MSXML2.SAXXMLReader" related Error'
Case $XML_EXT_MXXMLWRITER
$sExtendedInfo = '$XML_EXT_MXXMLWRITER=' & $XML_EXT_MXXMLWRITER & @CRLF & '"MSXML2.MXXMLWriter" related Error'
Case $XML_EXT_FREETHREADEDDOMDOCUMENT
$sExtendedInfo = '$XML_EXT_FREETHREADEDDOMDOCUMENT=' & $XML_EXT_FREETHREADEDDOMDOCUMENT & @CRLF & '"Msxml2.FreeThreadedDOMDocument" related Error'
Case $XML_EXT_XMLSCHEMACACHE
$sExtendedInfo = '$XML_EXT_XMLSCHEMACACHE=' & $XML_EXT_XMLSCHEMACACHE & @CRLF & '"Msxml2.XMLSchemaCache." related Error'
Case $XML_EXT_STREAM
$sExtendedInfo = '$XML_EXT_STREAM=' & $XML_EXT_STREAM & @CRLF & '"ADODB.STREAM" related Error'
Case $XML_EXT_ENCODING
$sExtendedInfo = '$XML_EXT_ENCODING=' & $XML_EXT_ENCODING & @CRLF & 'Encoding related Error'
Case Else
$sExtendedInfo = '$iXMLWrapper_Extended=' & $iXMLWrapper_Extended & @CRLF & 'NO ERROR DESCRIPTION FOR THIS @extened'
EndSwitch
EndSwitch
; return back @error and @extended for further debuging
Return SetError($iXMLWrapper_Error, $iXMLWrapper_Extended, _
'@error description:' & @CRLF & _
$sErrorInfo & @CRLF & _
@CRLF & _
'@extended description:' & @CRLF & _
$sExtendedInfo & @CRLF & _
'')
EndFunc ;==>XML_My_ErrorParser
#EndRegion XMLWrapperEx__Examples.au3 - XML DOM Error/Event Handling
Func ErrFunc_CustomUserHandler_MAIN($oError)
cw(@ScriptName & " (" & $oError.scriptline & ") : MainScript ==> COM Error intercepted !" & @CRLF & _
@TAB & "err.number is: " & @TAB & @TAB & "0x" & Hex($oError.number) & @CRLF & _
@TAB & "err.windescription:" & @TAB & $oError.windescription & @CRLF & _
@TAB & "err.description is: " & @TAB & $oError.description & @CRLF & _
@TAB & "err.source is: " & @TAB & @TAB & $oError.source & @CRLF & _
@TAB & "err.helpfile is: " & @TAB & $oError.helpfile & @CRLF & _
@TAB & "err.helpcontext is: " & @TAB & $oError.helpcontext & @CRLF & _
@TAB & "err.lastdllerror is: " & @TAB & $oError.lastdllerror & @CRLF & _
@TAB & "err.scriptline is: " & @TAB & $oError.scriptline & @CRLF & _
@TAB & "err.retcode is: " & @TAB & "0x" & Hex($oError.retcode) & @CRLF & @CRLF)
EndFunc ;==>ErrFunc_CustomUserHandler_MAIN
Func Fertig()
Local $T = WinGetPos($g_hGui)
GUISetState(@SW_HIDE, $g_hGui)
If ProcessExists('DVPiper.exe') Then
Run('rundll32 user32.dll,MessageBeep')
ToolTip('le prg stoppe dans 10s', $T[0], $T[1] + 100, '', 3, 4 + 1)
StdinWrite($g_iPID, 'stopany' & @CRLF)
Sleep(1000 * 3)
StdinWrite($g_iPID, 'exit' & @CRLF)
Sleep(1000 * 2)
EndIf
If ProcessExists('DVPiper.exe') Then
ProcessClose('DVPiper.exe')
EndIf
Exit
EndFunc ;==>Fertig
Func Aide()
MsgBox($MB_SYSTEMMODAL, "", "But: envoyer le signal TV sur le poste 192.168.x.xxx (en udp) pour le lire avec un player type Vlc,SMplayer,MPC-HD..." & @CRLF & _
"Dans le player: ouvrir url(ou fichier) 'udp://192.168.x.xxx:1234' " & @CRLF & _
"--------------------------------------" & @CRLF & _
"La 1° fois (Menu):" & @CRLF & @CRLF & _
"1 Chercher le(s) Tuner TNT/DVB-T" & @CRLF & @CRLF & _
"2 Chercher les canaux de votre région (40 canaux 15-20 mn)" & @CRLF & @CRLF & _
"3 Vérifier la qualité du signal du multiplex" & @CRLF & _
"--------------------------------------" & @CRLF & @CRLF & _
"Bouton bleu: envoyer le signal TV sur l'adresse IP du poste client" & @CRLF & @CRLF & _
"Bouton Rouge: cesser le flux udp" & @CRLF & @CRLF & _
"Cheval au galop --> le process dvpiper est lancé (regarder dans le gestionnaire de tache)" & @CRLF & _
"--------------------------------------" & @CRLF & @CRLF & _
"Fenêtre suivi(Show/Hide): copier la ligne de commande dans le presse-papier" & @CRLF & @CRLF & _
"Clic sur l'icône de la barre de tâches --> tout cacher")
EndFunc ;==>Aide
Func TrayEvent()
;cw('TrayEvent'&@TAB&@TRAY_ID)
Local $iState
Switch @TRAY_ID
Case $TRAY_EVENT_PRIMARYDOWN
$iState = WinGetState($g_hGui, '')
;cw('WinGetState'&@TAB&$iState)
Switch BitAND($iState, 2)
Case False
GUISetState(@SW_SHOW, $g_hGui)
TraySetState($TRAY_ICONSTATE_STOPFLASH)
Case True
GUISetState(@SW_HIDE, $g_hGui)
TraySetState($TRAY_ICONSTATE_FLASH)
EndSwitch
EndSwitch
EndFunc ;==>TrayEvent
Func Tray()
TraySetClick(8) ;8 = Pressing secondary mouse button mouseclicks will display the tray menu
TrayCreateItem("Aide")
TrayItemSetOnEvent(-1, "Aide")
TrayCreateItem("")
TrayCreateItem("Quitter")
TrayItemSetOnEvent(-1, "Fertig")
TraySetIcon("kangaroo bleu 32.ico")
TraySetOnEvent($TRAY_EVENT_PRIMARYDOWN, "TrayEvent")
TraySetState($TRAY_ICONSTATE_SHOW)
EndFunc ;==>Tray
Func l($id) ;place le prochain crtl a droite+5
Local $P = ControlGetPos($g_hGui, '', $id)
Return $P[0] + $P[2] + 5
EndFunc ;==>l
Func t($id) ;place le prochain crtl en bas+5
Local $P = ControlGetPos($g_hGui, '', $id)
Return $P[1] + $P[3] + 5
EndFunc ;==>t
Func Cote($value, $delim = '"')
Return $delim & $value & $delim
EndFunc ;==>Cote
Func ErreurFatale($message)
ToolTip($message, 1, 1, '', 1, 1)
Run('rundll32 user32.dll,MessageBeep')
Sleep(10 * 1000)
ToolTip('')
Fertig()
EndFunc ;==>ErreurFatale
Func ErreurNonFatale($message, $hWnd) ; attache a la fenetre
Local $T = WinGetPos($hWnd)
Run('rundll32 user32.dll,MessageBeep')
ToolTip($message, $T[0], $T[1] + 100, '', 3, 4 + 1)
Sleep(1000 * 7)
ToolTip('')
EndFunc ;==>ErreurNonFatale
Func DeleteBlankLine($T)
If Not IsArray($T) Then Return SetError(1, 0, '')
Local $i, $Count = 0
If $T[0] = UBound($T) - 1 Then _ArrayDelete($T, 0) ;delete l'index de la 1° ligne
For $i = 0 To UBound($T) - 1
If StringRegExp($T[$i], '\w') = 1 Then ;Match any "word" character: a-z, A-Z, 0-9 or underscore (_).
$T[$Count] = $T[$i]
$Count += 1
EndIf
Next
If $Count = 0 Then Return SetError(1, 0, '')
ReDim $T[$Count]
Return $T
EndFunc ;==>DeleteBlankLine
Func srch($T, $value, $iForward = 1)
Local $i = -1
Local $iStart = 0, $iEnd = 0, $iCase = 0, $iCompare = 1
If Not IsArray($T) Then Return $i
$i = _ArraySearch($T, $value, $iStart, $iEnd, $iCase, $iCompare, $iForward)
Return SetError(@error, 0, $i)
EndFunc ;==>srch
Func AD($T, $line = @ScriptLineNumber)
If Not IsArray($T) Then Return
_ArrayDisplay($T, $line)
EndFunc ;==>AD
Func cw($text = @ScriptLineNumber, $line = @ScriptLineNumber)
ConsoleWrite(StringFormat("%04d", $line) & @TAB & '|')
ConsoleWrite($text)
ConsoleWrite('|' & @LF)
EndFunc ;==>cw
Func wt($texte = @ScriptLineNumber, $titre = @ScriptLineNumber)
If MsgBox(1, $titre, '|' & $texte & '|') <> 1 Then Exit
EndFunc ;==>wt