cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 
Developer forum

GDL: User Input - "Can't Find Macro" - Return

Lingwisyer
Hero

Hi all,

 

I have a macro call in which the user can inser their own symbol objects, and I was wondering if there was a way to detect whether the inserted name exists so that I can ignore the input if it does not whilst giving a notice about it. At the moment it just fails to generate which is highly inconvenient.

 

 

Ling.

AC22-23 AUS 7000Help Those Help You - Add a Signature
Self-taught, bend it till it breaksCreating a Thread
Win10 | R5 2600 | 16GB | GTX1660 
1 ACCEPTED SOLUTION
4 REPLIES 4

DGSketcher
Champion

Could you use OPEN to test for the file presence and use the return values followed by CLOSE?

Apple iMac macOS Ventura / AC26UKI (most recent builds)

folder = OPEN (called_object, "c:", "FILES")

Any idea how you would point that at the loaded libraries? 

 

Hm. Found Runxel's thread about this...

Similar thread

AC22-23 AUS 7000Help Those Help You - Add a Signature
Self-taught, bend it till it breaksCreating a Thread
Win10 | R5 2600 | 16GB | GTX1660 

Solution
Lingwisyer
Hero
@DGSketcher - Could you use OPEN to test for the file presence and use the return values followed by CLOSE?

Figured out how to use the text I/O to query if the file exists

 

channel = OPEN ("TEXT", marker_call, "library")

IF marker_call # "" & channel # -1 then		!Name inserted, name exists (actually > -1)
		MUL2 marker_height * (-10) * GLOB_SCALE, marker_height * 10 * GLOB_SCALE
			CALL marker_call parameters ALL,
					penAttribute_1		=	penAttribute_1,
					penAttribute_2		=	penAttribute_2,
					penAttribute_3		=	penAttribute_3,
					penAttribute_4		=	penAttribute_4,
					fillAttribute_1		=	fillAttribute_1,
					fillAttribute_2		=	fillAttribute_2,
					lineTypeAttribute_1	=	lineTypeAttribute_1,
					lineTypeAttribute_2	=	lineTypeAttribute_2
		DEL 1
		TEXT2	0,	0,	channel				
	else
		IF i = 1 then
			TEXT2	0,	0,	"Marker Name Not Found"
		endIF
endIF

 

 

 

Ling.

AC22-23 AUS 7000Help Those Help You - Add a Signature
Self-taught, bend it till it breaksCreating a Thread
Win10 | R5 2600 | 16GB | GTX1660 

Lingwisyer
Hero

Hm. The OPEN command does post around 80 lines to the Session Report saying that the file is not found which is a bit excessive...

AC22-23 AUS 7000Help Those Help You - Add a Signature
Self-taught, bend it till it breaksCreating a Thread
Win10 | R5 2600 | 16GB | GTX1660 

Still looking?

Browse more topics

Back to forum

See latest solutions

Accepted solutions

Start a new discussion!