Jump to content

Can I change channel with a vbs script?


dgian

Recommended Posts

As the title says, is there a direct command to change the channel (id or number) with a script?

(I don't want to use the ExecNewProcess passing the -c command with channel number or the ? with the id because it is too slow for my purpose)

 

And if possible, after waiting x seconds returning to the last viewed one (if there is a direct command for it too)...

 

 

Thank you in advance.

Link to comment

Thanks for answering. Of course i mean using the com interface but what are the exact two commands that I need?

 

Searching all over the com interface chm, I can't find out what command does what I want.

 

 

Now I have something like this:

 

option explicit
dim myDVBViewer
dim myOSD

Dim var1, var2 
var1 = "-cPiso:3758096384"
var2 = "-x63"

 

sub main()
Set myDVBViewer = GetObject(, "DVBViewerServer.DVBViewer")
Set myOSD = myDVBViewer.OSD

myOSD.ExecNewProcess "C:\Program Files (x86)\DVBViewer\DVBViewer.exe", var1, True, False

myOSD.ExecNewProcess "C:\Program Files (x86)\DVBViewer\DVBViewer.exe", var2, True, False
end sub
main

 

But I don't want to use .ExecNewProcess because it's too slow for my purposes.

So is there something that a) just changes channel and b) returns to last one. 

 

Thank you.

 

Edited by dgian
Link to comment
vor 5 Stunden schrieb dgian:

Searching all over the com interface chm, I can't find out what command does what I want.

 

I can't find it either in the DVBViewer code. It seems that channel switching has never been implemented in the COM interface, because it was already covered by command line parameters.

 

Link to comment

Hi there,

 

I use an AutoHotkey script to automatically save teletext pages and EPG from different broadcasters. The script tunes the various stations according to a list and then saves the teletext after a while.

 

AutoHotkey comes with a Macrorecoder that records key presses and mouse actions. This can then be transferred to a macro. The macros can be compiled to exe-files.

You can download the program here: https://autohotkey.com/download/

 

A simpler script to tune different channels to update the EPG is Tune_DVBViewer.ahk:

 

Spoiler

duration :=0
if %0% = 0
{
    MsgBox, , EPG-Update, EPG-Update completed!
    return
}

Traytip, DBViewer EPG-Scan, Read in new station!, 5, 1

;WinWait, DVBViewer,
IfWinNotActive, DVBViewer, , WinActivate, DVBViewer,
WinWaitActive, DVBViewer,
MouseClick, left,  158,  195
Sleep, 100
Send, %1%
if %2%
{
    duration = %2%
    Sleep, duration * 1000
}
else
{
    Sleep, 30000
}
return

 

The call is Tune_DVBViewer [station number according to the station list] [duration in seconds]

 

 

Best regards

 

Webturtle

Link to comment

 

Thank you both, for your answers, as i was absent for a few days I just read them...

 

 

On 9/15/2021 at 7:14 AM, Griga said:

channel switching has never been implemented in the COM interface

 

That's good news for me, at least I'm not crazy not blind... ;)

 

On 9/15/2021 at 7:14 AM, Griga said:

already covered by command line parameters

 

but command line parameters and scripting are two totally different processes...and channel switching, so I thought,

it's one of the most simple, basic commands that should have been implemented from the very beginning...anyway...

 

 

 

Webturtle, thanks for the AutoHotkey script and I'm going to test it as long as there is no other way (simple one...)

to see if it's faster than mine.

 

 

Best regards,

dgian

 

 

 

Link to comment

The COM interface IDVBViewer has a property CurrentChannelNr which tunes the channel.

In the Delphi programming language it could look like

 

    FDVBViewer.CurrentChannelNr := No; // No is the channel number to tune.

 

FDVBViewer is an initialized variabel (interface) of type IDVBViewer.
 

Link to comment

YES! THANK YOU DELPHI !

 

So, with "CurrentChannelNr" you CAN change channel through Com interface. (The change is instantly!)

 

Thank you everyone for your help, and especially Delphi of course.

 

Best regards,

 dgian

 

  • Like 1
Link to comment

And the script for whoever...

 

option explicit

 

Sub MyDelay(NumberOfSeconds)
Dim DateTimeResume
DateTimeResume= DateAdd("s", NumberOfSeconds, Now())
Do Until (Now() > DateTimeResume)
Loop
End Sub

 

sub main()
dim myDVBViewer
dim LastCh
Set myDVBViewer = GetObject(, "DVBViewerServer.DVBViewer")
LastCh = myDVBViewer.CurrentChannelNr
myDVBViewer.CurrentChannelNr = 926
MyDelay(10)
myDVBViewer.CurrentChannelNr = LastCh

end sub
main

  • Thanks 1
Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...