Best Python code snippet using pyatom_python
Insert new braces WP - curr - focus - paste.py
Source:Insert new braces WP - curr - focus - paste.py  
1import re2import wx34wnd = avsp.GetWindow()5script = wnd.currentScript67wx.TheClipboard.Open()8pasteText = wx.TextDataObject('')9if wx.TheClipboard.GetData(pasteText):10	pasteText = pasteText.GetText()11# Source - https://gist.github.com/line0/113289401213curr=avsp.GetFrameNumber()14bookmarks = avsp.GetBookmarkList()15#wnd.zoomfactor = 116if bookmarks:17		bookmarks = list(set(bookmarks))18		bookmarks.sort(reverse=True) 19		for k in range(len(bookmarks)): 20			if bookmarks[k] <= curr:21				curr=bookmarks[k] #curr := last bookmark if there are any22				break2324frms=avsp.GetVideoFramecount(index=None)-125bookmarks = avsp.GetBookmarkList()26cg=027txt=avsp.GetText(index=None, clean=False)28txl=txt.splitlines()29txl.reverse()3031for x in range(len(txl)):32	y=re.findall('.*\s+focusser\s*=\s*\d{1}',txl[x])33	if len(y)>0: #if find match34		ys=y[0].split('=')35		if str(ys[1]).strip()!='0':36			cg=137			break38					39for x in range(len(txl)):40	y=re.findall('.*\s+last_bk\s*=\s*\d{1,}',txl[x])41	if len(y)>0: #if find match42		ff=int(y[0].split('=')[1].strip())43		if cg==1:44			curr=ff45			frms=046		break4748for x in range(len(txl)):49	y=re.findall('{\s*\-{0,1}\d{1,5}\s*,\s*\-{0,1}\d{1,5}\s*,\s*\-{0,1}\d{1,5}\s*,\s*\d+\s*,\s*\d+\s*,\s*\d+\.*\d*\s*,\s*\d+\.*\d*\s*}',txl[x])50	if len(y)>0: #if find match51		ys=y[0].split(',')52		x2=x+1 if x<len(txl)-1 else x53		y2=re.findall('{\s*\-{0,1}\d{1,5}\s*,\s*\-{0,1}\d{1,5}\s*,\s*\-{0,1}\d{1,5}\s*,\s*\d+\s*,\s*\d+\s*,\s*\d+\.*\d*\s*,\s*\d+\.*\d*\s*}',txl[x2])54		#y2s=y2[0].split(',')55		if len(y2)>0:56			p1=str(ys[0])+','+str(ys[1])+','+str(ys[2])+','+str(ys[3])+','+str(curr-1)+','+str(ys[5])+','+str(ys[6])          57			p2='{'+pasteText+', '+str(curr)+','+str(frms)+',0.312727,0.329023}'58			if str(ys[3]).strip()==str(curr).strip():59				p3=txt.replace(y[0], p2)60			else:61				p3=txt.replace(y[0], p1+'\n'+p2)6263			avsp.SetText(p3)64			script.GotoLine(len(txl)-x)65			avsp.WriteToScrap('On brace from '+str(curr).strip()+' -> '+pasteText+'\n', pos=-1)66			avsp.ShowVideoFrame(forceRefresh=True)
...Only Insert new braces WP - curr - focus - paste.py
Source:Only Insert new braces WP - curr - focus - paste.py  
1import re2import wx34wnd = avsp.GetWindow()5script = wnd.currentScript67wx.TheClipboard.Open()8pasteText = wx.TextDataObject('')9if wx.TheClipboard.GetData(pasteText):10	pasteText = pasteText.GetText()11# Source - https://gist.github.com/line0/113289401213curr=avsp.GetFrameNumber()14bookmarks = avsp.GetBookmarkList()15#wnd.zoomfactor = 116if bookmarks:17		bookmarks = list(set(bookmarks))18		bookmarks.sort(reverse=True) 19		for k in range(len(bookmarks)): 20			if bookmarks[k] <= curr:21				curr=bookmarks[k] #curr := last bookmark if there are any22				break2324frms=avsp.GetVideoFramecount(index=None)-125bookmarks = avsp.GetBookmarkList()26cg=027txt=avsp.GetText(index=None, clean=False)28txl=txt.splitlines()29txl.reverse()3031for x in range(len(txl)):32	y=re.findall('.*\s+focusser\s*=\s*\d{1}',txl[x])33	if len(y)>0: #if find match34		ys=y[0].split('=')35		if str(ys[1]).strip()!='0':36			cg=137			break38					39for x in range(len(txl)):40	y=re.findall('.*\s+last_bk\s*=\s*\d{1,}',txl[x])41	if len(y)>0: #if find match42		ff=int(y[0].split('=')[1].strip())43		if cg==1:44			curr=ff45			frms=046		break4748for x in range(len(txl)):49	y=re.findall('{\s*\-{0,1}\d{1,5}\s*,\s*\-{0,1}\d{1,5}\s*,\s*\-{0,1}\d{1,5}\s*,\s*\d+\s*,\s*\d+\s*,\s*\d+\.*\d*\s*,\s*\d+\.*\d*\s*}',txl[x])50	if len(y)>0: #if find match51		ys=y[0].split(',')52		x2=x+1 if x<len(txl)-1 else x53		y2=re.findall('{\s*\-{0,1}\d{1,5}\s*,\s*\-{0,1}\d{1,5}\s*,\s*\-{0,1}\d{1,5}\s*,\s*\d+\s*,\s*\d+\s*,\s*\d+\.*\d*\s*,\s*\d+\.*\d*\s*}',txl[x2])54		#y2s=y2[0].split(',')55		if len(y2)>0:56			p2='{'+pasteText+', '+str(curr)+','+str(frms)+',0.312727,0.329023}'57			if str(ys[3]).strip()==str(curr).strip():58				p3=txt.replace(y[0], p2)59			else:60				p3=txt.replace(y[0], y[0]+'\n'+p2)6162			avsp.SetText(p3)63			script.GotoLine(len(txl)-x)64			avsp.WriteToScrap('On brace from '+str(curr).strip()+' -> '+pasteText+'\n', pos=-1)65			avsp.ShowVideoFrame(forceRefresh=True)
...Change RGB WP curr frame_paste.py
Source:Change RGB WP curr frame_paste.py  
1import re2import wx3import ctypes as ct45wnd = avsp.GetWindow()6script = wnd.currentScript78wx.TheClipboard.Open()9pasteText = wx.TextDataObject('')10if wx.TheClipboard.GetData(pasteText):11	pasteText = pasteText.GetText()12# Source - https://gist.github.com/line0/113289401314curr=avsp.GetFrameNumber()1516sw=017cg=018txt=avsp.GetText(index=None, clean=False)19txl=txt.splitlines()20txl.reverse()2122for x in range(len(txl)):23	y=re.findall('.*\s+focusser\s*=\s*\d{1}',txl[x])24	if len(y)>0: #if find match25		ys=y[0].split('=')26		if str(ys[1]).strip()!='0':27			cg=128			break2930for x in range(len(txl)):31	y=re.findall('.*\s+focus_frame\s*=\s*\d{1,}',txl[x])32	if len(y)>0: #if find match33		ff=int(y[0].split('=')[1].strip())34		if cg==1:35			curr=ff36		break3738for x in range(len(txl)):39	y=re.findall('{\s*\-{0,1}\d{1,5}\s*,\s*\-{0,1}\d{1,5}\s*,\s*\-{0,1}\d{1,5}\s*,\s*\d+\s*,\s*\d+\s*,\s*\d+\.*\d*\s*,\s*\d+\.*\d*\s*}',txl[x])40	if len(y)>0: #if find match41		ys=y[0].split(',')42		st=int(ys[3].strip())43		ed=int(ys[4].strip())44		if curr >= st and curr<=ed:45			sw=146		elif curr >= st and ed==0:47			sw=148		49		if sw==1:50			p1='{'+pasteText+', '+str(st)+','+str(ed)+','+ys[5]+','+ys[6]51			p2=txt.replace(y[0], p1)52			avsp.SetText(p2)53			script.GotoLine(len(txl)-x)54			avsp.WriteToScrap(str(st)+' - '+str(ed)+' -> '+pasteText+'\n', pos=-1)55			avsp.ShowVideoFrame(forceRefresh=True)
...Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!
