Python Script node for Notepad.exe. Possible?

Node to take specific lists formatting and convert them into strings and write to a text file; then open the text file asynchronously to allow the script to continue.

py.INFORM.py

import clr
clr.AddReference("RevitAPIUI")
from Autodesk.Revit.UI  import TaskDialog 	##Import task dialog

##from datetime import datetime				##Formatting date time strings for files
import time									##Time as in NOW or tiem string format functions
import sys		##Validate thie is here and avaiable#########
sys.path.append(r'C:\Program Files (x86)\IronPython 2.7\Lib')

import subprocess 							##Launching asynchronus processess like notepad
import os 									##Operating system - CASE SENSITIVE

msg=IN[0]									##DAta in 0

##msgbox=TaskDialog							##Task Dialog

astr=""										##STR for formatting
for i in msg:								##BIG MESSAGE LIST
	sstr=""									##SUB STRING
	for j in i:
		for k in j:
			sstr=sstr + str(k) + "\t"		##ADD TAB SEPARATORS
		sstr=sstr + "\n"					##ADD CARRIAGE RETURN to substring
	astr=astr + sstr + "\n"					##ADD substring to main and spacer carriage return
##Set file name using date-time in C:\TEMP####
fn="C:\\temp\\DynamoError-" + time.strftime("%Y-%m-%dt%H%M%Z") + ".txt"
f= open (fn, "w+")							##Open file wor Write
f.write(astr)								##Write out ASTR

subprocess.Popen('notepad {}'.format(fn))	##Open the file in Notepad Asynchronously
##msgbox.Show("Message",  astr )			##Will show message dialog in revit - WARNING - Synchronus- script will have to wait.

OUT=astr									##Pass formatted string out
1 Like