New Plugin: XConvertToVariable

Xlobby plugin development

New Plugin: XConvertToVariable

Postby m_ski on Tue Aug 23, 2005 11:50 am

I have written a very simple plugin which implements the ConvertVariables command that Steven recently added to xlobby.

The plugin 'XConvertToVariable' has only one command 'Convert' which takes two parameters - the xlobby text variable and the new variable name you wish to save this data to.
The reason for this plugin is to make any xlobby variable globally visible, so that it can be used in any other event or external command.

For example:
1) create a new event
2) Add a plugin command for XConvertToVariable plugin, command = Convert
3) Type in the parameter field

Code: Select all
epg>time,epgtime


This would convert the 'epg>time' variable which is not globally visible to a new variable which can be referred to by %variable>epgtime% in many other events.

Download from...
http://mysite.wanadoo-members.co.uk/mski/XConvertToVariable.zip

I have included the VB.NET source code and a compile batch file for anyone that wants to see the basics of a VB.NET plugin.
(You DO NOT need Visual Studio to compile it)

In order to use 'compile.bat' ...
1) put a copy of XpluginSDK.dll in the same directory as the vb source code
2) Install the .net 1.1 SDK from Microsoft
3) add a path to the .net sdk directory in 'My Computer > properties > Advanced > Environment variables > System variables > path'. This is so that you can just put 'vbc' in the batch file rather than the full path to the .net 1.1 sdk directory (although you could do that if you like).
4) Run 'compile.bat' which will also copy the newly created dll to the xlobby directory (you may have to change the directory name)
5) Run xlobby and you have just made a xlobby plugin.

I actually used a beta version of Visual Studio 2005 (free to download at the moment) to write the plugin and then compiled it using the above method. Seemed to work pretty well and did not cost anything.
m_ski
 
Posts: 204
Joined: Wed Dec 08, 2004 7:57 am
Location: Kent, United Kingdom

Postby gronyko on Tue Aug 23, 2005 1:36 pm

I just test for the audioplayer variable : not working.

"the "start" argument must be over 0" ...
and for the plugin xmpc plugin>xmpc>pos, pos
same problem...

perhaps it's me ....
gronyko
 
Posts: 13
Joined: Wed Jul 20, 2005 7:47 pm

Postby art on Tue Aug 23, 2005 1:44 pm

I see you found a way around .NET 2 problem :D , pretty cool!
art
 
Posts: 284
Joined: Sat Mar 20, 2004 8:40 am
Location: Allen, TX

Postby m_ski on Tue Aug 23, 2005 3:02 pm

Are you just doing a 'Test' on the right hand pane of the event window? I found this error sometimes as well.
If this is what you are doing then try creating the full event and doing 'Test' from the left hand side.

My plugin has no error-checking in it at the moment so if anything is not quite perfect it will generate some kind of an error like this. I think the error that you have is something to do with the parameter field not being filled properly - make sure there are no spaces in it.
m_ski
 
Posts: 204
Joined: Wed Dec 08, 2004 7:57 am
Location: Kent, United Kingdom

Postby gronyko on Tue Aug 23, 2005 3:27 pm

ok the test was wrong but it seems ok with the events
but not for the other variable from plugins ...

does it work for you ?
gronyko
 
Posts: 13
Joined: Wed Jul 20, 2005 7:47 pm

Postby m_ski on Tue Aug 23, 2005 10:48 pm

I just tested it with the xweather plugin passing the following to the XConvertToVariable plugin...

Code: Select all
plugin>xweather>current> %city%,textinput


and it seems to work correctly. Are you sure you have it typed in correctly?

I have also tried to do this for the current music genre using...

Code: Select all
audioplayer>now> %genre%,textinput


It creates the new variable OK but it appears that this variable cannot be used in the custom search field either so the original request still stands I'm afraid.
m_ski
 
Posts: 204
Joined: Wed Dec 08, 2004 7:57 am
Location: Kent, United Kingdom

Postby gronyko on Wed Aug 24, 2005 8:01 am

it work for me with the "audioplayer" and xoapweather plugins
unfortunatly it don't work with the great xmpc plugin.
perhaps it's because the syntax is different ( ?)
plugin>XMpc>pos ,position
here there's no "%"

any idea.
gronyko
 
Posts: 13
Joined: Wed Jul 20, 2005 7:47 pm

Postby m_ski on Wed Aug 24, 2005 11:19 am

Try it without the space after 'pos'.

I don't use mpc so can't test it for you I'm afraid.
m_ski
 
Posts: 204
Joined: Wed Dec 08, 2004 7:57 am
Location: Kent, United Kingdom

Postby gronyko on Wed Aug 24, 2005 11:53 am

ok thanks for all your answer ( and your plugin !!) :D
but it still don't work with xmpc ....

let's hope that one day we could use the two.
I will see if I can do something for that... but i am a just a beginner in programmning in C...
gronyko
 
Posts: 13
Joined: Wed Jul 20, 2005 7:47 pm