Can a macro written for mac be used on windows as well?

Hi,

There was a kymograph macro(written for Mac) used in an article published on JCB 2014. We happened to do the experiments and would like to use the macro to analysis some images. But it seems not to be run on the Windows system.

Part of the macro:

{\rtf1\ansi\ansicpg1252\cocoartf1265\cocoasubrtf200
{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
{\colortbl;\red255\green255\blue255;}
\margl1440\margr1440\vieww10800\viewh8400\viewkind0
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\pardirnatural

\f0\fs24 \cf0 
\
 // image pixel information
\
 var x_dim, y_dim, t_dim, x_unit, y_unit, t_unit, dendrite_length, mito_number, kymo_minInt;
\
 // parameters
\
 var speed_limitL, speed_limitH, max_time, cal_gap, adjust;
\
 // showing image IDs
\
 var ID_mito, ID_show, ID_kymo;
\

\
 // X Y position of each track point( drew in Kymo.ijm) 
\
 var coor_X=newArray(1000), coor_Y=newArray(1000), kymo_length;
\

\
 // X Y position of each track at time point, for selected point in kymo graph at (x,t), 
\
 //the corresponding xy position in real image is posX[t]=coor_X[x], posY[t]=coor_Y[x]
\
 var posX=newArray(400), posY=newArray(400);
\

\
 // x y position of individual mito track in Kymo graph.
\
 // x value is used to extract X Y position in real image based on coor_X. coor_Y array
\
 var tmpX=newArray(400), tmpY=newArray(400);
\

\
 // start : start time point of selected mito track,  t_duration  number of time points for the mito track
\
 var start=0,  end=0, t_duration=0;
\
 var total_mito=0, mito_count, flag;
\

\
 // showing image IDs
\
 var ID_mito, ID_show,ID_kymo;
\
  
\
 // for use of mouse cursor track
\
 leftButton=16;  rightButton=4;  shift=1;  ctrl=2; alt=8; x2=-1; y2=-1; z2=-1; flags2=-1; logOpened = false;     
\
  
\
 //------------------------------- start main function -------------------------------------
\

\
 Dir=getDirectory("Choose result Directory");
\

\
 parameter();
\
 start_up();
\
 get_info();
\

\
 // print summary file
\
 run("Text Window");
\
...

I put it onto Fiji by drag-and -drop then ran it. Following is a “Macro error” popped up, it showed

Statement cannot begin with '\' in line 2.
{<\> rtf \ansi\ansicpg1252\cocoartf1265\cocoasubrtf200

Is the script for mac different from that for windows? Please Mac experts have a look at those lines and give me a hint how to let this macro work on the windows system. Thanks in advance.

Best,
chin

ImageJ macro code is platform-independent and runs on Windows just as well as on Mac OSX.

The problem in your case seems to be that the original macro code seems to have been saved in some other file format (presumably rich text format, rtf, judging from the first few lines) and you probably tried to open it as plain text (such as opening it in the script editor). In the above form, you code won’t run on any platform.

You can try renaming the file with .rtf extension, opening it in Notepad on Windows, and copy-pasting the code into the Fiji script editor.

From your code above, these are the lines that look like macro language:

// image pixel information
var x_dim, y_dim, t_dim, x_unit, y_unit, t_unit, dendrite_length, mito_number, kymo_minInt;
// parameters
var speed_limitL, speed_limitH, max_time, cal_gap, adjust;
// showing image IDs
var ID_mito, ID_show, ID_kymo;

// X Y position of each track point( drew in Kymo.ijm) 
var coor_X=newArray(1000), coor_Y=newArray(1000), kymo_length;

// X Y position of each track at time point, for selected point in kymo graph at (x,t), 
//the corresponding xy position in real image is posX[t]=coor_X[x], posY[t]=coor_Y[x]
var posX=newArray(400), posY=newArray(400);

// x y position of individual mito track in Kymo graph.
// x value is used to extract X Y position in real image based on coor_X. coor_Y array
var tmpX=newArray(400), tmpY=newArray(400);

// start : start time point of selected mito track,  t_duration  number of time points for the mito track
var start=0,  end=0, t_duration=0;
var total_mito=0, mito_count, flag;

// showing image IDs
var ID_mito, ID_show,ID_kymo;
  
// for use of mouse cursor track
leftButton=16;  rightButton=4;  shift=1;  ctrl=2; alt=8; x2=-1; y2=-1; z2=-1; flags2=-1; logOpened = false;     
  
//------------------------------- start main function -------------------------------------

Dir=getDirectory("Choose result Directory");

parameter();
start_up();
get_info();

// print summary file
run("Text Window");
...
3 Likes

Hi Jan Eglinger,

Thank you for your explanation.

I opened it (.txt) in WordPad directly on Windows without changing the extension. The begining line is:

// image pixel information
 var x_dim, y_dim, t_dim, x_unit, y_unit, t_unit, dendrite_length, mito_number, kymo_minInt;

And those lines disappeared:

{\rtf1\ansi\ansicpg1252\cocoartf1265\cocoasubrtf200
{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
{\colortbl;\red255\green255\blue255;}
...

Finally, the macro can be run on Fiji.

2 Likes