PDA

View Full Version : changing button for on/off



cdebuhr
November 5th, 2004, 12:12 PM
hi,

another newbie question:

iīd like to a button which should be red when there is no girder connection and green when there is one. also one for a zp connection and a jrmc connection.

does anyone have a sample ccf where this shown? or can anyone descrive how i can "program" these funkrions?

tia
chris

danward79
November 5th, 2004, 12:25 PM
Hi,

Look at the JRMC one first, it is an easy one to try out.

Set you icons to what you want (red and green).

Set the id to "STATE:MP.LinkActive"

If you do not want the button to do anything, add a deley, of 0ms or it will not show up.

danward79
November 5th, 2004, 12:30 PM
Try this one...

danward79
November 6th, 2004, 08:49 AM
Chris How did you go with this?

cdebuhr
November 6th, 2004, 09:07 AM
hi,

works perfect. ;-) thx a lot.

i am right now working on zp.
i can get zp.playstatenum, but that will state off even when zp is running (only started - not playing etc.).

is someting like "STATE:ZP.PlayState:Not running" possible?

tia
chris

danward79
November 6th, 2004, 09:17 AM
Hi,

Check out my post here, I needed something similar

http://www.promixis.com/phpBB2/viewtopic.php?t=9493

cdebuhr
November 6th, 2004, 09:59 AM
yes dan, that would do it.

but by pasting your code into a new script, i get an error:

error: attempt to call global `FindProcess' (a nil value)

whoops. where do i get that findprocess from?

danward79
November 6th, 2004, 10:05 AM
You are missing a plugin I think, Assuming you pasted exactly with no mistakes.

Do you have Lua Windows Functions Plugin installed?

if not download it. When you run the script, the result should be 0 if zp is not loaded 1 if it is. the result is sent to nr. as this variable


ZP.LinkActive

so you need to set up your button as


STATE:ZP.LinkActive

cdebuhr
November 6th, 2004, 10:41 AM
yepp. i installed the plugin.

everything works. super!

but if i close zp - girder doesnīt send the info. only if i press f5 in girder it works.

is there an automatism for sending changes?

danward79
November 6th, 2004, 10:42 AM
Good,

You need to set a timer up to run the script every x seconds.

Use the timeserver plugin, or lua

cdebuhr
November 6th, 2004, 11:32 AM
yaaahooooo! ;-)

works great. thx again, dan.

but btw.... ;-)

i use jleeīs excellent ccf/gml/lua as my "playground".
do you know, how i can rid of thse myterious 2 icons -> lower left (grider connection) an lower right (battery status)? i canīt find them in tonto.

and last but not least: the battery icon isnīt always loaded. i can see the percentage, but no icon. do you have and share a working battery-part? or do you know about this problem?

tia
chris

danward79
November 6th, 2004, 11:50 AM
To get access to the two icons you talk about.

In Tonto goto System, and then master template. They are on that "page" You may not see them thou because they are invisable!!

I think you may find the battery icon only shows in certain states, I have not looked at JLee's ccf for a while. I just had a look in tonto, I think it does not show icons for fully charged.

The reason these only show when there is a problem or low charge is to minimise clutter, and pointless info.

Does that answer you question?

Jlee
November 6th, 2004, 01:11 PM
Absolutely right Dan.

danward79
November 6th, 2004, 01:15 PM
Why Thank you.

:)

cdebuhr
November 6th, 2004, 01:53 PM
hi dan, hi jlee,

the battery icon in the lower right only shows up, when battery is low. thatīs fine.

the one i am talking about is the "main"/big battery image on the "homepage".
sometimes it shows up - sometimes not. thatīs certainly not intended.
the percentage is always shown.

thx
chris

ps: i am totally amazed to get such a great and fast support & help. thx guys!

danward79
November 6th, 2004, 02:16 PM
Hi Chris,

Fast support till we go to sleep!

Anyway....

What conditions does the battery image show in? low, 10% , 99%?

Check all the images are there in the NR Folder,

Are you running on a ppc? I think that may be the answer.... Marcel's driver for the battery icons only works on win32.

cdebuhr
November 6th, 2004, 02:35 PM
yes, i have a ppc.

well does jlee use his ccf on win32? hmm...

so no correct battery image for me? :-(

danward79
November 6th, 2004, 02:45 PM
Hi,

I think that is the problem, unless I am being stupid!

You could make a work around using Lee's nice buttons he made, and the state command.

the command is

Power.ChargeStatus

the states are


1 High
2 Low
4 Critical
8 Charging
128 No Battery
255 Unknown

You would need to make a frame for each state, the frame must hold the button for that state.

You must then put them on top of each other.

Good Luck!!!!!

Jlee
November 6th, 2004, 03:47 PM
I use my ccf on PPC. I just uploaded v2.6 to my website that fixes this. It was because the icons for weather and battery were being parsed in the OnCCFLoad section of the Lua file and NR cannot always handle all this at load time. I moved this to OnVariableChange and got girder to instigate a variable change after NR startup. This works much more efficiently.

If you don't want to use all of the new CCF because you already modified yours you could just use the new lua file and you'll also need the event in the gml at "NetRemote\Startup Events\NR StartUp".

danward79
November 6th, 2004, 03:52 PM
Umm, I do the same, it does not cause a problem for me?

I don't understand why that would cause it to fail.

Jlee
November 6th, 2004, 03:54 PM
http://www.promixis.com/phpBB2/viewtopic.php?t=8569&postdays=0&postorder=asc&start=15

danward79
November 6th, 2004, 04:04 PM
I remember now thanks!

cdebuhr
November 6th, 2004, 05:46 PM
del

cdebuhr
November 6th, 2004, 05:52 PM
I use my ccf on PPC. I just uploaded v2.6 to my website that fixes this.

did you change anything else? especially within the mc part?

cdebuhr
November 6th, 2004, 07:11 PM
totally disappointed. :-(

still no battery image. one time it was there, now itīs gone again. hmpf.

now i canīt open the mc pages anymore.

and still no mobo values in the pc health page.

thatīs no fun.

danward79
November 7th, 2004, 12:41 AM
Have you got mother board monitor installed and the girder plugin?

danward79
November 7th, 2004, 01:32 AM
Also Check that MBM is working by it's self.

Jlee
November 7th, 2004, 01:34 AM
Motherboard Monitor does take some setting up and it certainly won't 'plug and play' from my ccf. We'll worry about that later once we've sorted out your battery images. First of all please simply try my v2.6 ccf, gml and lua straight out of the box and confirm whether it's working.

Also try making a couple of changes in the gml as follows. First open the script for the Girder Start up event, replace it with this code and hit apply:

--Get details of last playlist selected by NR so it can be used with the repeat playlist button
r1,LastGAC = RegGetStringValue("HKEY_LOCAL_MACHINE", "Software\\Girder3\\", "LastGAC")
if r1 ~= 0 then -- key does not exist
print ("Error getting int value")
end
r2,LastPlayMode = RegGetStringValue("HKEY_LOCAL_MACHINE", "Software\\Girder3\\", "LastPlayMode")
if r1 ~= 0 then -- key does not exist
print ("Error getting int value")
end

Next do the same with the NR Startup event:
NetRemote.SendLabel("Connected",1) --Removes red 'unconnected' icon from ccf panels
NetRemote.SendLabel("NR.CCFLoadActions",1)

--Dan's weather code follows
TriggerEvent("Weather.SetDay", 203)
TriggerEvent("Weather.Current", 203)
TriggerEvent("Weather.Forecast", 203)

NetRemote.SendLabel("LastGAC",LastGAC) --Sets variable for last playlist that was selected in NR for use with repeat playlist button
NetRemote.SendLabel("LastPlayMode",LastPlayMode) --Sets variable for last play mode that was selected in NR for use with repeat playlist button

That has removed some of the motherboard monitor stuff which may have been causing the script to fail because MBM was not there. We can put it back later. Finally, once you can get to the MC pages go to the playlists tab and select something to play. This will create values for LastGAC and LastPlayMode in Girder. Now try opening and closing NR and all should be well.

cdebuhr
November 7th, 2004, 02:42 AM
Have you got mother board monitor installed and the girder plugin?

;-)
sure. since i get cpu & hdd temp plus 3 fans, all the voltage, but no mobo temp.
is it correct, that cpu temp and mobo temp have the "format"? ("%2.0f", pld1)

danward79
November 7th, 2004, 02:47 AM
You could just have a look in the girder script and try this. It will prove that the payload is getting there and what format it is in.


--CPU temp monitor
CPUTemp = pld1
print ("Unformatted ",CPUTemp)
CPUTemp = format("%2.0f", CPUTemp)
print ("Formatted ",CPUTemp)
CPUTemp = tonumber(CPUTemp)
NetRemote.SendLabel('CPUTemp',CPUTemp)
if CPUTemp > CPUHot then
NetRemote.SendLabel('CPUOverheat',2) --CPU too hot
NetRemote.SendLabel('SystemWarning',1) --Warning icon on every NR page
elseif CPUTemp > CPUWarm then
NetRemote.SendLabel('CPUOverheat',1) --CPU quite warm
else
NetRemote.SendLabel('CPUOverheat',0) --CPU nice and cool
end

I don't use MBM so am not the best person to ask.

Jlee
November 7th, 2004, 02:49 AM
Yes that's correct. Have you checked your sensor name like I said?

Also, I accidentally put my weather.com license details in the zip with v2.6. Please delete it and don't use it. Thanks.

cdebuhr
November 7th, 2004, 03:49 AM
First of all please simply try my v2.6 ccf, gml and lua straight out of the box and confirm whether it's working.

still only the percentage, but no image.

cdebuhr
November 7th, 2004, 03:55 AM
Finally, once you can get to the MC pages go to the playlists tab and select something to play. This will create values for LastGAC and LastPlayMode in Girder. Now try opening and closing NR and all should be well.

i canīt open the mc pages anymore. :-(

i click on the mc tap - but nothing happens.

cdebuhr
November 7th, 2004, 04:00 AM
Have you checked your sensor name like I said?

yes. the mbm-event (ir-codes) are correct. do i have to change any namens in the script?
i get quite a lot parse errors because of NILs. is that common?



Also, I accidentally put my weather.com license details in the zip with v2.6. Please delete it and don't use it. Thanks.
sure, np.

Jlee
November 7th, 2004, 06:20 AM
First of all please simply try my v2.6 ccf, gml and lua straight out of the box and confirm whether it's working.

still only the percentage, but no image.

Have you pit the Power icons folder in the My Documents folder on your PPC?



Finally, once you can get to the MC pages go to the playlists tab and select something to play. This will create values for LastGAC and LastPlayMode in Girder. Now try opening and closing NR and all should be well.

i canīt open the mc pages anymore. :-(

i click on the mc tap - but nothing happens.
That's very strange if it's out of the box. Check the MC tab on the Macros panel in Tonto. Make sure it includes a Jump to MC Main.



Have you checked your sensor name like I said?

yes. the mbm-event (ir-codes) are correct. do i have to change any namens in the script?
i get quite a lot parse errors because of NILs. is that common?


I'm not talking about IR Codes. I'm referring to the sensor names in MBM. You need to confirm that MBM is getting your mobo temperature and check what the name of the sensor is. Then you need to apply a MBM girder event to the Mobo Temp multi-group in Girder that matches that name.

If you are getting parse errors make sure you edit the .gml like I said earlier and play something on that playlists tab.

cdebuhr
November 7th, 2004, 06:55 AM
Have you pit the Power icons folder in the My Documents folder on your PPC?
yes.


i canīt open the mc pages anymore. :-(
fixed. jump was missing here.


I'm referring to the sensor names in MBM. You need to confirm that MBM is getting your mobo temperature and check what the name of the sensor is. Then you need to apply a MBM girder event to the Mobo Temp multi-group in Girder that matches that name.

the sensor is called mobo in mbm and is correctly shown in the mbm-display.
the event name is also mobo, but it seems to get data.


If you are getting parse errors make sure you edit the .gml like I said earlier and play something on that playlists tab.
i modified the code as you said. the parsing errors occur in the mbm scripts.

Jlee
November 7th, 2004, 08:09 AM
Can you be more specific. Can youl follow the scripts to see where it's failing?

I think we need to concentrate on one problem at a time here. Have you sorted out the battery images yet?

danward79
November 7th, 2004, 10:48 AM
Chris,

There is now a variable built into the zoomplayer driver for ZP.LinkActive, so you don't need the girder lua code I pointed you at anymore.

cdebuhr
November 7th, 2004, 12:06 PM
Can you be more specific. Can youl follow the scripts to see where it's failing?

i.e. this is the script:
--CPU Fan monitor (Check this beforte overwriting)
CPUFan = pld1
CPUFan = tonumber(CPUFan)
NetRemote.SendLabel('CPUFan',CPUFan)
if CPUFan < FanSlow then
NetRemote.SendLabel('FanWarning',1)
NetRemote.SendLabel('SystemWarning',1)
else
NetRemote.SendLabel('FanWarning',0)
end

thats the errormsg:
error: bad argument #1 to `gsub' (string expected, got nil)
stack traceback:
1: function `gsub' [C]
2: method `Quote' at line 155 [file `C:\Programme\girder\LUA\NetRemote Feedback.lua']
3: method `PackLabel' at line 213 [file `C:\Programme\girder\LUA\NetRemote Feedback.lua']
4: method `SendLabel' at line 278 [file `C:\Programme\girder\LUA\NetRemote Feedback.lua']
5: main of string "?" at line 4


I think we need to concentrate on one problem at a time here. Have you sorted out the battery images yet?
what shall i do? i took the the folder from your zip and copied it to \my documents\ on my ppc. that should be alright.


@dan
already implemented. ;-) works fine, but i still use your code to see if my tv-app is running. works fine aswell.

Jlee
November 7th, 2004, 12:55 PM
Let's get the battery stuff sorted first. Edit the Variable Manipulation Script in Girder called NR Start up and paste this code in it's place.

NetRemote.SendLabel&#40;"Connected",1&#41;
NetRemote.SendLabel&#40;"NR.CCFLoadActions",1&#41;

Keep a copy of the stuff you remove in a notepad so you can put it back later.

Now save the changes and restart NR on your PPC.

cdebuhr
November 7th, 2004, 01:13 PM
jlee,

the exact code is there already.
or did you mean i should del the rest?

Jlee
November 7th, 2004, 01:23 PM
Yes. Delete the rest