2 into 1

GX and Typhoon hardware, this includes, displays, cables and accessory cards.

Moderator: Mods

darkvader71
LCD Geek
Posts: 36
Joined: Thu Jan 07, 2010 3:02 am

2 into 1

Post by darkvader71 »

Hello my coding is not great and I am stuck.I have a code that shows when wmp is PLAYING as i have a dell premium remote that has wmp services on in the background so wmp running will always be true,
somehow i made this and it worked

CustomItems.Key1qq

String status = ((String)GetData("WMP9.Status"));
int fi = status.IndexOf('\'');
if ( fi == -1 )
{ // no track playing
if ( status == "" )
{ // wmp not open
return "false";
}
return "false";
}

int li = status.LastIndexOf('\'');
String track = status.Substring( fi+1, li-(fi+1) );

return "True "




I also have a custom screen which i want displayed all the time except when winamp(being monitored in application monitor) or my CustomItems.Key1qq(windows media player playing)
how do i combine both functions to triger custom screen? any help will be nice.thank you

Ray
Matrix Orbital
Matrix Orbital
Posts: 742
Joined: Thu Dec 13, 2001 4:00 pm
Location: Earth.... I think..
Contact:

Post by Ray »

Create a new custom item where you logic or the two?

darkvader71
LCD Geek
Posts: 36
Joined: Thu Jan 07, 2010 3:02 am

Post by darkvader71 »

i tried this but when winamp opens,I get an error. :oops:

if(((Boolean)GetData("AppMonitor.Winamp.exe.Running"))&&((Boolean)GetData("CustomItems.Key1qq.true"))) return true;
else return false;


if anyone can help I would appreciate as this is driving me crazy

darkvader71
LCD Geek
Posts: 36
Joined: Thu Jan 07, 2010 3:02 am

Post by darkvader71 »

hello,any help? anyone?

Ray
Matrix Orbital
Matrix Orbital
Posts: 742
Joined: Thu Dec 13, 2001 4:00 pm
Location: Earth.... I think..
Contact:

Post by Ray »

What error does it give you?

darkvader71
LCD Geek
Posts: 36
Joined: Thu Jan 07, 2010 3:02 am

Post by darkvader71 »

i get false when windows media player is playing but should be true & when winamp is running i get this error
Unknown:System.InvalidCastException: Specified cast is not valid.
at ScriptedDataItemImpl.eval()



all i want to acheive is my custom screen running when either winamp or key1qq( windows media player playing) is not. I do not want them cycling every 5 seconds. so basically
winamp running= winamp screen
Key1qq( wmp playing= wmp screen
wimamp or Key1qq not running + custom screen

darkvader71
LCD Geek
Posts: 36
Joined: Thu Jan 07, 2010 3:02 am

Post by darkvader71 »

i get false when windows media player is playing but should be true & when winamp is running i get this error
Unknown:System.InvalidCastException: Specified cast is not valid.
at ScriptedDataItemImpl.eval()



all i want to acheive is my custom screen running when either winamp or key1qq( windows media player playing) is not. I do not want them cycling every 5 seconds. so basically
winamp running= winamp screen
Key1qq( wmp playing= wmp screen
wimamp or Key1qq not running + custom screen

darkvader71
LCD Geek
Posts: 36
Joined: Thu Jan 07, 2010 3:02 am

Post by darkvader71 »

i get false when windows media player is playing but should be true & when winamp is running i get this error
Unknown:System.InvalidCastException: Specified cast is not valid.
at ScriptedDataItemImpl.eval()



all i want to acheive is my custom screen running when either winamp or key1qq( windows media player playing) is not. I do not want them cycling every 5 seconds. so basically
winamp running= winamp screen
Key1qq( wmp playing= wmp screen
wimamp or Key1qq not running + custom screen

darkvader71
LCD Geek
Posts: 36
Joined: Thu Jan 07, 2010 3:02 am

Post by darkvader71 »

i get false when windows media player is playing but should be true & when winamp is running i get this error
Unknown:System.InvalidCastException: Specified cast is not valid.
at ScriptedDataItemImpl.eval()



all i want to acheive is my custom screen running when either winamp or key1qq( windows media player playing) is not. I do not want them cycling every 5 seconds. so basically
winamp running= winamp screen
Key1qq( wmp playing= wmp screen
wimamp or Key1qq not running + custom screen

darkvader71
LCD Geek
Posts: 36
Joined: Thu Jan 07, 2010 3:02 am

Post by darkvader71 »

i get false when windows media player is playing but should be true & when winamp is running i get this error
Unknown:System.InvalidCastException: Specified cast is not valid.
at ScriptedDataItemImpl.eval()



all i want to acheive is my custom screen running when either winamp or key1qq( windows media player playing) is not. I do not want them cycling every 5 seconds. so basically
winamp running= winamp screen
Key1qq( wmp playing= wmp screen
wimamp or Key1qq not running = custom screen
Last edited by darkvader71 on Tue Jan 12, 2010 4:14 pm, edited 2 times in total.

Ray
Matrix Orbital
Matrix Orbital
Posts: 742
Joined: Thu Dec 13, 2001 4:00 pm
Location: Earth.... I think..
Contact:

Post by Ray »

Try removing the quotes from true and false , you returning strings now

darkvader71
LCD Geek
Posts: 36
Joined: Thu Jan 07, 2010 3:02 am

Post by darkvader71 »

[quote]Try removing the quotes from true and false , you returning strings now.



Hello Ray
sorry did not understand your comment "Try removing the quotes from true and false , you returning strings now".

I think i must inform you that I a new to coding. do you mean like this below ?


if(((Boolean)GetData(AppMonitor.Winamp.exe.Running))&&((Boolean)GetData(CustomItems.Key1qq.true))) return true;
else return false;


(yes i am a noob) :D

darkvader71
LCD Geek
Posts: 36
Joined: Thu Jan 07, 2010 3:02 am

Post by darkvader71 »

can someone help with acheiving this as my coding keeps presenting errors.
Thankyou[/quote]

Ray
Matrix Orbital
Matrix Orbital
Posts: 742
Joined: Thu Dec 13, 2001 4:00 pm
Location: Earth.... I think..
Contact:

Post by Ray »

Did you remove them as well from your CustomItems.Key1qq ?

darkvader71
LCD Geek
Posts: 36
Joined: Thu Jan 07, 2010 3:02 am

Post by darkvader71 »

Ray I know you are a very busy man but like I said, I copied this coding from a forum and changed the manes of the items.
I do not poses any coding skills so if you could find the time to correct codes above and paste here or pm me I would be very greatful. this issue is the only outstanding item of my project( which can be seen in the gallery section. Thank you
Last edited by darkvader71 on Sat Jan 23, 2010 4:18 am, edited 1 time in total.

Post Reply