NS3 Macros
Jeff
Junior Member
OK, so now I have macros. What are people using them for, any ideas? I've never been a programmer outside of AMX, so this is an entirely new concept for me and I'm having trouble coming up with a use for them.
J
J
Comments
-
I use the same format and variables for most functions and buttons presses I do, so I have a macro that creates them for me. Also saved some channel lineups in there.
Example of my Button Macro:
//
BUTTON_EVENT[dvTP, ]
{
PUSH:
{
STACK_VAR INTEGER nBtnIdx, nPnlIdx
nBtnIdx = GET_LAST()
nPnlIdx = GET_LAST(dvTP)
//
}
}
Now just fill in the blanks.. -
I use functions all the time for formatting code, variables, etc. Say I want to insert a prefix to a bunch of constants, I can make a macro that does that.
Or I copy and paste a channel line up, I can go through and format them into a constant array by making a macro. -
How about :
Build Active System -> File Transfer
I have one hot key to compile then bring up the file transfer window.
(I got that from that other control company.) -
gary_cummins wrote: »How about :
Build Active System -> File Transfer
I have one hot key to compile then bring up the file transfer window.
(I got that from that other control company.)
I still always do the 'right click' over the code to build active system. And I typically have 4 or 5 systems in file transfer. I need to look at which one is active so I don't accidentally send the code and reboot the wrong master.
I've never really used any macros myself. -
Without drifting too far from the thread topic, I must applaud NSX3. This is such a great leap forward in my view. Awesome new features and bug fixes. Congrats to all.
It seems that if you create a macro and utilise autocomplete, the macro does not accept the entry.
For example, if you start recording and want to create, say, a basic define_call chunk of code for example, you would obviously type:
de (for define) and autocomplete would allow you select define_call. If you hit enter, the editor sees the whole define_call entry, but it is not recorded in the macro - only de. -
Interesting ... I never use "Build Active System" at all. I compile all my modules separately, and only the ones that actually changed, then the main program. I find it quicker and easier in the field not to have to wait for it to work through every component of the program when I only made a minor change.
I would use macros more for complex repetitive editing, for example, going through the code and replacing all the send commands to a particular device with a function call; anything that can't easily be done with a simple search-and-replace. -
Macro - Insertion and formating strings
I tend to document my routines prior to coding, so I've found the copy - paste and format possibilities of the Macro feature very handy.
Paste a list into the code,
PC39
PC40
copy the struture assignment, sCntrDev.cDevice_Name[156] =
position the cursor in front of the first line, then turn on the macro record -
, paste,
sCntrDev.cDevice_Name[156] = PC39
PC40
add single quote since the paste leaves the cursor at the end of the paste
sCntrDev.cDevice_Name[156] = 'PC39
PC40
, endofline add single quote,add ; HOME, down arrrow - stop macro record.
sCntrDev.cDevice_Name[156] = 'PC39';
PC40
Then all I have to do is hit the play current macro, and it walks down the list making the assignments. With the renumber command, I change all the array values in sequence and I have everything done in a few minutes.
sCntrDev.cDevice_Name[39] = 'PC39';
sCntrDev.cDevice_Name[40] = 'PC40';
Haven't tried anything real complex yet, but it's a win already.
ROO -
If you need macros to write code then you are writing too much code

Paul
Categories
- All Categories
- 2.5K AMX General Discussion
- 922 AMX Technical Discussion
- 514 AMX Hardware
- 502 AMX Control Products
- 3 AMX Video Distribution Products
- 9 AMX Networked AV (SVSI) Products
- AMX Workspace & Collaboration Products
- 3.4K AMX Software
- 151 AMX Resource Management Suite Software
- 386 AMX Design Tools
- 2.4K NetLinx Studio
- 135 Duet/Cafe Duet
- 248 NetLinx Modules & Duet Modules
- 57 AMX RPM Forum
- 228 MODPEDIA - The Public Repository of Modules for Everyone
- 943 AMX Specialty Forums
- 2.6K AMXForums Archive
- 2.6K AMXForums Archive Threads
- 1.5K AMX Hardware
- 432 AMX Applications and Solutions
- 249 Residential Forum
- 182 Tips and Tricks
- 146 AMX Website/Forums