Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Mach Script Editor and the art of speed programming….

Status
Not open for further replies.

OzzieGeorge

Programmer
Jan 14, 2005
2,603
AU


I thought I would put together a bit of a tutorial on how to get some use out of the Mach script editor and the ability to use the power of Excel to make rapid programming changes. This will probably be of most use to installers but we will discuss possible maintenance uses later.

As an example I’ll outline how to set 1212 for a list of consecutively numbered extensions. It can be as long a list as you want and even if there are a couple missing in the system it doesn’t matter as those lines of code will simply fail.

First open up Excel and in cell B1 type in the start extension number then click on another cell then click back on B1. Use the drag and fill option to fill in the number of cells needed and then select fill series, this will give you your extension list. Whilst this area is highlighted use copy and paste to duplicate the list in column C. Now in cell A1 type 1212 and drag and fill that column for the same number of cells only this time select copy cells. Finally put a * in cell E1 and drag and fill that down the column for the same number of cells as the other columns. You can then modify any odd entries in column C that need to be different (say for example you want to send the main switch number instead of the extension number you would swap the extension number in C to the same number of digits from the end of your main switch number).

So let’s look at what we have done in column A we have put the command we want to use. In column B we have put the first data and in column C we have put the data we want to enter. The star in column E is there to make the script have that many columns as that is what the mach script editor looks for.

If you wanted to you could copy the entries in column B (just highlight the cells not the column then select the blank cell immediately below the current entries and paste the list again then in the A column just below the last entry type 1213 and drag and fill then whatever is needed in column c and extend the stars in E. This would then mean it would programme CMD 1213 as well. I don’t know if there is a limit to the number of lines of script you can generate but I can just about do a full system in this way.

Now we have to get this from Excel and into the Mach script editor. The first thing we do is do a “save as” on the file from the file drop down menu. You can save it as any name you want and anywhere you want but in the save as type box you must select CSV (Comma delimited)(*.csv)
Excel will prompt you to save this under other formats but whether you do or not is up to you.

Now if you are using an older version of Matworx the file is useable as it is. Unfortunately version 6.3 and above needs a different format so we have to manipulate the data a bit, for that we will use Microsoft Word. Using Explorer find the csv file you just created right click on it and select open with then chose program. First making sure that the box for “always use the selected program to open this kind of file” is not ticked select Word. We need to do a couple of replacements so using replace the find will be , (comma) and the replace with will be “,” (quotation marks comma quotation marks) and do replace all. Then do another replace this time the find is ^p (shift6 and lowercase p) the replace is “^p” (quotation marks shift6 and lowercase p quotation marks) then all that is left to do is remove the “ from the end of the file and insert “ as the very first character. I’ve shown the characters in bold here for clarity but they don’t need to be bold. When this is done save the file and you are ready to switch to Matworx.

When you have established a connection to the system click on application and select Mach Script Editor. There are a number of Icon boxes across the middle of the window and the next to last one should be a suitcase like symbol with a right pointing arrow which if you place the mouse pointer over it will show the legend import scripts. Click on this icon and a windows style file browser will appear. Using this select the file you created earlier and click open you can then use the leftmost Icon which looks like an arrow running through three cogs to run the script.

And that is how it is done.

Enough typing for one day I’ll go into maintenance uses another day.
 
Lets look at how the mach script editor can help with maintenance.

If you want you can create your own custom listups and as these scripts can be saved within Matworx they are always readily on hand. Also as Matworx has it’s own find and replace feature you can easily customise these scripts each time you want to use them. So for example if you wanted to look up all the 12xx commands for a given extension you could start in Excel with cell A1 and type 1200 then using the drag and fill feature as explained earlier you can extend this down the column to whatever number you want to go up to (1290 is the highest on the IPS). I would then delete out the numbers not used eg. 51-89. then in column B1 type *** (three stars) then in column E put a * (star) you can then highlight B1 to E1 and drag and fill down the column. If you then save this and modify it as above you can import it into Matworx. If you are going to use this regularly you can save this using the icon with the floppy disk and left pointing arrow. When you save it you can also save a description of what it does. Once saved you can get it back any time by using the open scripts icon (the floppy disk with the right pointing arrow).

Now to use this script select the Binoculars icon at the top of the Mach script editor window to do a find and replace the find being *** (three stars) and the replace being the extension number you want, run the script (you will be prompted that the pbx will be modified, but as we have not put any data in column C whilst preparing it in Excel there is no second data for it to modify it with). When it completes you will see that the column “sd” in Matworx has been filled in by the system with the existing data. This can be exported back to excel or simply printed out if you wish. The interesting Idea here is if you have a faulty len and wanted to move this data all you would need to do is minimise this window, use moc mode to change the extension number to where you want it then maximise the window again and re-run the script. Because the script now has the data it got from the first run in the “sd” column it will write that data to the extension in the new location.

There are further uses which make life so much easier once you are able to use formulas in Excel to create scripts. I have seen a program used by NEC which takes all user data supplied by the customer plus a face layout and writes all CMDs 10,11,12xx,13xx,16,73,90xx,93,94,720,721,770 and produces the records all in a couple of minutes but that is apparently done using macros, they even have a macro that does away with the need for the Word step when creating the script. I won’t try to go that far.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top