Problem after upgrade with scripting a pdf viewer

I apologize, I’m sure this is an easy fix I’m just awful at scripting. I have a PDF viewer that we use for plant communication. Before upgrade this script would go through a tag that has a list of PDF’s located in our network. I have this on a 10 second timer so when the value hits “0” it just pulls the next PDF network location in the list and changes the PDFviewer file path to that new network location, essentially scrolling through plant announcements every 10 seconds. After upgrade it just simply throws the entire tags value into the PDFviewer file path instead of the next PDF network location. Any help?

 if event.propertyName == 'value':
	if event.source.value == 0:
		pdfList = system.tag.read('Testing/PDFList2').value
		if event.source.parent.getComponent('PDF Viewer').filePath == '':
			print pdfList[0]
			event.source.parent.getComponent('PDF Viewer').filePath = pdfList[0]
		else:
			try:
				index = pdfList.index(event.source.parent.getComponent('PDF Viewer').filePath)
				if len(pdfList) < index+1:
					event.source.parent.getComponent('PDF Viewer').filePath = pdfList[0]
				else:
					event.source.parent.getComponent('PDF Viewer').filePath = pdfList[index+1]
			except:
				event.source.parent.getComponent('PDF Viewer').filePath = pdfList[0]

@dholt
If you print pdfList after this line:
pdfList = system.tag.read('Testing/PDFList2').value
What’s the value of it?
I wonder if something’s getting inadvertently turned into a string, so your array manipulation becomes string manipulation.

1 Like

@PGriffith Thanks for the reply, I actually had someone from inductive contact me over the phone and issue is resolved. Thanks for replying, my apologies for late reply back. Thanks again!

2 Likes