Community Tip - Learn all about PTC Community Badges. Engage with PTC and see how many you can earn! X
Hi all,
We're starting to look at scriptable objects for Mathcad Prime 4.0. Mathcad 15 has two types of scriptable objects:
We'd like to understand better the use of each type. Specifically, one proposal is that we could provide an alternative scripting mechanism in the form of a function:
The idea is fairly simple: execute an external script written in vb or jscript. The script could refer to inputs, x, y, z in this example, and could set outputs that in this example would be assigned to a, b and c.
For example, expression above, where “my-script.vb” is
Sub PushBtnEvent_Start()
Rem TODO: Add your code here
End Sub
Sub PushBtnEvent_Exec(Inputs,Outputs)
Rem first output is the sum of the arguments
Outputs(0).value = Inputs(0).value + Inputs(1).value + Inputs(2).value
Rem Second output is the product
Outputs(1).value = Inputs(0).value * Inputs(1).value * Inputs(2).value
Rem third is 3.14
Outputs(2).value = 3.14
End Sub
Is equivalent to
This type of script would not have an object in the worksheet, like the current Mathsoft controls. We're also designing input controls as buttons, sliders, text box controls etc.
Would you like to have scripts such as above?
How would you use each type and why do you prefer one over the other?
Thanks for helping us rethink this functionality.
Mona
It will be goot to have in first line WebControls (without scripts) an than Controls (with scripts).
We need to keep both the insert control and the insert scriptable object, although they could be combined into one menu item. A Control is just a scriptable object that is supplied by Mathsoft/PTC, whereas a scriptable object is a control (or possibly another COM object) supplied by someone else. The scriptable function is a great idea. Many controls are written as functions and are not used used as controls at all. The scriptable function would address this.
I also have the following requests:
1) Add some more standard controls for file handling. We should have controls for browse for file and browse for folder. We could also use some functions to check if a file or folder exists, to get a file's properties, and to get a list of files from a specified folder.
2) Allow controls to save their state when the worksheet is saved.
3) Add Python as a scripting language. It is way more powerful that VBscript or Jscript (it can handle binary files, it has math and scientific libraries available, etc). I don't expect to ever get this wish fulfilled, but I'm asking anyway
4) One annoying feature of scripted objects and controls is the warning that we get every time the worksheet is opened. One solution to this would be to allow a user to generate a certificate, and use it to sign a control. So, as an example I could generate a certificate for my company. The certificate is in two parts: a private part, and a public part. I can use the private part to sign and lock the script in a control, and anyone else can use the public part to check it is really from me (this is standard public key encryption technology). That means Prime could look for any installed certificates, and if a certificate matches the control's signature then the control is deemed to be trustworthy, and Prime does not give the annoying script warning.
Why is the "script" function in my version of the Mathcad Prime highlighted in red, as if it does not exist?
@dtn555888 wrote:
Why is the "script" function in my version of the Mathcad Prime highlighted in red, as if it does not exist?
Its in red because it still does not exist - not in Prime 4 nor in Prime 5 and as far as I am aware there will be no scripting implemented in the upcoming Prime 6 either.
You are replying to a seven year old thread - Mona Zeftel and other people which had moved from Mathsoft to PTC when PTC had taken over Mathcad, had left PTC a long time ago.
There is no (and never was) any significant development of Prime and so Prime which is now approx. ten years old and in its version 5, never lived up to the old real Mathcad which is now in version 15.
So if you need scripted components you will have to use Mathcad 15 - the better choice in many respects. If you have a license for Prime you are also entitled to use Mathcad using the very same license file.
I want to understand how to use vbs (VBScript) script in Prime and try to implement the calculation that Mona described.
What commands to use for this?
@dtn555888 wrote:
I want to understand how to use vbs (VBScript) script in Prime and try to implement the calculation that Mona described.
What commands to use for this?
Again: YOU CAN'T!
Scripting is still not implemented in Prime. The example which Mona showed is just a proposal, an idea. It never found its way into Prime, they never implemented that kind of scripting.