Question 0n #Events

This is where you talk about Macros, show examples of your macro scripting and SHARE handy segments of script code as examples.

Question 0n #Events

Postby Vmax549 » Thu Feb 08, 2018 3:36 am

I have a string above teh #Events section and a string below teh #Event section and I want to combine teh strings.

string dxf1 = "Test1";

#Events

String dxf2 = "Test2";

string DXF = dxf1 + dxf2 does not work as it cannot see teh dxf1 string.

How do I get it to recognize teh dxf string above teh #Events line ?
Vmax549
 
Posts: 1312
Joined: Sun Nov 22, 2015 3:25 am
Location: USA

Re: Question 0n #Events

Postby cncdrive » Thu Feb 08, 2018 4:04 am

The dxf1 in your example is not seen in the #Events because it is a local variable to the macro.
The dxf2 is global, because it is in the #Events.

You can move the dxf1 definition to the #Events and then both will be visible in both the #Events and also in the macro above the #Events.
In other words all variables which you want to be globally visible for both the macro and also for the #Events then you have to define the variable global and that can be done with defining it under the #Events.
cncdrive
Site Admin
 
Posts: 2263
Joined: Tue Aug 12, 2014 11:17 pm

Re: Question 0n #Events

Postby Vmax549 » Thu Feb 08, 2018 5:06 am

Thanks,(;-)
Vmax549
 
Posts: 1312
Joined: Sun Nov 22, 2015 3:25 am
Location: USA


Return to Macros

Who is online

Users browsing this forum: No registered users and 3 guests

cron