Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Find variables in a software app

hagwaghagwag Member Posts: 1
I have a software that uses Delphi to write scripts. The are open to all users, and you can write and support the scripts as much as you like. So I am now starting to learn Delphi. So far it has been a blast. Here is an example...
unit PartSaveAsFiller;

var
PD : TData ;
PN : TSNPart ;
i : integer ;
begin
for i := DataList.count-1 downto 0 do begin
PD := DataList.at_Object(i);
if IsSNPart(PD) then begin
PN := DataList.at_Object(i);
//ShowMessage(PN.Partname) ;
//Set Filler Part Property to TRUE
PN.FillerPart := true ;
PN.SavePartFile('');
break ;
end ;
end ;
end.
This is a CNC software for nesting. So the CAD part is imported in, and a part is created. The part has parameters. This script uses the TDATA (Task Data - A task is the group of parts to nest), and the TSNPART (SN Part Data).

I know a few of the "variables" used. But they do not have a usable list of commands. Is there a way to scan a drive, database, whatever to find all of the available variables to be used in a script? I can think of 100's of scripts to write that will improve this software. But in a lot of cases, I know the data I want, I just can't find the correct call out to get it. Hope I described this in an appropriate manner. Thanks for any help you might have.

Comments

  • zibadianzibadian Member Posts: 6,349
    : I have a software that uses Delphi to write scripts. The are open
    : to all users, and you can write and support the scripts as much as
    : you like. So I am now starting to learn Delphi. So far it has been
    : a blast. Here is an example...
    : unit PartSaveAsFiller;
    :
    : var
    : PD : TData ;
    : PN : TSNPart ;
    : i : integer ;
    : begin
    : for i := DataList.count-1 downto 0 do begin
    : PD := DataList.at_Object(i);
    : if IsSNPart(PD) then begin
    : PN := DataList.at_Object(i);
    : //ShowMessage(PN.Partname) ;
    : //Set Filler Part Property to TRUE
    : PN.FillerPart := true ;
    : PN.SavePartFile('');
    : break ;
    : end ;
    : end ;
    : end.
    : This is a CNC software for nesting. So the CAD part is imported in,
    : and a part is created. The part has parameters. This script uses
    : the TDATA (Task Data - A task is the group of parts to nest), and
    : the TSNPART (SN Part Data).
    :
    : I know a few of the "variables" used. But they do not have a usable
    : list of commands. Is there a way to scan a drive, database,
    : whatever to find all of the available variables to be used in a
    : script? I can think of 100's of scripts to write that will improve
    : this software. But in a lot of cases, I know the data I want, I
    : just can't find the correct call out to get it. Hope I described
    : this in an appropriate manner. Thanks for any help you might have.
    :
    Here's an example code to place all the filenames matching a certain criterium into a memo:
    http://www.programmersheaven.com/mb/delphikylix/101448/103706/ReadMessage.aspx?S=B20000#103706
    Once you have that list you need to parse the scripts for the variable names. Writing such a parser can be tricky, depending on the complexity of the scripts. A very simple parser reads each script once character at a time and determines the nature of that character: space, symbol, letter of an identifier, etc. If the first letter of an identifier is found, it should continue reading that identifier until something else is found.
    Here's an example of a parser to find words:
    [code]
    i := 1;
    while i <= Length(Script) do
    begin
    if Script[i] in ['a'..'z', 'A'..'Z'] then
    begin
    Word := '';
    while (i <= Length(Script)) and (Script[i] in ['a'..'z', 'A'..'Z']) do
    begin
    Word := Word + Script[i];
    inc(i);
    end;
    { Store Word somewhere }
    end else
    inc(i);
    end;
    [/code]
Sign In or Register to comment.