3.2.24 LT_execute


Description

Execute the Labtalk script

Syntax

LT_execute(script)

Parameters

script
LabTalk Script

Return

0 for success

Examples

EX1

import PyOrigin
str='newbook' #write the LabTalk script in quotes
PyOrigin.LT_execute(str) #a new workbook created

If the X-function called in LabTalk has multiple arguments, we can organize the arguments and theirs value by using a dictionary and putting the argument name as dictionary’s key while putting the argument value as key's value, then we can connect argument name and its value by string ':=' using the join() function in Python. See Ex2 for example:

EX2

# Create the dictionary containing argument name and value
xfArgs = {'type':'png', 'overwrite':'rename', 'filename':'<short name>',
          'tr1.unit':2, 'tr1.width':640}
#Construct the LabTalk script by join the argument and value together
ltScript = "expGraph {0};".format(' '.join(':='.join([arg, str(val)]) for arg,
val in xfArgs.items()))
#export Graph1 as png graph by X-function expGraph
PyOrigin.GetPage('Graph1').LT_execute(ltScript)