Jump to content

Recommended Posts

Hi all. I'm trying to link some text in a symbol to a field of a record format. I've double-triple checked that I have the names of the record format and field correct, but I don't end up with linked fields. I have over 100 fields to link, which is why I'm trying to automate this process. Here's a snippet of the script that's tripping me up:

 

vs.BeginSym("Console Routing")
# some other code #
for chan in range(64):
	vs.CreateText(f'input {str(chan + 1)}')
	vs.LinkText(vs.LNewObj(), "ConsoleRoute", f'Input{chan + 1}')
vs.EndSym()

 

Link to comment

Check that CreateText is actually what is being returned by the LNewObj.

 

After createText add

 

AlrtDialog(Concat(LNewObj, '   ', GetTypeN(LNewObj));l

 

You should get large number which is the handle to the text and the GetTypeN should return 10 if it is a text block.

 

There are some procedures that do create objects but do not properly update LNewObj.

 

If you are not getting the correct text block with LNewObj, search the forum for the Waldo Method.

 

Link to comment
  • 2 weeks later...

This seems to work for me.  I use the Date(2,2) to get a unique symbol name on each run.

 

vs.BeginSym(vs.Date(2,2))
vs.Rect(0,0,1,2)
vs.CreateText('Placeholder')
textHandle=vs.LNewObj()
vs.EndSym()

vs.LinkText(textHandle,'MyRecord','MyField')

vs.Record(vs.LNewObj(),'MyRecord')
vs.Symbol(vs.Date(2,2),0,0,0);
vs.SetRField(vs.LNewObj(),'MyRecord','MyField','Hello')

 

Link to comment

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