basic

Running Libreoffice BASIC macro from python

半腔热情 提交于 2021-01-29 00:17:41
问题 I've a macro in LibreOffice BASIC and I want to run it from my python program. I've found some threads in which they use this code: import os import win32com.client if os.path.exists("excelsheet.xlsm"): xl=win32com.client.Dispatch("Excel.Application") xl.Workbooks.Open(Filename="C:\Full Location\To\excelsheet.xlsm", ReadOnly=1) xl.Application.Run("excelsheet.xlsm!modulename.macroname") ## xl.Application.Save() # if you want to save then uncomment this line and change delete the ", ReadOnly=1"

Running Libreoffice BASIC macro from python

匆匆过客 提交于 2021-01-29 00:13:42
问题 I've a macro in LibreOffice BASIC and I want to run it from my python program. I've found some threads in which they use this code: import os import win32com.client if os.path.exists("excelsheet.xlsm"): xl=win32com.client.Dispatch("Excel.Application") xl.Workbooks.Open(Filename="C:\Full Location\To\excelsheet.xlsm", ReadOnly=1) xl.Application.Run("excelsheet.xlsm!modulename.macroname") ## xl.Application.Save() # if you want to save then uncomment this line and change delete the ", ReadOnly=1"

Parse a list of expressions using pyparsing

喜夏-厌秋 提交于 2021-01-27 21:18:00
问题 I'm trying to use pyparsing to parse simple basic program: import pyparsing as pp pp.ParserElement.setDefaultWhitespaceChars(" \t") EOL = pp.LineEnd().suppress() # Identifiers is a string + optional $ identifier = pp.Combine(pp.Word(pp.alphas) + pp.Optional("$")) # Literals (number or double quoted string) literal = pp.pyparsing_common.number | pp.dblQuotedString line_number = pp.pyparsing_common.integer function = pp.Forward() operand = function | identifier | literal expression = pp

How to avoid GOTO in C++

我只是一个虾纸丫 提交于 2020-06-13 08:55:46
问题 I have read that GOTO is bad, but how do I avoid it? I don't know how to program without GOTO . In BASIC I used GOTO for everything. What should I use instead in C and C++? I used GOTO in BASIC like this: MainLoop: INPUT string$ IF string$ = "game" THEN GOTO game ENDIF 回答1: Usually loops like for , while and do while and functions have more or less disposed the need of using GOTO. Learn about using those and after a few examples you won't think about goto anymore. :) 回答2: Consider the

How to avoid GOTO in C++

两盒软妹~` 提交于 2020-06-13 08:55:37
问题 I have read that GOTO is bad, but how do I avoid it? I don't know how to program without GOTO . In BASIC I used GOTO for everything. What should I use instead in C and C++? I used GOTO in BASIC like this: MainLoop: INPUT string$ IF string$ = "game" THEN GOTO game ENDIF 回答1: Usually loops like for , while and do while and functions have more or less disposed the need of using GOTO. Learn about using those and after a few examples you won't think about goto anymore. :) 回答2: Consider the