1 Pages (4 items)
include function issues - problem using include funcgtion - Messages
#1 Posted: 6/1/2019 3:44:47 PM
I am using SMath Studio version 0.99 build 7030 under WIN10.
I have used several releases and once I became familiar with SMath and learned the ins and outs of SMath I find it very useful.
The current project I am using it for is a great deal larger than what I have done in the past and would benefit greatly from the use of the "include" function. However, I cannot get it to work for me. The include plugin in enabled in the extensions manager. I have disabled and re-enabled it. I have removed and reinstalled SMath - I have, of course, rebooted.
As a test, I created a file "test.sm" which has a function "area" in it that computes the area of a circle. I have tested the function within "test.sm".
I created a second file "test1.sm" the first line of which is "include( "test.sm" )". I get an error "File not found test.sm". I have placed the test.sm file in my home directory - which is my documents folder and is where the test1.am file is located, in the directory from which SMath is run, in my root user folder, in the "examples" subfolder for SMath (yes I included the relative path). The error remains and remains the unchanged.
I am pretty confident the function actually works and that I am doing something wrong - but what????
I have used several releases and once I became familiar with SMath and learned the ins and outs of SMath I find it very useful.
The current project I am using it for is a great deal larger than what I have done in the past and would benefit greatly from the use of the "include" function. However, I cannot get it to work for me. The include plugin in enabled in the extensions manager. I have disabled and re-enabled it. I have removed and reinstalled SMath - I have, of course, rebooted.
As a test, I created a file "test.sm" which has a function "area" in it that computes the area of a circle. I have tested the function within "test.sm".
I created a second file "test1.sm" the first line of which is "include( "test.sm" )". I get an error "File not found test.sm". I have placed the test.sm file in my home directory - which is my documents folder and is where the test1.am file is located, in the directory from which SMath is run, in my root user folder, in the "examples" subfolder for SMath (yes I included the relative path). The error remains and remains the unchanged.
I am pretty confident the function actually works and that I am doing something wrong - but what????
#2 Posted: 6/1/2019 4:00:13 PM
1. Relative path. You must save test1.sm in the same place where test.sm file located. Save action is necessarily because you must define current path for include() function (this is implicit definition). As I know when you just open or create document the current path is "undefined".
2. Absolute path. You can define it manually. Also you can use system global variables for this ( "%MY_SMATH_DOCS%\test.sm" ).
You can use CurrentDirectory() function from the Mathcad Access Functions plugin to display the current path. Empty string as parameter will show path.
2. Absolute path. You can define it manually. Also you can use system global variables for this ( "%MY_SMATH_DOCS%\test.sm" ).
You can use CurrentDirectory() function from the Mathcad Access Functions plugin to display the current path. Empty string as parameter will show path.
Russia ☭ forever, Viacheslav N. Mezentsev
#3 Posted: 6/1/2019 4:32:06 PM
Well now, don't I feel foolish! The save clearly is important. I thought it was something I was doing (or not doing). Thank you.
#4 Posted: 6/1/2019 9:58:12 PM
As simple as that. Include is like stacking the algo
at top of the executable suite, dependent of the top work.

Genfit Algo Include.sm (16 KiB) downloaded 47 time(s).
Genfit Algo Include Test.sm (16 KiB) downloaded 47 time(s).
at top of the executable suite, dependent of the top work.
Genfit Algo Include.sm (16 KiB) downloaded 47 time(s).
Genfit Algo Include Test.sm (16 KiB) downloaded 47 time(s).
1 Pages (4 items)
-
New Posts
-
No New Posts