The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
Username:
Password:
Save Password
Forgot your Password? | Admin Options

 All Forums
 Origin Forum for Programming
 LabTalk Forum
 Output limitation for the "type" command
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

aplotnikov

Germany
169 Posts

Posted - 03/03/2018 :  1:17:32 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
OriginPro 8.6.0 64-bit SR3 b.99
Win7Pro

Hi,

I would like to save an object-attached script as a text file using output redirection to a Notes-windows:
type.notes$=strNotesWin$;
type.rediresct=2;
type %(strObjName$).script$;


However the "type" command outputs only the first 3195 characters of the script string whereas "%(strObjName$).script$=;" works correctly.

Is it possible to overcome this limitation? I would appreciate any suggestion.

Regards,

Alexei

PS. The solution with running of object-attached scripts from additional OGS-files is obvious, however I prefer to avoid it if possible keeping everything in a single OPJ-file.

yuki_wu

896 Posts

Posted - 03/05/2018 :  04:03:12 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Alexei,

I am afraid that LabTalk has no method to solve this issue. Would you mind trying OC? I put an example below:

typedef bool (*PFN_get_go_LTScript_event)(GraphObject& go, string& strLTScript, int& nEvent);

void PutGraphObjectScriptToNotes(string strGrObjName, string strNotesName)
{
	Layer lay = Project.ActiveLayer();
	GraphObject go = lay.GraphObjects(strGrObjName);
	Note note(strNotesName);
	if (go && note)
	{
		PFN_get_go_LTScript_event pfn = Project.FindFunction("get_go_LTScript_event", "Originlab\\grobj_utils", true);
		if (pfn)
		{
			string strScript;
			if (pfn(go, strScript, NULL))
				note.Text = strScript;
		}
	}
}


Regards,
Yuki
OriginLab

Edited by - yuki_wu on 03/05/2018 04:32:05 AM
Go to Top of Page

aplotnikov

Germany
169 Posts

Posted - 03/05/2018 :  08:45:19 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Yuki,

thank you very much for the detailed code! The idea is clear (and looks great), however it doesn't work in the case of a text button object (UIM). The tree in the function get_go_LTScript_event does not contain any script node:
Tree tr;
tr = go.GetFormat(FPB_ALL, FOB_ALL, true, true);


Is it a peculiarity of UIM objects?
I would much appreciate for further assistance.

Regards,

Alexei
Go to Top of Page

yuki_wu

896 Posts

Posted - 03/06/2018 :  12:39:49 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Alexei,

I tested this example in Origin 2017 and Origin 2018 with a UIM button. It works.



Not sure if there is a bug in Origin 8.6 since it is too old. Perhaps you should try our new product:

http://www.originlab.com/index.aspx?s=12&lm=62

Regards,
Yuki
OriginLab
Go to Top of Page
  Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000