Page 1 of 2

2 into 1

Posted: Thu Jan 07, 2010 4:56 am
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

Posted: Fri Jan 08, 2010 9:40 am
by Ray
Create a new custom item where you logic or the two?

Posted: Fri Jan 08, 2010 11:09 am
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

Posted: Tue Jan 12, 2010 2:43 pm
by darkvader71
hello,any help? anyone?

Posted: Tue Jan 12, 2010 2:44 pm
by Ray
What error does it give you?

Posted: Tue Jan 12, 2010 4:11 pm
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

Posted: Tue Jan 12, 2010 4:11 pm
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

Posted: Tue Jan 12, 2010 4:12 pm
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

Posted: Tue Jan 12, 2010 4:12 pm
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

Posted: Tue Jan 12, 2010 4:12 pm
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

Posted: Tue Jan 12, 2010 4:26 pm
by Ray
Try removing the quotes from true and false , you returning strings now

Posted: Wed Jan 13, 2010 3:41 am
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

Posted: Fri Jan 15, 2010 11:05 am
by darkvader71
can someone help with acheiving this as my coding keeps presenting errors.
Thankyou[/quote]

Posted: Fri Jan 15, 2010 11:15 am
by Ray
Did you remove them as well from your CustomItems.Key1qq ?

Posted: Sun Jan 17, 2010 12:57 pm
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