Jump to content

Usefull Python code


Recommended Posts

Adding this to your script will display the time it took to run.

import time
startTime = time.time()

#your code here

executionTime = (time.time() - startTime)
vs.AlrtDialog('Execution time in seconds: ' + str(executionTime))

 

 

Use this to use a list to elimimate options from another list

OmitList =['name1','name2','name3', 'name4','name5'] #replace name# with names of items to skip

for List2 in reversed(range(1,List2+1)): #List2 is the list of items you wish to process. Remove Reversed() to step through list in order.
	if any(item == vs.GetName(List2) for item in OmitList): #if name of List2 item matches name in OmitList it will result in True 
		continue #skip rest of script for this item and continue to next item in List2
	#Insert script to execute if name is not in OmitList.  

 

Edited by The Hamma
Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...