KludgeCode

is Ben Rudgers

Have a Bad Day: VectorScript’s OpenURL

So playing around with writing demoWare got me thinking about how much foresight went into VectorScript’s architecture. Like the rest of VectorWorks, it’s really just a mashup of features. Among them is the wonderful “OpenURL.”

According to the documenation : Opens a web page or file using the default browser or appropriate application (e.g. Adobe Acrobat).

A web page or a file? What could possibly go wrong?

Here’s the nice version which asks you to pick the file [dated 2009/8/20]:


Procedure launch_a_file;

VAR
	filename	:string;
	urlstring	:string;
	status 		:boolean;

BEGIN
GetFile(fileName);
IF NOT DidCancel THEN 
	BEGIN
	urlstring := Concat('file:\\\',filename);
	message (launch_file);
	status:= OpenURL(urlstring);
	END;
END;
RUN(launch_a_file);

A not so nice version might do all sorts of things. Without letting the user select the file.

Vectorworks was my first exposure to Mac partisanship. Windows users were always clearly seen second class citizens both within discussions and by Nemetschek – even though they denied it. When I released the code and Icon for the run command, I made sure it didn’t work on the Mac by wrapping it thusly [dated 2009/8/20]:


VAR
	{bad_mac variables}
	appMajor, appMinor, appMaint, platform : integer;

	{run_on_windows variables}
	filename	:string;
	urlstring	:string;
	status 		:boolean;

Procedure run_on_windows;
BEGIN
GetFile(fileName);
IF NOT DidCancel THEN 
	BEGIN
		urlstring := Concat('file:\\\',filename);
		status:= OpenURL(urlstring);
	END;
END;

PROCEDURE bad_mac;
BEGIN
	alrtdialog ('OSX not Supported');
	alrtdialog ('Ending Program');
END;

BEGIN {main loop}
GetVersion(appMajor, appMinor, appMaint, platform);
		IF (platform = 1) 
		THEN bad_mac
		ELSE run_on_windows;
END;

RUN(launch_a_file);

The older version of bad_mac was less civil and was part of my investigation into VectorScript’s OpenURL [dated 2009/8/18]:



Procedure Mac_filter;

VAR
appMajor, appMinor, appMaint, platform : integer;

PROCEDURE microsoft_url;
{////  Open microsoft.com  /////}
VAR
  status : boolean;
  urlstring : string;
Begin
  urlstring := 'http:\\www.microsoft.com';
  status:= OpenURL(urlstring);
END;

PROCEDURE bad_mac;
BEGIN
  alrtdialog ('Operating System is Error - Getting Upgrade');
  microsoft_url;
END;

BEGIN
GetVersion(appMajor, appMinor, appMaint, platform);
		IF (platform = 1) 
		THEN bad_mac
		ELSE message('execute program');
END;

RUN (Mac_filter);

And here is the icon for the nice version of Run: