Getting selected cell value in Power Table

I am trying to get a value of the cell from a power table to put into a path to open a file, I have the script working if I put it into a Momentary button and get the value from a label, but when I put it into onMouseClick or onDoubleclick Function in Power table component scripting it doesn't work. I think Im not passing the value of the cell into the path.

    serial = value
	
	folder_path = "A:\\Results\\MY\\Test\\X\\C\\" + serial + "\\" + serial + "_[20241118]"
	
	def find_html_file(folder_path):
		for file_name in os.listdir(folder_path):
	 	    if file_name.endswith(".html"):
		        return os.path.join(folder_path, file_name)
	return None
	
	# Find the HTML file
	html_file_path = find_html_file(folder_path)
	
	print("HTML file path:", html_file_path)
	
	# Open the HTML file using system.net.openURL
	if html_file_path:
	 	try:
	  	    system.net.openURL("file:///" + html_file_path.replace("\\", "/"))
	 	except Exception as e:
	  	    system.gui.errorBox("Failed to open HTML file: {}".format(str(e)))
	else:
	 	system.gui.warningBox("No HTML file found in the specified folder.")

You are unconditionally returning None at this line, unless you messed up the indentation when you pasted into the forum.

1 Like

Yeah that solved it, I messed up the indentation while copying into the power table scripting window. Thank you.