Author Topic: System Information  (Read 4514 times)

iostream212

  • Sr. Member
  • ****
  • Posts: 459
    • View Profile
System Information
« on: July 17, 2012, 04:51:24 pm »
I recently added a system information button to my setup. It is pretty flexible and an easy way to log events to your touch screen.
First I created a global variable to store system information to. In this example the variable is called "strSystemInfo".
Next I added a boolean control to my top level screen. The boolean evaluates the length of the 'strSystemInfo' variable to determine if to show the 'information available' icon or not.

No information:



Information available:



Next I created a few popups. One for information available and the other for no information available.

No information pop up:



Information popup:



Now to wire it all together:

Control press event for the information boolean:
Code: [Select]
if (vars.strSystemInfo.length > 0)
{
TopTouchScreen.ShowPopup(@"iPhone Example - System Information");
}
else
{
TopTouchScreen.ShowPopup(@"iPhone Example - System No Information");
}

Code for the information available popup. 'this' refers to a page list control, and this script adds items to the control from a delimited string of system information. I used ";" as my field delimiter.

Code: [Select]
strAlert = vars.strSystemInfo;
Alert = New Array();
Alert = strAlert.Split( ";" );
if (Alert.Length > 1)
{
this.BeginUpdate();
for (i=1; i < Alert.Length; i++)
this.Add( Alert[i], i );
this.EndUpdate();
}

To handle removing alerts I added a button with the following press event. plSystemInfo is the name of my page list:

Code: [Select]
if (TouchScreen.plSystemInfo.SelectedIndex >= 0)
{
strAlerts = TouchScreen.plSystemInfo.SelectedText;
TouchScreen.plSystemInfo.Remove(TouchScreen.plSystemInfo.SelectedIndex);
strSystemAlerts = vars.strSystemInfo.Trim();
vars.strSystemInfo = strSystemAlerts.Replace((";" + strAlerts), "");
}

With this in place I can easily add system alerts to my touch screen.  In any script I just add:
vars.strSystemInfo = vars.strSystemInfo + ";" + "New alert";
I always wanted to be somebody. In retrospect, I think I should have been more specific.

John Hughes

  • Administrator
  • Hero Member
  • *****
  • Posts: 2852
    • View Profile
    • Codecore Technologies
Re: System Information
« Reply #1 on: July 18, 2012, 02:48:48 pm »
Great, thanks for the post!

It looks like you are a pro at j9script. :)

You should also specify the strSystemInfo global variable as an initial variable in the global variable driver settings so that the script doesn't throw an error if the variable has not yet been assigned a value.
John Hughes
Codecore Technologies

iostream212

  • Sr. Member
  • ****
  • Posts: 459
    • View Profile
Re: Re: System Information
« Reply #2 on: July 19, 2012, 06:53:05 pm »
Great, thanks for the post!

It looks like you are a pro at j9script. :)

You should also specify the strSystemInfo global variable as an initial variable in the global variable driver settings so that the script doesn't throw an error if the variable has not yet been assigned a value.

Good point! That's right people: initialize your variables! :D

Sent from my Galaxy Nexus using Tapatalk 2
I always wanted to be somebody. In retrospect, I think I should have been more specific.

Frunple

  • Hero Member
  • *****
  • Posts: 774
    • View Profile
Re: System Information
« Reply #3 on: July 20, 2012, 05:03:03 am »
Wouldn't the Google Calendar driver be easier to use for this?

iostream212

  • Sr. Member
  • ****
  • Posts: 459
    • View Profile
Re: Re: System Information
« Reply #4 on: July 21, 2012, 09:53:31 am »
Wouldn't the Google Calendar driver be easier to use for this?
There is no method in that driver to add calendar entries. It would be a good idea to use that driver if it could add them.  That way your alerts would be visible independent of the elve server. If that feature was added I would change to that driver. Probably setup a dedicated automation Gmail acct too.

Sent from my Galaxy Nexus using Tapatalk 2
« Last Edit: July 21, 2012, 09:57:23 am by iostream212 »
I always wanted to be somebody. In retrospect, I think I should have been more specific.

Frunple

  • Hero Member
  • *****
  • Posts: 774
    • View Profile
Re: System Information
« Reply #5 on: July 21, 2012, 04:36:37 pm »
Just add them to your calendar itself and they would appear in your screens.  Killing 2 stones with one bird.