<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Helvetica,sans-serif;" dir="ltr">
<p>Hi!</p>
<p><br>
</p>
<p>Actually, if you really, really want to be able to have "executable mac files" that are run by Gate without having to explicitly type Gate yourself, then you can use the UNIX shell convention that if the first line in a text file starts with a shebang ("#!")
then the rest of the first line is interpreted as the command that should be used to execute the file. This convention is used e.g. in bash scripts that start with "#!/bin/bash" or python scripts that start with "#!/usr/bin/env python". In order to make that
mechanism work for Gate macros, you need to add the following line as the very first line in your main macro:</p>
<p><br>
</p>
<p>#!/usr/bin/env Gate</p>
<p><br>
</p>
<p>Then if you make the macro file executable (using "chmod a+x mac/main.mac" as described in the link given by the original poster) then you can indeed run the macro like an executable script (enter "./mac/main.mac" in the command line).</p>
<br>
<p>Note:</p>
<ul style="margin-bottom: 0px; margin-top: 0px;">
<li>Of course this trick only works if your shell environment is configured for running Gate. That is, the Gate executable can be found in one of the $PATH directories, and the corresponding "geant4.sh" and "thisroot.sh" have been "sourced".<br>
</li><li>If you put that Gate line on the second, third, etc any other line than the first line of your macro, then it won't work.</li><li>This way you cannot use any other Gate command line arguments on the actual command line. In particular you can't dynamically set aliases with the "-a" option. You could of course still append the "-a" options to the first line, but then you have to change
the file in order to run with different alias values, so you can't call that "dynamically setting" any more. </li><li>Maybe this trick can also help to allow start Gate via "point and click" on a mac file in a file browser. I am not a point-and-click person, I'll leave this as an exercise to whoever is interested in such an interface. This could be nice in combination
with the Qt GUI (use "#!/usr/bin/env Gate --qt" as the first line and make sure that the visualization options are properly set).</li><li>This is just a trick, a curiosity. The normal way to run a Gate macro is still to enter the "Gate [options] yourmacro.mac" in a terminal window.</li></ul>
<div><br>
</div>
<div>Enjoy,</div>
<div>David<br>
</div>
</div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>Von:</b> Gate-users <gate-users-bounces@lists.opengatecollaboration.org> im Auftrag von Maxime Toussaint <Maxime.Toussaint@USherbrooke.ca><br>
<b>Gesendet:</b> Montag, 4. Mai 2020 06:30:25<br>
<b>An:</b> Muhammad Afzaal Sadaqat; Gate-users@lists.opengatecollaboration.org<br>
<b>Betreff:</b> Re: [Gate-users] execution of a file</font>
<div> </div>
</div>
<div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
Greetings,</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
Did you try the suggestion that was given to you last time(26 Jan. 2020) you asked [1]? If yes, was there any problem?</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
Have a nice day,</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
Maxime Toussaint</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
[1] <a href="http://lists.opengatecollaboration.org/pipermail/gate-users/2020-January/011278.html" id="LPlnk328168" style="">http://lists.opengatecollaboration.org/pipermail/gate-users/2020-January/011278.html</a></div>
<div id="appendonsend"></div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>De :</b> Gate-users <gate-users-bounces@lists.opengatecollaboration.org> de la part de Muhammad Afzaal Sadaqat <muhammadafzaalsadaqat786@gmail.com><br>
<b>Envoyé :</b> 3 mai 2020 23:15<br>
<b>À :</b> Gate-users@lists.opengatecollaboration.org <Gate-users@lists.opengatecollaboration.org><br>
<b>Objet :</b> [Gate-users] execution of a file</font>
<div> </div>
</div>
<div>
<div dir="ltr">
<div>Hello, hope you are doing well!</div>
<div>I have installed gate-8.2 in ubuntu 19.10. I am following this link to execute a file
<br>
</div>
<div><a href="https://can01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fsmallbusiness.chron.com%2Fexecute-file-macbook-terminal-49381.html&data=02%7C01%7Cmaxime.toussaint%40usherbrooke.ca%7C8c350b2225474c3de5b508d7efd971db%7C3a5a8744593545f99423b32c3a5de082%7C0%7C0%7C637241589517518031&sdata=sUjqnApJOtJTGvyS2NNJmFElOvR%2F%2ByCaLRW2yREQHfc%3D&reserved=0" originalsrc="https://smallbusiness.chron.com/execute-file-macbook-terminal-49381.html" shash="tjWL0KHtv389BbAkQoFf6OSYoZPi3vw23M2lfOJjOXtJFiza2igm2dYw8ISs4sPTSKuw3Y8EeOcPj7+yduHxUB8hhmsHlXi5KWpVBBeMr3kuoH6Jyfveei0gGsX9O3hGJZo08edPZ3OPXvgbenredfd83kfkRKNlh0qv41IJ10A=">https://smallbusiness.chron.com/execute-file-macbook-terminal-49381.html</a></div>
<div>but i am getting error at the end. I copied the full text below. Need your suggestions to resolve this.</div>
<div>Thanks</div>
<div>afzaal@afzaal-HP-Laptop-15-bw0xx:~$ cd /home/afzaal/Gate-8.2/benchmarks/benchImaging/mac/<br>
afzaal@afzaal-HP-Laptop-15-bw0xx:~/Gate-8.2/benchmarks/benchImaging/mac$ chmod +x ./optical.mac<br>
afzaal@afzaal-HP-Laptop-15-bw0xx:~/Gate-8.2/benchmarks/benchImaging/mac$ ./optical.mac<br>
./optical.mac: line 1: /control/execute: No such file or directory<br>
./optical.mac: line 7: /gate/geometry/setMaterialDatabase: No such file or directory<br>
./optical.mac: line 10: /gate/world/geometry/setXLength: No such file or directory<br>
./optical.mac: line 11: /gate/world/geometry/setYLength: No such file or directory<br>
./optical.mac: line 12: /gate/world/geometry/setZLength: No such file or directory<br>
./optical.mac: line 13: /gate/world/setMaterial: No such file or directory<br>
./optical.mac: line 14: /gate/world/vis/forceWireframe: No such file or directory<br>
./optical.mac: line 15: /gate/world/vis/setColor: No such file or directory<br>
./optical.mac: line 18: /gate/world/daughters/name: No such file or directory<br>
./optical.mac: line 19: /gate/world/daughters/insert: No such file or directory<br>
./optical.mac: line 20: /gate/OpticalSystem/geometry/setXLength: No such file or directory<br>
./optical.mac: line 21: /gate/OpticalSystem/geometry/setYLength: No such file or directory<br>
./optical.mac: line 22: /gate/OpticalSystem/geometry/setZLength: No such file or directory<br>
./optical.mac: line 23: /gate/OpticalSystem/placement/setTranslation: No such file or directory<br>
./optical.mac: line 24: /gate/OpticalSystem/setMaterial: No such file or directory<br>
./optical.mac: line 25: /gate/OpticalSystem/vis/setColor: No such file or directory<br>
./optical.mac: line 26: /gate/OpticalSystem/vis/forceWireframe: No such file or directory<br>
./optical.mac: line 29: /gate/OpticalSystem/daughters/name: No such file or directory<br>
./optical.mac: line 30: /gate/OpticalSystem/daughters/insert: No such file or directory<br>
./optical.mac: line 31: /gate/detector/geometry/setXLength: No such file or directory<br>
./optical.mac: line 32: /gate/detector/geometry/setYLength: No such file or directory<br>
./optical.mac: line 33: /gate/detector/geometry/setZLength: No such file or directory<br>
./optical.mac: line 34: /gate/detector/placement/setTranslation: No such file or directory<br>
./optical.mac: line 35: /gate/detector/setMaterial: No such file or directory<br>
./optical.mac: line 36: /gate/detector/vis/setColor: No such file or directory<br>
./optical.mac: line 37: /gate/detector/vis/forceSolid: No such file or directory<br>
./optical.mac: line 40: /gate/OpticalSystem/daughters/name: No such file or directory<br>
./optical.mac: line 41: /gate/OpticalSystem/daughters/insert: No such file or directory<br>
./optical.mac: line 42: /gate/Electronics/geometry/setXLength: No such file or directory<br>
./optical.mac: line 43: /gate/Electronics/geometry/setYLength: No such file or directory<br>
./optical.mac: line 44: /gate/Electronics/geometry/setZLength: No such file or directory<br>
./optical.mac: line 45: /gate/Electronics/placement/setTranslation: No such file or directory<br>
./optical.mac: line 46: /gate/Electronics/setMaterial: No such file or directory<br>
./optical.mac: line 47: /gate/Electronics/vis/setColor: No such file or directory<br>
./optical.mac: line 48: /gate/Electronics/vis/forceSolid: No such file or directory<br>
./optical.mac: line 50: /gate/systems/OpticalSystem/crystal/attach: No such file or directory<br>
./optical.mac: line 52: /gate/detector/attachCrystalSD: No such file or directory<br>
./optical.mac: line 55: /gate/world/daughters/name: No such file or directory<br>
./optical.mac: line 56: /gate/world/daughters/insert: No such file or directory<br>
./optical.mac: line 57: /gate/waterBox/geometry/setXLength: No such file or directory<br>
./optical.mac: line 58: /gate/waterBox/geometry/setYLength: No such file or directory<br>
./optical.mac: line 59: /gate/waterBox/geometry/setZLength: No such file or directory<br>
./optical.mac: line 60: /gate/waterBox/setMaterial: No such file or directory<br>
./optical.mac: line 61: /gate/waterBox/placement/setTranslation: No such file or directory<br>
./optical.mac: line 62: /gate/waterBox/vis/setColor: No such file or directory<br>
./optical.mac: line 63: /gate/waterBox/vis/forceSolid: No such file or directory<br>
./optical.mac: line 65: /gate/waterBox/attachPhantomSD: No such file or directory<br>
./optical.mac: line 71: /gate/physics/addProcess: No such file or directory<br>
./optical.mac: line 72: /gate/physics/addProcess: No such file or directory<br>
./optical.mac: line 73: /gate/physics/addProcess: No such file or directory<br>
./optical.mac: line 74: /gate/physics/addProcess: No such file or directory<br>
./optical.mac: line 75: /gate/physics/addProcess: No such file or directory<br>
./optical.mac: line 76: /gate/physics/processList: No such file or directory<br>
./optical.mac: line 77: /gate/physics/processList: No such file or directory<br>
./optical.mac: line 83: /gate/actor/addActor: No such file or directory<br>
./optical.mac: line 84: /gate/actor/stat/save: No such file or directory<br>
./optical.mac: line 90: /gate/run/initialize: No such file or directory<br>
./optical.mac: line 93: /gate/detector/surfaces/name: No such file or directory<br>
./optical.mac: line 94: /gate/detector/surfaces/insert: No such file or directory<br>
./optical.mac: line 95: /gate/detector/surfaces/Detection1/setSurface: No such file or directory<br>
./optical.mac: line 96: /gate/Electronics/surfaces/name: No such file or directory<br>
./optical.mac: line 97: /gate/Electronics/surfaces/insert: No such file or directory<br>
./optical.mac: line 98: /gate/Electronics/surfaces/Detection2/setSurface: No such file or directory<br>
./optical.mac: line 104: /gate/digitizer/Singles/insert: No such file or directory<br>
./optical.mac: line 105: /gate/digitizer/Singles/insert: No such file or directory<br>
./optical.mac: line 106: /gate/digitizer/Singles/readout/setDepth: No such file or directory<br>
./optical.mac: line 113: /gate/source/addSource: No such file or directory<br>
./optical.mac: line 114: /gate/source/Mysource/gps/particle: No such file or directory<br>
./optical.mac: line 115: /gate/source/Mysource/gps/monoenergy: No such file or directory<br>
./optical.mac: line 116: /gate/source/Mysource/gps/energytype: No such file or directory<br>
./optical.mac: line 117: /gate/source/Mysource/setActivity: No such file or directory<br>
./optical.mac: line 118: /gate/source/Mysource/gps/polarization: No such file or directory<br>
./optical.mac: line 119: /gate/source/Mysource/gps/type: No such file or directory<br>
./optical.mac: line 120: /gate/source/Mysource/gps/shape: No such file or directory<br>
./optical.mac: line 121: /gate/source/Mysource/gps/radius: No such file or directory<br>
./optical.mac: line 122: /gate/source/Mysource/gps/centre: No such file or directory<br>
./optical.mac: line 123: /gate/source/Mysource/gps/direction: No such file or directory<br>
./optical.mac: line 137: /gate/output/root/enable: No such file or directory<br>
./optical.mac: line 138: /gate/output/root/setFileName: No such file or directory<br>
./optical.mac: line 139: /gate/output/root/setRootHitFlag: No such file or directory<br>
./optical.mac: line 140: /gate/output/root/setRootSinglesFlag: No such file or directory<br>
./optical.mac: line 141: /gate/output/root/setRootOpticalFlag: No such file or directory<br>
./optical.mac: line 144: /gate/output/projection/enable: No such file or directory<br>
./optical.mac: line 145: /gate/output/projection/setFileName: No such file or directory<br>
./optical.mac: line 146: /gate/output/projection/projectionPlane: No such file or directory<br>
./optical.mac: line 147: /gate/output/projection/pixelNumberX: No such file or directory<br>
./optical.mac: line 148: /gate/output/projection/pixelNumberY: No such file or directory<br>
./optical.mac: line 149: /gate/output/projection/pixelSizeX: No such file or directory<br>
./optical.mac: line 150: /gate/output/projection/pixelSizeY: No such file or directory<br>
./optical.mac: line 157: /gate/random/setEngineName: No such file or directory<br>
./optical.mac: line 158: /gate/random/setEngineSeed: No such file or directory<br>
./optical.mac: line 160: /gate/application/setTimeSlice: No such file or directory<br>
./optical.mac: line 161: /gate/application/setTimeStart: No such file or directory<br>
./optical.mac: line 162: /gate/application/setTimeStop: No such file or directory<br>
./optical.mac: line 163: /gate/application/startDAQ: No such file or directory<br>
afzaal@afzaal-HP-Laptop-15-bw0xx:~/Gate-8.2/benchmarks/benchImaging/mac$ </div>
</div>
</div>
</div>
</body>
</html>