How to change screen with script

Discussion of application development using iX Developer, including but not limited to getting started, using the functions tab, properties, objects and installation.
memethemyn
Posts: 51
Joined: Fri Apr 27, 2012 12:33 pm

How to change screen with script

Post by memethemyn »

Hi..

In my project to open the Alarms page I want to use script. Because first I control the alarm bit then if the alarm bit set I wll show the Alarms page.. How can I show screen in the script.

The code is below:

Code: Select all

if ( Globals.Tags.Alarm_Bit.Value == 0) 
{
MessageBox.Show("No Active Alarms !", "No Alarm",MessageBoxButtons.OK,MessageBoxIcon.Information);
}
else
{
---- The code to show Alarms screen  -----

}





User avatar
Ron L.
Posts: 214
Joined: Fri Jul 15, 2011 3:21 pm

Re: How to change screen with script

Post by Ron L. »

The code to show a screen looks like this.

Code: Select all

Globals.Screen1.Show();
Substitute the name of the screen you want to show for "Screen1".
Best Regards,

Beijer Electronics, Inc.
Ron Lloyd | Applications Engineer

memethemyn
Posts: 51
Joined: Fri Apr 27, 2012 12:33 pm

Re: How to change screen with script

Post by memethemyn »

Thanks for your reply mr Ron..

But I have a question again about scripting..

For example we have many of recipes and want to load a default recipe each system is powered on. So I have to write script for this but I didn't find what code to write into script. Please help..

Thanks already..

Mehmet.

Edit: I Found the code

Code: Select all

Globals.Recipe.LoadRecipe(@"Recipe name");
Will be helpful..

Thanks

User avatar
Ron L.
Posts: 214
Joined: Fri Jul 15, 2011 3:21 pm

Re: How to change screen with script

Post by Ron L. »

Use the screen opened action of your startup screen.
Snap 2012-07-06 at 09.11.47.jpg
Snap 2012-07-06 at 09.11.47.jpg (67.84 KiB) Viewed 28496 times
Best Regards,

Beijer Electronics, Inc.
Ron Lloyd | Applications Engineer

memethemyn
Posts: 51
Joined: Fri Apr 27, 2012 12:33 pm

Re: How to change screen with script

Post by memethemyn »

Hi Mr. Ron..

I need a script again to log database once at the test start :(

Thanks already..

mark.monroe
Posts: 824
Joined: Tue Mar 13, 2012 9:53 am

Re: How to change screen with script

Post by mark.monroe »

You could create a timer and turn the timer on and off via a button. That timer could increment a tag which is used to tell the datalogger to log data.

If you set the timer for 1 minute, when the timer is enabled, then every minute the timer will change the value of the event tag, and the datalogger will log some data. You just need to set the "Log on Tag event" of your datalogger to the tag that is being incremented via a timer.
Snap 2012-07-09 at 08.41.45.jpg
Snap 2012-07-09 at 08.41.45.jpg (45.91 KiB) Viewed 28485 times
Best Regards,
Mark Monroe

Beijer Electronics, Inc. | Applications Engineer

memethemyn
Posts: 51
Joined: Fri Apr 27, 2012 12:33 pm

Re: How to change screen with script

Post by memethemyn »

Hi...

I don't want to open a new topic for my problem.. Anybody help me about changing font color of a button via script?

I tried to use Button1.Fontcolor but I didn't find what I must write after this code..

Thanks Already..

mark.monroe
Posts: 824
Joined: Tue Mar 13, 2012 9:53 am

Re: How to change screen with script

Post by mark.monroe »

Try This:

Code: Select all

this.Button1.FontColor = new BrushCF(Color.Aqua);
Best Regards,
Mark Monroe

Beijer Electronics, Inc. | Applications Engineer

memethemyn
Posts: 51
Joined: Fri Apr 27, 2012 12:33 pm

Re: How to change screen with script

Post by memethemyn »

Dear Mark..

Thanks for you for replies I know that I ask many question but I near to finish my project in 2 weeks. So; here is a problem that waiting me as creating test reference number.. For example; I want to give a reference number to my test as date.

Eg. Today is 13/07/2012 Time is 09:30 in this situation I want to create a reference number as 130712-0930..

I hope to help me about this problem..

Thanks..

mark.monroe
Posts: 824
Joined: Tue Mar 13, 2012 9:53 am

Re: How to change screen with script

Post by mark.monroe »

The below code will convert the SystemTagDateTime, which is a tag that reports the current time on the HMI, to the format that you want.

To log this value into the datalogger, you will need to add the tag, RefID, to your test. Then it will show up as a column in the datalogger output.

You will need to decide on how you want to trigger the code. You could do it as part of a button that starts your test for example. Or you could put it in the value change event of the SystemTagDateTime tag.

Click for more info on DateTime formating

Code: Select all

Globals.Tags.RefID.Value = ((DateTime) Globals.Tags.SystemTagDateTime.Value).ToString("ddMMyy-hhmm");
Snap 2012-07-13 at 08.07.31.png
Snap 2012-07-13 at 08.07.31.png (108.49 KiB) Viewed 28461 times
Best Regards,
Mark Monroe

Beijer Electronics, Inc. | Applications Engineer

Post Reply