
Auto-start when procedure file is compiled
Use a dynamic Menu definition to do two things:
1) Return the menu item string, as per normal.
2) Schedule the starting-up code with Execute/P.
Here's a demo. Copy and paste into the Procedure window and somehow cause compilation to occur (by, say, simply closing the Procedure window):
Menu "Macros", dynamic AutoStartMenu(),/Q,DoNormalStuff() End Function/S AutoStartMenu() // Test if auto start is needed NVAR/Z haveStarted= root:gHaveStarted if( !NVAR_Exists(haveStarted) ) Variable/G root:gHaveStarted=1 // do this now to prevent double scheduling Execute/P/Q/Z "StartUp()" endif return "Do Normal Stuff" End Function StartUp() DoAlert 0, "Starting Up" End

Forum

Support

Gallery
Igor Pro 10
Learn More
Igor XOP Toolkit
Learn More
Igor NIDAQ Tools MX
Learn More
--
J. J. Weimer
Chemistry / Chemical & Materials Engineering, UAH
January 25, 2010 at 06:06 pm - Permalink