Opening an LK script

  • pstuder
  • Topic Author
More
13 Jul 2016 11:55 #4613 by pstuder
Opening an LK script was created by pstuder
Hi,

I am writing scripts to run and record simulations. In order to open a script, do you need to open up SAM/a project first? Ideally, I would like to just open the script, press run, and the script itself will open the project and run the simulations.

I set the properties so that scripts would open with SAM, and when I click to open it, a window pops up and freezes without anyting on it. The scripts are .lk, so I was thinking maybe that has something to do with the problem. There are old versions of the script for 2012 that will open automatically and run. Basically I'm looking for a way to simply click on the script file and for it to open without having to first open SAM.

OR is there a way to create my own macro?

Thanks,
Paige

Please Log in or Create an account to join the conversation.

  • pgilman
More
13 Jul 2016 13:59 #4614 by pgilman
Replied by pgilman on topic Opening an LK script
Dear Paige,
It is not possible to run an LK script without first starting SAM and opening the script editor. It is also not possible to run an LK script or macro in SAM from a command line.
If you want to run SAM simulations from code that you write without using the SAM user interface, you could use the SAM Software Developent Kit . That allows you to write code in C, C#, Java, Python, PHP or MATLAB. You should plan to take some time to get things set up on your computer and to learn how to use the tools in the SDK, but once you've done that it would be straightforward to run simulations without opening SAM.
SAM's macros are just LK scripts that are stored in the macros folder of your SAM installation (find the SAM installation folder, and then look for runtime/macros). SAM reads all of the files in that folder and displays the file names of the LK script file on the Macro page of the user interface. LK script for macros can use a set of special commands to display basic user interface elements on the Macro page -- you can look at the built-in macros to see how those work.
Best regards,

Paul.

Please Log in or Create an account to join the conversation.

  • pstuder
  • Topic Author
More
20 Jul 2016 12:10 #4615 by pstuder
Replied by pstuder on topic Opening an LK script
Thanks! This was helpful to me.

Please Log in or Create an account to join the conversation.

Moderators: pgilman
Powered by Kunena Forum