Jump to content

Text to Callout tool


jamdu

Recommended Posts

@jamdu Let me know what you think of this script.  I think it needs a few tweaks.

  1. It should use the justification of the original text
  2. It should use the font, size, and formatting of the first character.  You can't change formatting within a callout.  Either every character is in italics or none are.
  3. Right now it's destructive.  The original text objects gets deleted.  I think that's the right way to go, but I'm not sure.
  4. Currently the callout is being placed at the text object center.  Should there be associated clicks to place the callout target, but try to keep the text in the same place?
  5. The callout description should be the first whatever it is -42?- characters of the original text.
  6. I doesn't really handle text that is on 3D planes very well.  Not sure how to fix that.

The script posted above has a debugging message that I accidentally left on.  This one doesn't.

text to callout.vwx

  • Like 2
Link to comment

Here is a very basic script that takes the currently selected text block and makes a Callout located at the Top Left corner of the text block bounding box.

 

Extremely lightly test. Use at your own risk. It deletes the text box after it makes the callout.

 

Good Luck.  I don't have time to make the many, many, many modifications that would make this more useful (calculate correct location, rotated text, set Callout properties, etc.) but I many offer suggestions.

 

Procedure TextToCallout;
{©2023  Pat Stanford - pat@coviana.com}
{licensed under the Boost Software License 1.0}
{https://github.com/boostorg/boost/blob/master/LICENSE_1_0.txt}
{TL/DR Use as you want, attribution for source, No warranty}

{Example of making a Callout object from a text block.}
{Very untested. Use with caution. Here by Dragons.}

VAR	H1,H2			:Handle;
	X1,Y1,X2,Y2		:Real;
	S1				:String;
	
BEGIN
	H1:=FSActLayer;
	If GetType(H1)=10 THEN
		BEGIN
			S1:=GetText(H1);
			GetBBox(H1, X1,Y1,X2,Y2);
			H2:=CreateCustomObject('Callout',X1,Y1,0);
			SetRField(H2, 'Callout','Text',S1);
			DelObject(H1);
		End;
End;

Run(TextToCallout);

 

  • Like 1
Link to comment

working on it!

 

I actually manually put in a bunch of values to see if this was even possible.  So this script will always make callouts that are centered, plain text, Arial font, etc.

 

Depending on how things shake out this weekend, I might have it really soon.

 

Or Pat will fix it for me 🙂 

Link to comment

Hey there, that's exactly what I was looking for;)🤗

But...;)There is always a "but"...🙈

Is it possible to make the script work with multiple text objects at once?

My Problem is, that I have a plan with lots of text objects that I would like to get all of them in a worksheet...a callout could do the Job.

 

Thanks in advance

 

Flo

 

 

OK, I managed to edit it by myself;)

 

I added a procedure TXTtoCALL

 

and

 

ForEachObject(TXTtoCALL,((SEL=TRUE) & (T=TEXT)));

Edited by FKA
  • Like 2
Link to comment
  • 5 months later...

@joestewart4669 this should fix it.

 

text to callout 2.vwx

 

PROCEDURE Test;

VAR
	hCallout,hText,Waldo : HANDLE;

	s1 : DYNARRAY[] of CHAR;
	
	fakeName : STRING;
	
	objType : INTEGER;
	
	xx,yy,zz : REAL;
	
	
BEGIN;	
	Locus(0,0);
	Waldo := LNewObj;
	
	hText := PrevSObj(Waldo);
	DelObject(Waldo);
	HCenter(hText,xx,yy);
	fakeName := Date(2,1);
	SetName(hText,fakeName);

	objType := ObjectType(N = fakeName);

	IF objType = 10 
	THEN
		BEGIN
			{AlrtDialog(CONCAT('Objecty Type: ',objtype));}

			s1 := GetText(hText);

			{AlrtDialog(s1);}
			
			hCallout := CreateCustomObject('Callout',0",0",#0.0000000000000d);
			
			Record(LNewObj,'Callout');
			SetRField(LNewObj,'Callout','Link To Database','False');
			SetRField(LNewObj,'Callout','Place As Keynote','False');
			SetRField(LNewObj,'Callout','Keynote Prefix','');
			SetRField(LNewObj,'Callout','Keynote Suffix','');
			SetRField(LNewObj,'Callout','BubbWidth','2"');
			SetRField(LNewObj,'Callout','Vertical Placement','Auto');
			SetRField(LNewObj,'Callout','Orientation','Auto');
			SetRField(LNewObj,'Callout','Left','False');
			SetRField(LNewObj,'Callout','Bubble Style','None');
			SetRField(LNewObj,'Callout','Radius Factor','0.046850393700787"');
			SetRField(LNewObj,'Callout','Margin','0.046850393700787"');
			SetRField(LNewObj,'Callout','Bubble Shadow','False');
			SetRField(LNewObj,'Callout','Shoulder','1''0.000000000000002"');
			SetRField(LNewObj,'Callout','Leader Type','Straight');
			SetRField(LNewObj,'Callout','Leader Style','Line');
			SetRField(LNewObj,'Callout','LineLength','3''7.566053812169748"');
			SetRField(LNewObj,'Callout','__ShowDialog','False');
			SetRField(LNewObj,'Callout','Rise','0.19"');
			SetRField(LNewObj,'Callout','Text',s1);
			SetRField(LNewObj,'Callout','DNE','Solid Arrow\1\-1');
			SetRField(LNewObj,'Callout','TextFont','Arial');
			SetRField(LNewObj,'Callout','TextSize','203.200000');
	SetRField(LNewObj,'Callout','TextStyle','Plain');
			SetRField(LNewObj,'Callout','ControlPoint01X','-6.417885850025682"');
			SetRField(LNewObj,'Callout','ControlPoint01Y','-1''2.1193488700565"');
			SetRField(LNewObj,'Callout','ControlPoint02X','-2''0.387966230097589"');
			SetRField(LNewObj,'Callout','ControlPoint02Y','-1''4.686503210066775"');
			SetRField(LNewObj,'Callout','ControlPoint03X','1''0.000000000000002"');
			SetRField(LNewObj,'Callout','ControlPoint03Y','0"');
			SetRField(LNewObj,'Callout','ControlPoint04X','9''0.046850393700723"');
			SetRField(LNewObj,'Callout','ControlPoint04Y','0"');
			SetRField(LNewObj,'Callout','__dbName','');
			SetRField(LNewObj,'Callout','__dbUUID','');
			(*SetRField(LNewObj,'Callout','__NoteUUID','{9F2CE811-BDA9-4A75-A227-DE086A909B6F}');*)
	SetRField(LNewObj,'Callout','__NoteDescrip','This is a Callout');
			SetRField(LNewObj,'Callout','__KeynoteNumber','0');
			SetRField(LNewObj,'Callout','__OldPlaceAs','False');
			SetRField(LNewObj,'Callout','__OldBubbWidth','2"');
			SetRField(LNewObj,'Callout','__OldShoulder','1''0.000000000000002"');
			SetRField(LNewObj,'Callout','__OldLeaderStyle','');
			SetRField(LNewObj,'Callout','__IsFlipped','False');
			SetRField(LNewObj,'Callout','__isNew','False');
			SetRField(LNewObj,'Callout','__version','2800');
			SetRField(LNewObj,'Callout','__markerCode','1;0;15;0.125000;0.000000;2;2.000000;');
			SetRField(LNewObj,'Callout','Arrow Style','');
			SetRField(LNewObj,'Callout','Marker Symbol','');
			SetRField(LNewObj,'Callout','Marker Scale Factor','0.039370078740157"');
			SetRField(LNewObj,'Callout','MarkerAng','15');
			SetRField(LNewObj,'Callout','Marker Weight','1');
			SetRField(LNewObj,'Callout','__OldCtrlPt03X','304.8');
			SetRField(LNewObj,'Callout','__OldCtrlPt03Y','0');
			SetRField(LNewObj,'Callout','__OldCtrlPt04X','2744.39');
			SetRField(LNewObj,'Callout','__OldCtrlPt04Y','0');
			SetRField(LNewObj,'Callout','Keynote Legend','Default Legend');
			SetRField(LNewObj,'Callout','__OldKeynoteLegend','Default Legend');
			SetRField(LNewObj,'Callout','Leader Radius','0"');
			SetRField(LNewObj,'Callout','OldText',s1);
			SetRField(LNewObj,'Callout','__IsUseReletivePath','False');
			SetRField(LNewObj,'Callout','__DBReletivePath','');
			SetRField(LNewObj,'Callout','Text Angle','0.00°');
			SetRField(LNewObj,'Callout','Rotate Text','False');
			SetRField(LNewObj,'Callout','__OldTextAngle','0.00°');
			SetRField(LNewObj,'Callout','__BubbleShadowPenColor','-3');
			SetRField(LNewObj,'Callout','__BubbleShadowFillColor','-3');
			SetRField(LNewObj,'Callout','HorizontalTextAlignment','Center');
			SetRField(LNewObj,'Callout','New Bubble Style V20','None');
			SetRField(LNewObj,'Callout','New Vertical Placement','Auto');
			SetRField(LNewObj,'Callout','Draw Extended Shoulder','False');
			SetRField(LNewObj,'Callout','Text Style Ref','0');
			SetRField(LNewObj,'Callout','Text Spacing Index','2');
			SetRField(LNewObj,'Callout','Text Spacing Value','0');
			SetRField(LNewObj,'Callout','Leader Angle','-135.00°');
			SetRField(LNewObj,'Callout','__ObjectRotationAngle','0');
			SetRField(LNewObj,'Callout','__DrawTwoSoulders','False');
			SetRField(LNewObj,'Callout','__LeadingLeaderPointX','0');
			SetRField(LNewObj,'Callout','__LeadingLeaderPointY','0');
			SetRField(LNewObj,'Callout','__SecondaryLeaderPointX','2073.75396875');
			SetRField(LNewObj,'Callout','__SecondaryLeaderPointY','0');
			SetRField(LNewObj,'Callout','ControlPoint05X','5''9.64385703740156"');
			SetRField(LNewObj,'Callout','ControlPoint05Y','0"');
			SetRField(LNewObj,'Callout','__OldSecondaryShoulderPointX','1768.95396875');
			SetRField(LNewObj,'Callout','__OldSecondaryShoulderPointY','0');
			
			HMove(hCallout,xx,yy);
			DelObject(hText);
			DelName(fakeName);
		END
	ELSE
		BEGIN
			SysBeep;
			AlrtDialog('No Text Object Selected');
		END;



END;

RUN(Test);

 

Link to comment
  • 1 month 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...