Jump to content

Go to last channel viewed ?


gibman

Recommended Posts

Hi there!

 

I'm using UIce rem. ctrl software to control DVBViewer.

 

1) How do I change to a specific channel with COM?

2) How do I change to the last active channel just before DVBViewer was closed last time with COM?

 

The problem is that I start the DVBViewer in UICE not by executing DVBViewer.exe but instead by instantiating a COM reference in javascript in Uice.

 

ex.

 

var oDVBViewer = uICE.CreateObject("DVBViewerServer.DVBViewer")

 

This starts DVBViewer fine, but no channel is tuned in. I have to manually tune in.

If I start DVBViewer by the usual way .. DVBViewer.exe then all is ok.

 

Ofcourse I could just tell Uice to call DVBViewer.exe as I would do normally.

But once I instantiate the COM object, then one more instans of DVBViewer is launched. Then I have 2 DVBViewer apps running.

 

See my dilemma ?

 

/Elo

Edited by gibman
Link to comment

You should be able to connect to a running instance of DVBViewer with something similar to GetActiveObject in python.

 

The last channel used can be found in setup.xml file. You can use COM to fetch the value with oDVBViewer.GetSetupValue("General","LastSender","")

 

Someone else can tell you how to tune a channel with COM, I don't know yet.

Link to comment

Thanks for the reply.

 

Yes, oDVBViewer.GetSetupValue("General","LastSender","") gets me the last current channel in a string.

ex. "3916|C MORE HD (AC3)"

 

But then again, I see no means of how to change channel within the scope of the COM interface.

 

anyone ?

 

/Elo

Link to comment

Try...

 

Set objDVBViewer = GetObject(,"DVBViewerServer.DVBViewer")

 

objDVBViewer.TimerManager.AddItem Channel, Date, Start_Time, End_Time, Description, DisableAV, SetActive, Action, At_End, Repeat

 

Channel = number | name

Date = dd-mm-ccyy (diferent delimiter for your locale)

Start_Time = hh:mm (diferent delimiter for your locale)

End_Time = hh:mm (diferent delimiter for your locale)

Description = free format string

DisableAV = 0 or 1 (false or true)

SetActive = 0 or 1 (false or true)

Action = 0, 1, 2 or 3

0 Record, 1 Change channel, 2 AudioPlugin, 3 Videoplugin

At_End = 0, 1, 2, 3, 4, 5 or 6

0 None, 1 PowerOff, 2 Standby, 3 Hibernate, 4 Close, 5 Playlist, 6 Slumbermode

Repeat = -,T (7 bytes one for each day of the week)

 

So in your case

 

objDVBViewer.TimerManager.AddItem Channel, Date, Start_Time, End_Time, "Change The Channel", 0, 1, 1, 0, "-------"

Link to comment

Thanx mrr19121970.

You pointed me in the right direction.

 

I guess using the TimerManager is a bit of a hack, just to be able to tune in a channel with COM.

 

If others are interested here is what I did - javascript.

 

objDVBViewer = CreateObject("DVBViewerServer.DVBViewer")

var oLastCh = objDVBViewer.GetSetupValue("General","LastSender","");

var oNow = new Date();

 

var sMonth = (oNow.getMonth() + 1).toString();

if (sMonth.length == 1) sMonth = "0" + sMonth;

var sDateNow = oNow.getDate() + "-" + sMonth + "-" + oNow.getFullYear();

var sTimeNow = oNow.getHours() + ":" + oNow.getMinutes();

 

if (oLastCh.length > 0)

{

objDVBViewer .TimerManager.AddItem (oLastCh, sDateNow, sTimeNow , sTimeNow , "Change The Channel", 0, 1, 1, 0, "-------");

}

 

/Elo

Link to comment

You can also be a smartypants and after your TimerManager.AddItem:

 

objDVBViewer.Osd.ShowInfoInTVPic "I just Changed The Channel",10000

 

Another way to start up on the last channel is:

 

Const DVBViewerPath = """C:\Program Files\DVBViewer\DVBViewer.exe"""

Dim intStatus

 

Dim WScriptShell

Set WScriptShell = WScript.CreateObject("WScript.Shell")

 

Dim objDVBViewer

Set objDVBViewer = GetObject(, "DVBViewerServer.DVBViewer")

 

If Err AND (Err.Number = 424) OR (Err.Number = 429) Then

Err.Clear

intStatus = WScriptShell.Run(DVBViewerPath,2,False)

If Err Then

MsgBox "Problems Starting " + DVBViewerPath

Wscript.Quit(16)

End If

WScript.Sleep(5000)

Set objDVBViewer = GetObject(, "DVBViewerServer.DVBViewer")

If Err Then

MsgBox "Unable To Find Running DVBViewer"

Wscript.Quit(16)

End If

End If

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...