Maxima CAS (wxMaxima): run via the command line

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
User avatar
jeeswg
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))
oExec.StdIn.Write(vScript)
oExec.StdIn.Close()
vStdOut := oExec.StdOut.ReadAll()
DllCall("kernel32\FreeConsole")
Process, Close, % vPID
oShell := oExec := ""
MsgBox, % vStdOut
return
QUERIES

- 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.

LINKS

[AHK forum]
Is there any Derivative Function? - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=5&t=66234

[WScript.Shell links]
WshShell Object
https://msdn.microsoft.com/en-us/library/aew9yb99
Exec Method (Windows Script Host)
https://msdn.microsoft.com/en-us/library/ateytk4a
WshScriptExec Object
https://msdn.microsoft.com/en-us/library/2f38xsxe
StdErr Property (WshScriptExec)
https://msdn.microsoft.com/en-us/library/ye284tb8
StdIn Property (WshScriptExec)
https://msdn.microsoft.com/en-us/library/yzzwsz3t
StdOut Property (WshScriptExec)
https://msdn.microsoft.com/en-us/library/cbxxzwb5
TextStream Object
https://msdn.microsoft.com/en-us/library/312a5kbt

[WScript.Shell: jethrow links]
COM Object Reference [AutoHotkey v1.1+] - Page 4 - Scripts and Functions - AutoHotkey Community
https://autohotkey.com/board/topic/56987-com-object-reference-autohotkey-v11/page-4#entry388179
WshShell Object
https://msdn.microsoft.com/en-us/library/aew9yb99
Microsoft Windows 2000 Scripting Guide - WSH Primer | Microsoft Docs
https://docs.microsoft.com/en-us/previous-versions/tn-archive/ee156603(v=technet.10)

[wxMaxima links]
Maxima CAS Tutorials - YouTube
https://www.youtube.com/playlist?list=PLEDEE2F7C6750729F
Maxima Documentation
http://maxima.sourceforge.net/documentation.html
[changelog]
Maxima, a Computer Algebra System
http://maxima.sourceforge.net/
[intro on using Maxima via the console]
Introduction to Maxima
http://maxima.sourceforge.net/docs/manual/intromax.html
best utilities + best AutoHotkey scripts (+ useful tips) - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=7&t=28149
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 (v1)”

Who is online

Users browsing this forum: No registered users and 249 guests