Hyperlinks aus Visio extrahieren mit Python
Hier ist ein kleines Python-Script, welches alle Hyperlinks aus Microsoft Visio Dokumenten in eine Textdatei extrahiert. Es benötigt Pywin32!
from win32com.client import Dispatch from sys import argv from sys import exit if len(argv)<=2: print 'This tool extracts all Hyperlinks from Visio Drawings to a file.' print '\nUsage: vsdhyperlink.exe ' exit() app = Dispatch('Visio.Application') app.Visible = 0 visioDoc = app.Documents.Open(argv[1]) file = open(argv[2], 'w') count = 0 for page in range(visioDoc.Pages.Count): for shape in range(visioDoc.Pages(page+1).Shapes.Count): for link in range(visioDoc.Pages(page+1).Shapes.Item(shape+1).Hyperlinks.Count): link = visioDoc.Pages.Item(page+1).Shapes.Item(shape+1).Hyperlinks.Item(link).Address file.write(link+'\n') count += 1 print link file.close() print 'Written %s URLS to file %s'%(count, argv[2]) app.Quit()