SeeShell Browser API... how to use with Python?


I have seen the included Powershell code, but how to use the API from Python?


Good timing - just a few days ago we added a Python SeeShell API demo project to GitHub:

from win32com import client # needed for connecting to COM
import csv   #built in python lib for reading csv file
import sys

#SeeShell API - Python Demo Script
#Screencast on Youtube:

#This is script is the Python version of "Submit-CSV.VBS". 
#It reads a CSV file line by line, and uses SeeShell Browser 
#to submit the data to a website.

# the filename of the csv containing name and email
INPUT_FILE = 'namesandemail.csv'

# display message in console and wait for enter key
print("Press Enter to start CSV submission")

# activate SeeShell COM objects
objB = client.Dispatch("SeeShell.Browser")

with open(INPUT_FILE, 'rt') as fp: # open the csv file containing name and email
    reader = csv.reader(fp) # load it to CSV reader
    for row in reader: # for each row

        i = objB.echo("Processing Name: {} {}".format(row[0], row[0]))
        i = objB.setVariable("first", row[0])
        i = objB.setVariable("last", row[1])
        i = objB.setVariable("email", row[2])

        i ="Demo-Variables")
        if i < 0:
            print("Play error: %d" % (i,) + " " + objB.getLastError())

print("Done, press Enter to close the SeeShell Browser")



I am seeing following error, while executing above script.
Press Enter to start CSV submission

Traceback (most recent call last):
  File "", line 20, in <module>
    objB = client.Dispatch("SeeShell.Browser")
  File "C:\Python27\lib\site-packages\win32com\client\", line 95, in Dispatch
    dispatch, userName = dynamic._GetGoodDispatchAndUserName(dispatch,userName,clsctx)
  File "C:\Python27\lib\site-packages\win32com\client\", line 108, in _GetGoodDispatchAndUserName
    return (_GetGoodDispatch(IDispatch, clsctx), userName)
  File "C:\Python27\lib\site-packages\win32com\client\", line 85, in _GetGoodDispatch
    IDispatch = pythoncom.CoCreateInstance(IDispatch, None, clsctx, pythoncom.IID_IDispatch)
pywintypes.com_error: (-2147221005, 'Invalid class string', None, None)


I see you are using Python 2.7, but the script was created and tested with the latest Python version: Python 3.7