HomeGenie Forum

Automation Program Plugins and Wizard Scripting => Help => Topic started by: mchias13 on March 23, 2016, 03:06:58 PM

Title: Confused - main and startup
Post by: mchias13 on March 23, 2016, 03:06:58 PM
I'm diving into the coding part of homegenie.  I'm having issues with having my program run consistently.  It only seems to be run if I compile and click run.  My assumption is homegenie runs like a PLC, constantly checking the running programs in order.  Please correct me if I'm wrong.

My confusion comes in in when is the Startup code actually run?  Is it run once? Every time the server calls the program? Once a program is running does it then ignore the startup code?

I put Program.Run() in my startup and Program.GoBackground() at the end of my main.
Title: Re: Confused - main and startup
Post by: mchias13 on March 24, 2016, 12:15:31 AM
So i just tried this code->

in startup:
var onTime = "*/2 * * * *";

if (Scheduler.IsScheduling(onTime))
   Program.Run();

in main section:
Program.Notify("Test Program", "main");
Pause(2);
Program.GoBackground();


I don't get the pop up notification.  Please help I'm lost. 

edited my code for */2 to repeat every 2 minutes.
Title: Re: Confused - main and startup
Post by: bkenobi on March 24, 2016, 03:53:58 PM
http://www.homegenie.it/forum/index.php?topic=1442.msg9191#msg9191 (http://www.homegenie.it/forum/index.php?topic=1442.msg9191#msg9191)

This gives a simple example like yours.