Jump to content
Developer Wiki and Function Reference Links ×

Auto-Updating TitleBlock Stamps Help


AEChadwick

Recommended Posts

I have been using VectorWorks for years, but I am a dreadful novice at Vectorscript.

Here is my attempt to create a title block that auto-updates using information from its own filename.

To explain? I always name files in the same format, with all files for a single show living in their own folder. ie., SHOW FOLDER : SET-EPISODE-Name.vwx

So a complete string might be DexterS6 : 862-612-Int Modest House.vwx

means "Dexter" Set #862 for Episode 612, "Interior Modest House."

Sometimes the names vary slightly, like

Torchwood : AMORT-ALL EPISODES-FBI Headquarters.vwx

means "Torchwood" Permanent (amortized) Set, "FBI Headquarters."

But it's always simply strings separated by hyphens. (ie., the set "numbers" are for reference?they are not part of any calculation, so they're not integers.)

My title block is a dead simple line of text?really it?s little more than the most essential information, please see the attached file.

Below is my attempt to script the named stamps? Needless to say, my work is little better than pseudocode, and does not compile cleanly!

I hope some VectorScript genius can lend a hand! I will credit you & praise you in the final script, which will be handed down into posterity. :)

??

{ ////////////////////

TitleBlock Stamper

Modified from Scripts by Sakkinen & David LaBarbera

and using 'Txt-Extract char separated' from www.vectorlab.info

//////////////////// }

FUNCTION StampIt(VAR textObjectName: STRING; stampString: STRING): STRING;

BEGIN

textH := GetObject(textObjectName);

IF textH = NIL THEN

BEGIN

Sysbeep;

AlrtDialog('You must have a text block named ' & textObjectName & ' for this command to work!');

END;

SetText(textH, stampString);

{ //////////////////// }

FUNCTION ExtractCharSep(VAR str: STRING; ch: CHAR): STRING;

VAR

posStr?: INTEGER;

BEGIN

ExtractCharSep?:= '';

{ char sep at start deleted }

WHILE (Len(str) > 1) & (Pos(ch, str) = 1) DO

str?:= Copy(str, 2, Len(str));

IF Len(str) > 0 THEN BEGIN

posStr?:= Pos(ch, str);

IF posStr > 0 THEN BEGIN

ExtractCharSep?:= Copy(str, 1, posStr-1);

Delete(str, 1, posStr);

END ELSE

ExtractCharSep?:= str;

END;

END;

{ //////////////////// }

Procedure StampDL;

VAR

textH : HANDLE;

stampString : STRING;

dateValue, docName, setNumber, episodeNumber, setName : STRING;

BEGIN

docName := GetFName;

setNumber := ExtractCharSep(docName, '-');

episodeNumber := ExtractCharSep(docName, '-');

setName := ExtractCharSep(docName, '.');

dateValue := Date(1, 1);

{Date ( [0=Full, 1=Abbrev, 2=Short], [0=Date, 1=Date & Time, 2=Time]) }

stampIt('Set Stamp', setNumber)

stampIt('Episode Stamp', episodeNumber)

stampIt('Name Stamp', setName)

stampIt('Date Stamp', dateValue)

END;

RUN (StampDL);

Link to comment

Try this one.

Several issues in fixing it, overall not a bad first crack.

{ ////////////////////
TitleBlock Stamper
Modified from Scripts by Sakkinen & David LaBarbera
and using 'Txt-Extract char separated' from www.vectorlab.info
//////////////////// }

Procedure StampDL;

VAR
textH : HANDLE;
stampString : STRING;
dateValue, docName, setNumber, episodeNumber, setName : STRING;


Procedure StampIt(textObjectName: STRING; stampString: STRING);

BEGIN
textH := GetObject(textObjectName);

IF textH = NIL THEN
BEGIN
Sysbeep;
AlrtDialog(Concat('You must have a text block named ', textObjectName, ' for this command to work!'));
END;

SetText(textH, stampString);
End;
{ //////////////////// }

FUNCTION ExtractCharSep(VAR str: STRING; ch: CHAR): STRING;
VAR
posStr : INTEGER;

BEGIN
ExtractCharSep := '';

{ char sep at start deleted }

WHILE (Len(str) > 1) & (Pos(ch, str) = 1) DO
str := Copy(str, 2, Len(str));

IF Len(str) > 0 THEN BEGIN
posStr := Pos(ch, str);

IF posStr > 0 THEN BEGIN
ExtractCharSep := Copy(str, 1, posStr-1);
Delete(str, 1, posStr);
END ELSE
ExtractCharSep := str;
END;
END;

{ //////////////////// }



BEGIN

docName := GetFName; 

setNumber := ExtractCharSep(docName, '-');
episodeNumber := ExtractCharSep(docName, '-');
setName := ExtractCharSep(docName, '.');

dateValue := Date(1, 1);
{Date ( [0=Full, 1=Abbrev, 2=Short], [0=Date, 1=Date & Time, 2=Time]) }

stampIt('Set Stamp', setNumber);
message(setNumber);
Wait(1);
stampIt('Episode Stamp', episodeNumber);
message(setNumber);
Wait(1);
stampIt('Name Stamp', setName);
message(setNumber);
Wait(1);
stampIt('Date Stamp', dateValue);
message(setNumber);
Wait(1);

END;

RUN (StampDL);

Link to comment
  • 5 months later...

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...