Indigo Rose Software
  #1  
Old 01-20-2009
pww's Avatar
pww pww is offline
Forum Member
 
Join Date: Jun 2005
Posts: 343
Quick script tester

A friend asked me today how to quickly test pieces of script code. He said he's rebuilding a ~600 MB installer tens of times to test minor changes in script code.

It's really simple, but may be useful for someone.
In the On Startup script of an empty project, put a code like this

Code:
-- ################## LUA SCRIPT TESTER ############
if _CommandLineArgs ~= nil and Table.Count(_CommandLineArgs) > 0  then
	if File.DoesExist(_CommandLineArgs[1]) then
		testFile = _CommandLineArgs[1];
	else
		Dialog.Message("Error", "Invalid argument:" .. _CommandLineArgs[1], MB_OK, MB_ICONEXCLAMATION);
		Application.Exit();
	end;
else
	testFile = _SourceFolder .. "\\test.lua";
end; 

if File.DoesExist(testFile) then
	require(testFile);
else
	Dialog.Message("Error", "File not found:" .. testFile, MB_OK, MB_ICONEXCLAMATION);
end
Application.Exit();
-- ##################################################
and build the project (it does not need to have screens, uninstaller etc.)
Name the generated exe LuaScriptTester.exe or alike

Then you can use this .exe to quickly test pieces of SF script code outside SF, without the need to build a setup etc. - it will read and execute script code from a text file.
If you pass a full local file path to it as an argument, it will execute the script code in the file (if the path contains spaces, it should be enclosed in double "..." quotes). This way you can test code you write in editors like UltraEdit.
If there are no arguments supplied, it will execute the code in the file test.lua, located in the same folder where the exe is.

Of course this can't be used for testing just any code, like code related to screens in your projects etc. - for this you have to build a setup and test it.
But for stuff like testing registry or file reads/writes and many others, or just to see how some script action works, it may be useful.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Tree menu Brave Heart AutoPlay Media Studio 6.0 17 05-20-2009 11:23 AM
Menu Bar Creation Script test . have a quick look. tnx AutoPlay Media Studio 7.5 Discussion 0 09-25-2008 07:50 AM
Server script decryption error on Chinese Windows XP SvenskLars TrueUpdate 2.0 5 07-05-2007 09:59 AM
How can I know the FS Command name of a movie??? yoske AutoPlay Media Studio 5.0 27 01-01-2005 11:39 PM
Quick Script: Get key System Information SUF6NEWBIE AutoPlay Media Studio 5.0 0 08-31-2004 01:28 AM


All times are GMT -6. The time now is 12:30 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Copyright © 2000 - 2009 Indigo Rose Corporation. All rights reserved.
Indigo Rose Software