Jump to content
Developer Wiki and Function Reference Links ×

A few problems in creating classes script


Recommended Posts

New to Vectorscript. Looks powerful, but frustrating. I have a few questions which I hope will help me solve a number of problems, if anyone can help?

1.Can Vector scrip read an external file, most likely a .txt file? I want to keep a script up dated, or get a script to read a database of information (in a txt file?) which I keep updated. By keeping the external source up to date and adding to it, I hope I will not have to keep updating the individual scripts in each file? If so, could some one tell me how, or show me an example and I might be able to work out what I need.

2. I?m truing to sort out a file set up script. I have taken a simple example to create a class, but how do I then get the class attributes options to pop up? If I could work out how to get it to execute an existing command (such as edit class options) I could apply this to a series of problems, In the apparent absence of a listener is there a list of commands?

3. I know its possible to produce a pull down menu group box, because thats on p70 of the language manual, but there is no real explanation of how I might do this?

4. hopefully and easy one?. How do I add to a text string. If I define a string using

newname:= StrDialog('Enter name of new class:','New Class Name?);

and I wanted to ad the prefix ?example?, how do I make the string become ?example New Class Name?

Is it the Concatenate command? Concat? I could not get it to work. Can anyone talk me through an example?

Thanks. I know these might seem random, but I hope I should be able to apply the principles here to more scripts

Cheers

VW2009, Win XP

Link to comment
New to Vectorscript. Looks powerful, but frustrating. I have a few questions which I hope will help me solve a number of problems, if anyone can help?

1.Can Vector scrip read an external file, most likely a .txt file? I want to keep a script up dated, or get a script to read a database of information (in a txt file?) which I keep updated. By keeping the external source up to date and adding to it, I hope I will not have to keep updating the individual scripts in each file? If so, could some one tell me how, or show me an example and I might be able to work out what I need.

It sounds like what you are interested in in the $Include compiler directive. Using this you can use external files (editable in whatever text editor you choose) for most of your script with only a few lines to set up the Inlcude in the actual script file.

You can also run scripts entirely from an external file.

2. I?m truing to sort out a file set up script. I have taken a simple example to create a class, but how do I then get the class attributes options to pop up? If I could work out how to get it to execute an existing command (such as edit class options) I could apply this to a series of problems, In the apparent absence of a listener is there a list of commands?

You can either set the attributes directly in the script or depending on what dialog box you want/need may be able to get the script to open.

For the list of commands look in your VW2009 application folder under VWHelp:Additional Documentation:VSFR This is the Vectorscript Function Reference. There is also an on-line version, but since it is for VW2011, it might confuse you more than help. Take a close look at the Vectorscript Appendix available from the VSFR. This includes all of the codes to select and modify objects, preferences and object variables.

3. I know its possible to produce a pull down menu group box, because thats on p70 of the language manual, but there is no real explanation of how I might do this?

You need to read up in the VSFR on the Modern Dialogs.

4. hopefully and easy one?. How do I add to a text string. If I define a string using

newname:= StrDialog('Enter name of new class:','New Class Name?);

and I wanted to ad the prefix ?example?, how do I make the string become ?example New Class Name?

Is it the Concatenate command? Concat? I could not get it to work. Can anyone talk me through an example?

concat('Example', newname);

Good luck and welcome to the wonderful world of Vectorscript. You will find there are a bunch of us who are very happy to help. It is easiest for us to help if you post specific questions about specific needs and provide the simplest code example you can that shows what you are trying to do. General statement like how do I do a menu pull down are so broad as to require a book, not a post and are likely to be ignored unless someone has lots of time.

Pat

Link to comment

Thanks for quick response. I can see I have a lot to lern here, but I'm happy with that. If I could pick one of the smaller bits first, I'll slowly built up my understanding, I hope. I'm not a coder, so this may be a long journey. Here is a very basic script taken from VW examples page, Ive changed the name and thats all

PROCEDURE Create03DetailClass;

VAR

newname : STRING;

ch : HANDLE;

BEGIN

newname:= StrDialog('Enter name of new class:','XXXXX');

IF NOT DidCancel THEN BEGIN

ch:= GetObject(newname);

IF (ch = NIL) THEN NameClass(newname) ELSE AlrtDialog('Class name already exists.');

END;

END;

Run(Create03Class);

I think I understand most of whats going on here. I simply want to know how to add a pre fix, (or a suffix, or combine two strings) so the class is not just called "newname", but "example+newname". The"example" need not even be a variable, but part of the code. Its just to help us name classes easily. One day I'd like to write something that can access an external data base (hence the original questions), and this would include pre defined atributes and standards. Currently however, i'd like the script to bring up the diaologue box just like when you create a class the normal way?

I know its only a small step, but at least I'd be moving!

Thanks again

Link to comment

I simply want to know how to add a pre fix, (or a suffix, or combine two strings)

To combine strings you use the function Concat as in

newString:= Concat(string1,string2,string3);

All the string functions will be under the section Strings in the VS function reference.

Unless every file needs to have different classes, I would use file templates as much as possible but if you still want to go with scripts, a good starting point to learn VS is to set all your classes in a VW file and then export it as Vectorscript.

One day I'd like to write something that can access an external data base (hence the original questions), and this would include pre defined atributes and standards.

You can access external data as text (txt,csv,xml, etc.) or even a database through ODBC which was recently added to VW (but I am not sure if it really works as advertised yet)

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...