PDA

View Full Version : Are anybody using Avid Utils to select an URL for browsing?



Mastiff
October 12th, 2004, 01:20 AM
I want to do this, but after a look at the setup, I think it would be easier to steal...to implement something that somebody else have done. So does anybody have such a drop-down list with CCF to share with me? The URL buttons takes far too much room on my surf page.

avid
October 12th, 2004, 05:39 AM
Of course there are lots of ways to do this. You will need some LUA. For now, I will assume the set of URLs are fixed.

In LUA OnCcfLoad() assign your URLs to a table.

DropDownUrls = {"http://www.promixis.com", "http://www.bbc.co.uk", "http://brianavid.com"};
Then in the CCF use an action
5001 0000 0000 0002 fc0a 0001 0004 0000
SelectedUrl;LUA:DropDownUrls

This will let you pick from the list and set the NR (not LUA) variable SelectedUrl that you can use (somehow - I don't know myself) in the browser.

Does this help? There are other ways that might be more appropriate in other circumstances.

Brian

Mastiff
October 12th, 2004, 05:42 AM
Thanks, Brian! I'm sure that works. I will look at it later, when I'm through working for today. Just wanted a few pointers so I could do something productive, not just scratch my (short and thin) hair off! :D

Mastiff
October 12th, 2004, 06:13 AM
OK, I have tried it now, but it doesn't work. The drop-down list is empty. I think I have done everything you said. Should there be anything more in that LUA-file? Oh, I know that it's loaded because if I remove the "Function" from the file I get an error message. Or should I have left in more of that LUA file? I tried that as well, but it didn't help, it only complained about missing device - probably a panel jump in your demo, right?

avid
October 12th, 2004, 06:27 AM
Can you confirm the LUA code is being called? A good trick is to set an NR variable in the same block of code (i.e. NetRemote.SetVariable("test", "working") and display {test} in a button or frame.

Warning - I am replying to these posts from memory so might easily get the LUA syntax or function names wrong.

Brian

Mastiff
October 12th, 2004, 06:32 AM
Yes, I see "Working" in that new button.

avid
October 12th, 2004, 07:24 AM
I'm afraid I will be out this evening and so won't be able to look at this. Maybe Marcel can think of something - he has used drop-downs.

Have you looked at the AvidUtils demo CCF and LUA? Get it in the AvidUtils distribution from my web site if you haven't already. Look at the DropDown panel and the variable AvidUtilsSelection3. There are three separate ways of specifying the list. For you I thought the LUA mechanism was the most appropriate. The demo CCF contains an example of all three.

Brian

Mastiff
October 12th, 2004, 07:27 AM
Yes, I have downloaded it, looked at it and scratched my head. I will try to take another look later today, maybe I can find out something by scratching other parts of my anatomy... :oops:

mhwlng
October 12th, 2004, 08:57 AM
I use a drop down to select a different media bridge instance
(the dropdown is on a hidden frame that pops up when you press a button (see my v0.7 ccf file in the usual place)

I also use a similar method to select a playlist to play

Marcel



MYMP.HostName;LIST:MYMP.HostList;GROW:205
5001 0000 0000 0002 fc0a 0001 0005 0000

function OnCCFLoad()
NetRemote.SetVariable( 'MYMP.HostList', '/Living Room/Office/' );
NetRemote.SetVariable( "MYMP.HostName", "Living Room");
end;

function OnVariableChange(varname,varvalue)

if (varname=="MYMP.HostName") then
if (varvalue == "Living Room") then
NetRemote.ExecuteAction(-10,0,16,'',1);
elseif (varvalue == "Office") then
NetRemote.ExecuteAction(-1000,0,16,'',1);
end
end
end;

Mastiff
October 12th, 2004, 11:04 AM
I can't get it working! I tried with ( instead of {, but that didn't help. What's wrong here? This is my full LUA file:


function OnCCFLoad()
DropDownUrls = { 'http://www.promixis.com', 'http://www.vg.no', 'http://mastinuff.now.nu' } ;
end;

My buttons is like this:

First action:
Tag: SelectedUrl;LUA:DropDownUrls
Code: 5001 0000 0000 0002 fc0a 0001 0004 0000


Second action:
Tag: WEB1.URL,SelectedUrl
Code: 5001 0000 0000 0002 fc19 0005 0001 0000

I have tried without the second action, but that didn't make a difference.

avid
October 13th, 2004, 12:06 AM
I've still no idea why it doesn't work, but here's another suggestion:

In the LUA, set the URLs like
NetRemote.SetVariable( 'DropDownUrls_0', 'http://www.promixis.com' );
NetRemote.SetVariable( 'DropDownUrls_1', 'http://www.vg.no' );
NetRemote.SetVariable( 'DropDownUrls_2', 'http://mastinuff.now.nu' );
and change the CCF to
Tag: SelectedUrl;NUMBERED:DropDownUrls
Code: 5001 0000 0000 0002 fc0a 0001 0004 0000
I.e. use NUMBERED instead of LUA to specify the drop-down options.

Brian

Mastiff
October 13th, 2004, 12:18 AM
Shit, I'm an idiot! Sorry for wasting your time. Turned out that there were two errors with that button: It was too small, and it had text the same color as the background! But, on the other had, I like the numbered method a lot better since it makes for a more tidy LUA. Thanks, and sorry again! :oops: :oops: :oops:

avid
October 13th, 2004, 12:21 AM
Great - glad it works for you.

Brian

Mastiff
October 13th, 2004, 12:28 AM
Great that I'm finally and once for all "outed" as an idiot? :wink:

Anyway, it works now with a second button to go to the URL, but I will try to implement Marce's code to make it jump directly. Should be possible with the on variable change setting, I think. But I need to find out the synthax for parsing URLs from LUA.

Mastiff
October 13th, 2004, 12:45 AM
Still scratching my anatomy... This doesn't work:



function OnCCFLoad()
NetRemote.SetVariable( 'DropDownUrls_0', 'http://www.promixis.com' );
NetRemote.SetVariable( 'DropDownUrls_1', 'http://www.vg.no' );
NetRemote.SetVariable( 'DropDownUrls_2', 'http://mastinuff.now.nu' );
end;

function OnVariableChange(varname,varvalue)

if (varname=="DropDownUrls_0") then
if (varvalue == "http://www.promixis.com") then
NetRemote.ExecuteAction(-2,"http://www.promixis.com", ,'WEB1.URL,SelectedUrl',1);
end
end
end;

I get an error when I open NetRemote: "Syntax Error - Unexpected Symbol near `,'" and this is in the line with ExecuteAction. Any ideas?

avid
October 13th, 2004, 12:55 AM
Tor,

Two problems I can see:
1) You heve a double ',' in the ExecuteAction line. That is the syntax error.
2) The "if (varname=="DropDownUrls_0") then" should be "if (varname=="SelectedUrl") then". SelectedUrl is the one that changes.

Brian

Mastiff
October 13th, 2004, 01:01 AM
Thanks, that took care of the syntax error. But it still doesen't open the URL. The reason I had , , was that I thought you had to have an empty space if one payload wasn't used. So now we're down to this:


function OnVariableChange(varname,varvalue)

if (varname=="SelectedUrl") then
if (varvalue == "http://www.promixis.com") then
NetRemote.ExecuteAction(-2,"http://www.promixis.com",'WEB1.URL,SelectedUrl');

end

This should be possible, I'm sure.

I even think something like this could be possible:

function OnVariableChange(varname,varvalue)

if (varname=="SelectedUrl") then
NetRemote.ExecuteAction(-2,SelectedUrl,'WEB1.URL,SelectedUrl');
end


Right?

avid
October 13th, 2004, 01:24 AM
Tor,

Surely ExecuteAction takes 4 parameters - 3 numbers (driver, param1, param2) and the IR name string. I don't know what the parameter numbers should be for the browser driver, but someone here should be able to tell you.

Brian

Mastiff
October 13th, 2004, 01:26 AM
Right. I'll post that as a separate thread. Thanks again!

Jlee
October 13th, 2004, 01:33 AM
Ben explained this quite well in this thread:

http://www.promixis.com/phpBB2/viewtopic.php?t=8682&postdays=0&postorder=asc&start=0

Mastiff
October 13th, 2004, 01:36 AM
Well, that explains it for the MediaBridge, but it doesn't say anything about the correct numbers for the browser driver as far as I can see.

Jlee
October 13th, 2004, 01:39 AM
I think the action to launch an URL would therefore be as follows:

NetRemote.ExecuteAction(-2,0,32,"http://www.promixis.com",1);


The bit I'm not sure about is the call number (1) at the end.

Mastiff
October 13th, 2004, 01:41 AM
It doesn't do anything, I'm afraid. Maybe because of that call number? I was about to post that I found the 0,32 from the page the thread you mentioned linked to, but it still won't do anything.

Jlee
October 13th, 2004, 01:43 AM
Must be close now though. Try it without the call number i.e.
NetRemote.ExecuteAction(-2,0,32,"http://www.promixis.com");

Mastiff
October 13th, 2004, 01:45 AM
Nope. And call number 0 and 2 doesn't work either. There has to be a tiny thing there that's not correct. Annoying! :(

Jlee
October 13th, 2004, 01:50 AM
I think the call number should be 1 so maybe something else is wrong in your code. Avid?

mhwlng
October 13th, 2004, 01:53 AM
create a button

button name WEB6

IR action
name dummy
data 5001 0000 0000 0002 fffe 0000 0000 0000


to set the url use an ir action of
WEB6.URL,http://192.168.1.100:8082/800/imdb.htm
5001 0000 0000 0002 fc19 0005 0001 0000


so from lua :
NetRemote.SetVariable( 'WEB6.URL', NetRemote.GetVariable('SelectedUrl') );


NO ExecuteAction needed

Marcel

avid
October 13th, 2004, 01:55 AM
Have you tried it with a hard-wired URL like the code sample Jlee suggests?
NetRemote.ExecuteAction(-2,0,32,"http://www.promixis.com",1);
Have you tried displaying "{SelectedUrl}" in a button/frame as a check?

Brian

mhwlng
October 13th, 2004, 01:57 AM
oops,

I think that should be

NetRemote.SetVariable( 'WEB6.URL', NetRemote.GetVariable('SelectedUrl') );

Marcel

Mastiff
October 13th, 2004, 02:18 AM
Avid, yes I have tried both using the hard URL and showing the selected URL.

Marcel, thanks! That worked. I need to remove my current browser window, right? That's named WEB1. I get the page I select in the new WEB6 instead of WEB1. Or I can change the name to WEB1 in LUA and move the action there, I suppose. But it doesn't show the normal home page in this way. Should I use that with onpanelload? I tried this code:


function OnPanelLoad()
local pn = NetRemote.GetVariable("NR.PanelName");
local dn = NetRemote.GetVariable("NR.DeviceName");

if (pn=="surf") then
NetRemote.SetVariable( 'WEB6.URL', 'http://www.promixis.com' );
end;

When that's sorted I'm in business! :D

mhwlng
October 13th, 2004, 02:28 AM
just make sure that the web browser button names are unique in your entire ccf file (for normal buttons this doesn't matter)

you can't have two WEB1 or WEB6 buttons....

Marcel

Mastiff
October 13th, 2004, 02:39 AM
Yes, thanks. But I forgot to say that the code:
function OnPanelLoad()
local pn = NetRemote.GetVariable("NR.PanelName");
local dn = NetRemote.GetVariable("NR.DeviceName");

if (pn=="surf") then
NetRemote.SetVariable( 'WEB6.URL', 'http://www.promixis.com' );
end;

doesn't work. Any ideas why? It doesn't show anything in the testboxes I made with {WEB6.URL} and {Selected.Url} either. But there is a quick flash of http://www.promixis.com when the panel first loads. Is something else nulling out that variable?

mhwlng
October 13th, 2004, 02:43 AM
your onvariablechanged is called as well,

the dropdown doesn't have any selection, so it makes web6.url empty

don't set web6.url in your onpanelload

set the dropdown to your default value instead

that causes onvariablechanged to be called and subsequently causes web6.url to be set

Mastiff
October 13th, 2004, 02:55 AM
You mean like this:

function OnPanelLoad()
local pn = NetRemote.GetVariable("NR.PanelName");
if (pn=="surf") then
NetRemote.SetVariable( 'SelectedUrl', 'http://www.promixis.com' );
end;
end;


That doesn't work either. I'm doing something wrong as usual...

Neither does this:

function OnPanelLoad()
local pn = NetRemote.GetVariable("NR.PanelName");
if (pn=="surf") then
NetRemote.SetVariable( 'DropDownUrls_0', 'http://www.promixis.com' );
end;
end;

Oh well, at least I'm trying...but I end up crying for help anyway. :oops:

mhwlng
October 13th, 2004, 03:02 AM
the first one should work...

add message boxes to various places in your lua code to see if everything is really executed as expected...

NetRemote.MessageBox('xxxx');

also run dbgview to see if there are any lua errors...

Marcel

Mastiff
October 13th, 2004, 03:15 AM
I get a message box saying "Error: XXXX" when putting it in the Onpanelload. When putting it on the OnVariableChange I can't even get into NetRemote because I only get that box, I click it away and get a new box.

Here's my full LUA file as of now (I have changed to WEB1 instead of 6):

function OnCCFLoad()
NetRemote.SetVariable( 'DropDownUrls_0', 'http://www.promixis.com' );
NetRemote.SetVariable( 'DropDownUrls_1', 'http://www.vg.no' );
NetRemote.SetVariable( 'DropDownUrls_2', 'http://mastinuff.now.nu' );
end;

function OnVariableChange(varname,varvalue)
NetRemote.SetVariable( 'WEB1.URL', NetRemote.GetVariable('SelectedUrl') );
end;

function OnPanelLoad()
local pn = NetRemote.GetVariable("NR.PanelName");
if (pn=="surf") then
NetRemote.SetVariable( 'SelectedUrl', "http://www.promixis.com" );
else
end;
end;

Another thing is that with this if I write an url in the box with IR-Name WEB1.URL and then hit enter, I get back to the one in the drop-down. I guess I should change that write box to a box that sets the variable SelectedURL to whatever I write in that box, right?

mhwlng
October 13th, 2004, 03:18 AM
your onvariablechanged is wrong,

check

if (varname=='SelectedUrl') then
...
..

OnVariableChanged is called twice a second by Avid.FlashState

Marcel

mhwlng
October 13th, 2004, 03:20 AM
...variable SelectedURL to whatever I write in that box, right?

no, you can only set SelectedURL to one of the items in the drop down...

make the above fix to onvariablechanged, it'll work
Marcel

Mastiff
October 13th, 2004, 03:30 AM
Yes, yes, yes! Finally! Now everything works! :D Of course I had to change from IR name Dummy to the home page IR name on the first action in the browser window because the first start showed dummy as the URL, but then it was all smooth sailing! The onpanelload doesn't work, but that doesn't bother me since I can set it this way. Thanks, guys!

Mastiff
October 13th, 2004, 05:10 AM
Of course, not being the one to let sleeping dogs lie, or maybe fixing things that ain't broken: Is it possible to decide what the list shows, without affecting that it does? So I can see "VG" in the list, but the URL will still be "www.vg.no"? I tried with this:

NetRemote.SetVariable( 'DropDownUrls_0', 'http://www.agderposten.no', 'Agderposten' );

But my guess is that this isn't defined in the plug-in. Am I right?

mhwlng
October 13th, 2004, 05:12 AM
just put the display texts in the drop down (not the url's)

in onvariablechange, check what display value is selected, and set the related url....

see my example earlier in this thread :roll:

Marcel

avid
October 13th, 2004, 05:17 AM
I sometimes use LUA tables for this purpose - to map between what I want to display ("Agderposten") and what I want to use ("http://www.agderposten.no").

Brian

Mastiff
October 13th, 2004, 06:11 AM
Marcel, Oh, yes, of course. Like this:


function OnCCFLoad()
NetRemote.SetVariable( 'DropDownUrls_0', 'Agderposten' );

function OnVariableChange(varname,varvalue)
if (varname=='SelectedUrl') then
NetRemote.SetVariable( 'WEB1.URL', 'http://www.agderposten.no' );
end;


That does it. I have to type twice for each URL, though. On the other hand, maybe this could work for a table:



SelectedUrl'= {}
SelectedUrl'["Agderposten"] = "http://www.agderposten.no"
SelectedUrl'["VG"] = "http://www.vg.no"


Or should it be WEB1.URL in there? I can't get that working either way, but should there be a heading, like a function name?

mhwlng
October 13th, 2004, 06:18 AM
you need to check varvalue as well in onvariablechanged to know what URL to select...
Marcel

avid
October 13th, 2004, 06:32 AM
OnVariableChanged should then be:
NetRemote.SetVariable( 'WEB1.URL', SelectedUrl'[NetRemote.GetVariable('SelectedURL')] ); Brian

Mastiff
October 13th, 2004, 06:43 AM
You mean like this?

function OnCCFLoad()
SelectedUrl= {}
SelectedUrl["Agderposten"] = "http://www.agderposten.no"
SelectedUrl["VG"] = "http://www.vg.no"

NetRemote.SetVariable( 'DropDownUrls_0', 'Tv-programmet' );
NetRemote.SetVariable( 'DropDownUrls_1', 'mastinuff' );
NetRemote.SetVariable( 'DropDownUrls_2', 'http://met.no/aust-agder/index.html?fylkesvis' );
NetRemote.SetVariable( 'DropDownUrls_3', 'Agderposten' );
NetRemote.SetVariable( 'DropDownUrls_4', 'http://www.dmi.dk/dmi/verdensvejr.htm?city=110047035&country=Norge' );
NetRemote.SetVariable( 'DropDownUrls_5', 'http://www.imdb.com' );
NetRemote.SetVariable( 'DropDownUrls_6', 'http://www.promixis.com/phpBB2/' );
NetRemote.SetVariable( 'DropDownUrls_7', 'http://www.telefonkatalogen.no' );
NetRemote.SetVariable( 'DropDownUrls_8', 'http://www.vg.no' );
NetRemote.SetVariable( 'DropDownUrls_9', 'http://yabb.jriver.com/interact/index.php?board=3' );
end;

function OnVariableChange(varname,varvalue)
if (varname=='SelectedUrl') then
NetRemote.SetVariable( 'WEB1.URL', (SelectedUrl)[NetRemote.GetVariable('SelectedURL') ] );
end;
end;


That gives me nothing. And it doesn't seem like the translation from showable name to real name happens. My brain is starting to hurt. I feel like the guys in the Monty Python skit: "We're going to operate!" "Yeah!"

avid
October 13th, 2004, 06:55 AM
I was thinking along the lines:

function OnCCFLoad()
SelectedUrl= {}
SelectedUrl["BBC"] = "http://www.bbc.co.uk"
SelectedUrl["Promixis"] = "http://www.promixis.com"
SelectedUrl["Avid"] = "http://www.brianavid.com"

NetRemote.SetVariable( 'DropDownUrls_0', 'BBC');
NetRemote.SetVariable( 'DropDownUrls_1', Promixis);
NetRemote.SetVariable( 'DropDownUrls_2', 'Avid');
end;

function OnVariableChange(varname,varvalue)
if (varname=='SelectedUrl') then
NetRemote.SetVariable( 'WEB1.URL', SelectedUrl[NetRemote.GetVariable('SelectedURL')] );
end;
end;

Mastiff
October 13th, 2004, 07:03 AM
Now you're really on to something! Bingo! :D Two small errors, though, if anbody else wants to use that code, here's the correct version:


function OnCCFLoad()
SelectedUrl= {}
SelectedUrl["BBC"] = "http://www.bbc.co.uk"
SelectedUrl["Promixis"] = "http://www.promixis.com"
SelectedUrl["Avid"] = "http://www.brianavid.com"

NetRemote.SetVariable( 'DropDownUrls_0', 'BBC');
NetRemote.SetVariable( 'DropDownUrls_1', 'Promixis');
NetRemote.SetVariable( 'DropDownUrls_2', 'Avid');
end;

function OnVariableChange(varname,varvalue)
if (varname=='SelectedUrl') then
NetRemote.SetVariable( 'WEB1.URL', SelectedUrl[NetRemote.GetVariable('SelectedUrl')] );
end;
end;

The difference is that it was URL with capitals in the last part of SetVariable and no ' around 'Promixis' in the DropDown. But you did that to test me, right?

Thank you, thank you, thank you! I have my browser done! :D :D

avid
October 13th, 2004, 07:11 AM
Moving on ... (dare I suggest it?) ...

... it would be neater to avoid duplicating the text of the drop-down text. You would do this by replacing the SetVariable calls for 'DropDownUrls_NN with a "for loop" using the "ipairs" function. I can't work out the details just now, but I am sure it would be possible.

Brian

Mastiff
October 13th, 2004, 07:15 AM
Huh? Come again... That one I'm not sure if I got. But if you mean that if I use Google in the drop-down it should add www. and .com, that's no good. I usually don't name my shortcuts the same thing as the URL, that was just for an example. For instance, this is "Proximis-forumet". And mastinuff.now.nu is "Kennelsiden".

avid
October 13th, 2004, 07:22 AM
No the point is that there is only *one* place in the code that lists the displayed names and URLs.

The second block which sets the all the DropDownUrls_NN values should be replaced by a loop which gets the names out of the SelectedUrl table using the LUA "ipairs" mechanism. But I'm not in a position to code it up just at the moment (which is why the typos before). It's more complicted LUA than you have at the moment, but will be easier to change correctly in the future.

Brian

Mastiff
October 13th, 2004, 07:26 AM
Aha. I understand. I think... If you ever get the time I'd appreciate it. In the mean time I'm using Excel to sort and create the URL list for this version - filling down drop down values from 0 and up, sorting by shown name, not URL name and creating the right values. That works very well.

avid
October 13th, 2004, 08:12 AM
I *might* have time for this, but the rest of this week is a bit rushed getting ready for my trip (both at home and work).

You don't *need* the change at all. But maybe one of the LUA experts on the forum could give you the 5 or 6 lines you want?

Brian

Mastiff
October 13th, 2004, 08:15 AM
I think I have bugged and nagged too much lately...I'll just lay low for a while! :wink: Have a nice trip, though! :D

avid
October 13th, 2004, 08:21 AM
Have a nice trip, though!
I shall try :lol: :lol:

Mastiff
October 13th, 2004, 08:24 AM
Woops, that didn't sound to hopeful... Do you mean that you'll be compelled to log on and spoil it with having to answer questions, or is it (shock - horror) the dreaded "It's time we visit my parents, honey"-trip? :o A trip I havent taken in eight years... :wink:

avid
October 13th, 2004, 09:37 AM
No - this is going to be a proper break. Probably (?) no internet for 3 weeks. Travelling round the forts and palaces of Rajasthan. Hence the :lol: :lol:

Brian

Mastiff
October 13th, 2004, 09:39 AM
Goodness me! That one I had to Google... India, huh? Takes me back to both "Octopussy" (look out for big men with a saw blade!) and "Indiana Jones" (and don't go stealing any secret stones either!). Well, it was the Jewel in the Crown. :wink: