Skip to content

Instantly share code, notes, and snippets.

@aragaer
Created August 27, 2010 23:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aragaer/554376 to your computer and use it in GitHub Desktop.
Save aragaer/554376 to your computer and use it in GitHub Desktop.
# set this to your eve path
EVEROOT = "/home/aragaer/.wine/drive_c/Program Files/CCP/EVE"
# start ooocalc like this:
# oocalc -accept="socket,host=localhost,port=2002;urp;"
# then run this script and type a character id anywhere
import uno
from reverence import blue
local = uno.getComponentContext()
resolver = local.ServiceManager.createInstanceWithContext("com.sun.star.bridge.UnoUrlResolver", local)
context = resolver.resolve("uno:socket,host=localhost,port=2002;urp;StarOffice.ComponentContext")
desktop = context.ServiceManager.createInstanceWithContext("com.sun.star.frame.Desktop", context)
document = desktop.getCurrentComponent()
sheets = document.Sheets
sheet1 = sheets.Sheet1
eve = blue.EVE(EVEROOT)
c = eve.getcachemgr()
cmc = c.LoadCacheFolder("CachedMethodCalls")
my_stuff = {}
for key, obj in cmc.iteritems():
if key[1] == "GetPublicInfo":
my_stuff[key[2]] = obj
char_id_to_name = {}
char_name_to_id = {}
for key, obj in my_stuff.iteritems():
name = obj['lret'].characterName
char_id_to_name[key] = name
char_name_to_id[name] = key
while (1):
sel = document.getCurrentSelection()
seladdr = sel.getRangeAddress()
col = seladdr.StartColumn + 1
row = seladdr.StartRow
cell = sheet1.getCellByPosition(col, row)
try:
cell.Formula = char_id_to_name[int(sel.getString())]
except:
cell.Formula = "not found"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment