  | | | call scripts from a main script | call scripts from a main script 2005-06-16 - By Andrew Skowronski
Back Absolutely, this is the recommended way to organize scripts.
For some basic cases, e.g. if you don't need to pass values back, there is also this useful method:
Application.ExecuteScript
-- --Original Message-- -- From: owner-xsi@(protected) [mailto:owner-xsi@(protected)]On Behalf Of javier Posted At: Thursday, June 16, 2005 6:32 PM Posted To: xsi Conversation: call scripts from a main script Subject: Re: call scripts from a main script
lets say you have a function
function myscr(token){ //some code return true }
if you want to deal with external scripts then you have 2 options, either you install the commands or you writhe them in the syntax of a selfinstalled command and stick tehm in your user\Application\Plugins. ( i only willexplain this second step because it is better)
you can either use the command wizard to generate your header (i forget, which pulldown it is in) or you can write your headers yourself they ahve 4 parts.
load unload init and execute
so your function myscr would look like this
function XSILoadPlugin( in_reg ){ in_reg.Author = "you"; in_reg.Name = "myscr"; in_reg.Email = ""; in_reg.URL = ""; in_reg.Major = 1; in_reg.Minor = 0; in_reg.RegisterCommand("myscr","myscr"); return true; } function XSIUnloadPlugin( in_reg ) strPluginName = in_reg.Name; //lines to be executed if the plugin is removed return true; } function myscr_Init( ctxt ){ //lines to be exectued when the pluing is loaded //most importatnly you have to define your ARGUMENTS here var oCmd; oCmd = ctxt.Source; oCmd.Description = ""; oCmd.ReturnValue = true; var oArgs = oCmd.Arguments; oArgs.Add("token"); //your argument for that funtion return true; } function myscr_Execute(itoken){ //your code...as you would otherwise have it }
once you have this, reload your plugins and you can run myscr(token) from other scripts
also, you can stick as many commands in the plugin loader as you want
On 6/16/05, David Saber <david.saber@(protected)> wrote: > Hello > What code should I add to my main script in order to call several other > scripts? > Thanks > David > > --- > Unsubscribe? Mail Majordomo@(protected) with the following text in body: > unsubscribe xsi >
--- Unsubscribe? Mail Majordomo@(protected) with the following text in body: unsubscribe xsi
--- Unsubscribe? Mail Majordomo@(protected) with the following text in body: unsubscribe xsi
|
|
 |