This tag either returns an array of maps with found thread data or simply true or false. This way you can check if a Lasso process is already running.
It searches for the given string in the thread_name field.
Parameters
-name
string, required
Search string aka process name
-current
string, optional
What to do when the current thread is found
-signal
string, optional
Return a signal true if any thread with name is found
Click the "Download" button below to retrieve a copy of this tag,
including the complete documentation and sample usage shown
on this page. Place the downloaded ".inc" file in your
LassoStartup folder, restart Lasso, and you can begin using this
tag immediately.
define_tag('mv_findThread', -required='Name', -copy, -optional='current', -copy, -optional='signal', -copy);
/* current:
M = Mark the array entry as being the calling thread. X = eXclude the calling thread from the checks and the result list / signal. any = Include calling thread in checks and result list without markings.
signal:
Y = simply return true or false instead of a list with found threads.*/
local(
'tList' = array,
'curID' = thread_getcurrentid,
'insert'= false
);
// Set default value to M(ark)
if(! local_defined('current'));
local('current') = 'M';
/if;
// Set default value to N(o)
if(! local_defined('signal'));
local('signal') = 'N';
/if;
iterate(Thread_List, local('tmp'));
#tmp = Thread_Info(#tmp);
if (#tmp->find('name') >> #name);
#insert=false;
if(#tmp->find('id') >> #curID);
if(#current == 'M');
#tmp->insert('isMe'='Y');
#insert=true;
else(#current != 'X');
#insert=true;
/if;
else;
#insert=true;
/if;
if(#insert);
if(#signal == 'Y');
loop_abort;
/if;
#tList->insert(#tmp);
/if;
/if;
/iterate;
if(#signal == 'Y');
return(#insert);
else;
return(#tList);
/if;
/define_tag;