What is the easiest way to include an INCLUDE at the beginning of each MAC routine
I am in the planning stages of making things more uniform in our routines and I would like to know what the easiest way would be to include an .inc at the beginning of each .mac routine. Has anyone written something that would open all routines and place something into the first row while leaving the rest of the routine unchanged? Thanks for any guidance you all may provide.
Comments
You can get list of routines with a query StudioOpenDialog in class %RoutineMgr
To edit routine you have at least two ways. Open it via class %Routine which is just a stream with a code inside. So, you can create a new stream, with a new content, and replace old one. Another way is to use commands: ZLOAD, ZINSERT, ZSAVE.
This does work for intermediate routines; however, it didn't seem to work with MAC routines. Do you know of a method for making changes to the MAC routines?
Hi,
You can do a routine for to do it, for example:
set rou=""for { set rou=$o(^rMAC(rou)) quit:rou="" write !,rou set lines=^rMAC(rou,0,0) for x=lines:-1:2 { set ^rMAC(rou,0,x+1)=^rMAC(rou,0,x) } set ^rMAC(rou,0,2)=$c(9)_"#include %occInclude" set ^rMAC(rou,0,0)=lines+1 set ^rMAC(rou,0)=$now() do COMPILE^%RCOMPIL(rou,"MAC",.success)}Regards
Manel