Controlling Mathematica Through the MS-DOS Command Line in VBA for CST MWS

In summary, the speaker is asking for help regarding controlling Mathematica through the MS-DOS command line in Visual Basic for Applications. They have been able to call Mathematica through the command line, but have trouble entering commands afterward as it opens another command line box. They have searched for a solution but have not found one and are seeking assistance. They also mention a potential solution of using a script file to input commands.
  • #1
LowerySj
2
0
Hi, guys. I need to control Mathematica through the MS-DOS command line in Visual Basic for Applications as part of a macro for CST Microwave Studio. I can call Mathematica through the command line just fine with

Code:
Shell("math", vbNormalFocus)

but when I try to enter commands afterward, such as

Code:
Shell ("1+1", vbNormalFocus)

then VBA interprets this as me wanting to open another command line box instead of using the one I just opened and which has the Mathematica interface up. I've searched the internet for a few hours trying to fix this with no luck, so I thought I'd ask you guys. It seems like if I just knew one or two more lines of code I could fix this. Any help would be greatly appreciated.

On a side note: the variety of VBA that CST's macro system uses is WinWrap Basic.
 
Computer science news on Phys.org
  • #2
Sending commands one after the other will never work.

Generally speaking (not sure this would work with Mathematica in particular) is to generate a script file containing all the commands one wants an external program to perform, then open a shell executing the program with input from the script file.
 

1. What is Mathematica?

Mathematica is a powerful computational software program used for a wide range of mathematical, scientific, and engineering calculations. It is commonly used in fields such as physics, engineering, and finance.

2. What is MS-DOS?

MS-DOS (Microsoft Disk Operating System) is an older operating system developed by Microsoft for personal computers. It is a command line interface that allows users to interact with the computer by typing in commands.

3. What is VBA?

VBA (Visual Basic for Applications) is a programming language used to create macros and automate tasks in Microsoft Office applications, such as Excel and Word. It can also be used to control programs outside of the Microsoft Office suite, such as Mathematica.

4. What is CST MWS?

CST MWS (Computer Simulation Technology Microwave Studio) is a software tool used for electromagnetic simulations. It is commonly used in the design and analysis of high-frequency electronic devices, such as antennas and filters.

5. How can I control Mathematica through the MS-DOS command line in VBA for CST MWS?

To control Mathematica through the MS-DOS command line in VBA for CST MWS, you will need to use the "shell" function in VBA to execute the desired commands. You can also use the "SendKeys" function to send keystrokes to the MS-DOS console, allowing you to interact with Mathematica in the same way you would through the regular command line interface. It is recommended to consult the documentation for both VBA and Mathematica for more detailed instructions.

Similar threads

  • Programming and Computer Science
Replies
18
Views
5K
  • Computing and Technology
Replies
2
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
5
Views
5K
Replies
12
Views
2K
  • Sci-Fi Writing and World Building
Replies
2
Views
2K
  • Programming and Computer Science
Replies
2
Views
3K
  • Programming and Computer Science
Replies
1
Views
1K
Replies
14
Views
3K
  • General Engineering
Replies
27
Views
8K
Back
Top