Page 1 of 1

Problems of executing Sable Script

Posted: Wed Jun 18, 2014 9:55 am
by cphan
I try to get subscripts from model by using the following scripts

Code: Select all

Sub getSubscriptElements()

dim count as integer
dim value as string

count = GetNumberOfSubscriptElements("type")
msgbox ( count, "number" , MB_OK )

value = GetSubscriptElement("type",0)
msgbox ( value, "first value" , MB_OK )

value = GetSubscriptElement("type",1)
msgbox ( value, "second value" , MB_OK )
End Sub 
When I run this script directly in Sable, I have count = 0 instead of 2. I have count = 1952922682, value = "getsubscriptelement("type",0) if I execute this script from the published file .spk.
Any ideas ?
Thanks

Re: Problems of executing Sable Script

Posted: Wed Jun 18, 2014 7:50 pm
by Administrator
Can you send the SPK? I'm getting identical results from one I've created.

Regarding "count", what happens if you try
count = GetNumberOfSubscriptElements(type)

I've already put a fix in that will try removing the quotes for the next update of Sable.

Re: Problems of executing Sable Script

Posted: Thu Jun 19, 2014 8:25 am
by cphan
By removing the quotes, it works now in Sable Developer. Thanks!
But I have always the problems with .spk file. I attach here my test project.

Re: Problems of executing Sable Script

Posted: Thu Jun 19, 2014 8:39 am
by cphan
Can I use the function GetNumberOfSubscriptElements with a string variable ? For example:

Code: Select all

dim test as string
test = "type"
count = GetNumberOfSubscriptElements(test)

Re: Problems of executing Sable Script

Posted: Thu Jun 19, 2014 11:54 am
by Administrator
cphan wrote:Can I use the function GetNumberOfSubscriptElements with a string variable ? For example:

Code: Select all

dim test as string
test = "type"
count = GetNumberOfSubscriptElements(test)
Yes, it should work fine. Are you having trouble?

Re: Problems of executing Sable Script

Posted: Thu Jun 19, 2014 12:00 pm
by cphan
No, it doesn't work. GetNumberOfSubscriptElements(test) returns the number of elements of the subscript named "test"

Re: Problems of executing Sable Script

Posted: Thu Jun 19, 2014 2:49 pm
by Administrator
You are right. I'll have it fixed in the next version.