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
 Macro definitions in ProjectEvents.ogs
 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
162 Posts

Posted - 03/28/2017 :  06:58:02 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Ver. and Service Release: Pro 8.6.0 64-bit SR3 b99
Operating System: Win 7 Pro SP1

Hello,

I define a number of macros in ProjectEvents script (section AfterOpenDoc), however it works only partially - some of the defined macros do not exist after the script execution. If I copy any of the non-executed macro definitions from ProjectEvents and execute it in a command line, everything works fine (i.e., definitions contain no errors).

Are there any limitations on the use of macro definitions in ProjectEvents scripts? What is the most reliable approach to define maсros immediately after the project opening?

Thanks in advance,

Alexei

cpyang

USA
1406 Posts

Posted - 03/28/2017 :  07:30:57 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
define functions instead of macros after @global=1, see

http://www.originlab.com/doc/Quick-Help/Global-Constants

CP
Go to Top of Page

aplotnikov

Germany
162 Posts

Posted - 03/28/2017 :  07:35:43 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Sorry, i haven't mentioned, that the @global-variable was always set to 1. Ok, thanks for advise, I'll try to define functions.

In addition: the use of functions instead of macros does not help. The problem remains.

Edited by - aplotnikov on 03/28/2017 09:14:45 AM
Go to Top of Page

yuki_wu

896 Posts

Posted - 03/29/2017 :  05:10:25 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Alexei,

Firstly, I want to confirm that you have modified and saved the REAL ProjectEvents.ogs file. Please open your project, and then open the Code Builder. In Code Builder, go to Workspace panel, double click the tree node ProjectEvents.OGS to open this file instead of finding it in Text Editor.

If you make sure you have changed to define functions in the real ProjectEvents.ogs file, and the problem hasn’t gone, would you mind sending you OPJ to us for further check? (tech@originlab.com)

Regards,
Yuki
OriginLab
Go to Top of Page

aplotnikov

Germany
162 Posts

Posted - 03/29/2017 :  05:53:42 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Yuki,

Surely it was the REAL ProjectEvents.ogs - I used type -b "..." to control the execution. I found that the problem was caused by a "[Workbook_Name]1!"-construction used to set wks.export-parameters (the workbook name itself does not matter). But if you execute the same code in command line, everything works fine. So, I can simply avoid this construction, but it looks a little bit strange...

Kind regards,

Alexei

Edited by - aplotnikov on 03/29/2017 05:55:37 AM
Go to Top of Page

cpyang

USA
1406 Posts

Posted - 03/29/2017 :  3:46:04 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
If you don't mind, can you share the few line of codes that demonstrate this problem? Basically range defined for a worksheet has issue when called from inside a function?

CP
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