Maxima CAS (wxMaxima): run via the command line

Get help with using AutoHotkey and its commands and hotkeys
User avatar
Posts: 6902
Joined: 19 Dec 2016, 01:58
Location: UK

Maxima CAS (wxMaxima): run via the command line

20 Sep 2018, 13:41

- Maxima CAS (wxMaxima) is a freeware computer algebra system (cf. Mathematica, MATLAB).
- It has a GUI, but it can be useful to do calculations via the command line instead.
- Here is a script to demonstrate how it can be used via the command line.

Code: Select all

;to run Maxima/wxMaxima via the command line manually:
;press Win+R, type cmd [and press Enter]
;type cd C:\maxima-5.39.0\bin [or the appropriate folder] [and press Enter]
;type maxima [and press Enter]
;type 1+1;2+2;3+3;4+4;5+5; [and press Enter]
;type quit(); [and press Enter]

q:: ;run Maxima/wxMaxima via the command line
vPathExe := "C:\maxima-5.39.0\bin\maxima.bat"
vScript := "1+1;2+2;3+3;4+4;5+5;quit();"

DetectHiddenWindows, On
vComSpec := A_ComSpec ? A_ComSpec : ComSpec
Run, % vComSpec,, Hide, vPID
WinWait, % "ahk_pid " vPID
DllCall("kernel32\AttachConsole", "UInt",vPID)
oShell := ComObjCreate("WScript.Shell")
oExec := oShell.Exec(Chr(34) vPathExe Chr(34))
vStdOut := oExec.StdOut.ReadAll()
Process, Close, % vPID
oShell := oExec := ""
MsgBox, % vStdOut

- How to get the input text *and* output text (as displayed in the command prompt).
- How to ignore the initial text. I.e. can you launch it, and 'clear' the StdOut text at that point in order to skip that text.
- Can you perform an input and get the output, then perform an input and get the output etc.


[AHK forum]
Is there any Derivative Function? - AutoHotkey Community

[WScript.Shell links]
WshShell Object
Exec Method (Windows Script Host)
WshScriptExec Object
StdErr Property (WshScriptExec)
StdIn Property (WshScriptExec)
StdOut Property (WshScriptExec)
TextStream Object

[WScript.Shell: jethrow links]
COM Object Reference [AutoHotkey v1.1+] - Page 4 - Scripts and Functions - AutoHotkey Community
WshShell Object
Microsoft Windows 2000 Scripting Guide - WSH Primer | Microsoft Docs

[wxMaxima links]
Maxima CAS Tutorials - YouTube
Maxima Documentation
Maxima, a Computer Algebra System
[intro on using Maxima via the console]
Introduction to Maxima
best utilities + best AutoHotkey scripts (+ useful tips) - AutoHotkey Community
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA

Return to “Ask For Help”

Who is online

Users browsing this forum: Bing [Bot] and 45 guests