Running my Application Only Once

Running my Application Only Once

Document ID: IR10013
The information in this article applies to:
  • AutoPlay Media Studio 5.0 Standard Edition
  • AutoPlay Media Studio 5.0 Professional Edition


This article describes how to prevent your application from running more than once.


To run your application only once (i.e. the first time the user inserts your CD-ROM, and no other time), place the following code in the On Startup event of your project:

--retrieve value from the registry. If the key does not exist, result = ""

result = Application.LoadValue("Application_Name", "First_Time");

--if there was no key, the program has never been run

if result == "" then

--if there is no value set, the string will be empty

Application.SaveValue("Application_Name", "First_Time", "yes");

Dialog.Message("title", "this is the first time this program has run");




As an alternative, Pro Edition users can use Window.Close(Application.GetWndHandle(), CLOSEWND_TERMINATE) in place of Application.Exit(). This will close the window before the window draws itself (i.e. the user will see nothing).


For more information please see the following topics in the AutoPlay Media Studio 4.0 help file:

  • Program Reference | Actions | TextFile | TextFile.WriteFromString

KEYWORDS: AutoPlay Media Studio 5.0, Actions, Write, Text, File, Overwrite, Append, Disk

Last reviewed: September 26, 2003
Copyright © 2003 Indigo Rose Corporation. All rights reserved.