How can I display the system name in an Amibroker report chart?

Good evening! I'm trying to make a report chart in Amibroker display the name of the system I'm running.

I've noticed that I can do it directly by modifying the AFL of the report charts, but I have to change it every time I run a new system. Is there a way to indicate the system name in the AFL of the system itself and have the report chart AFL retrieve that name?

I can't find a way to create a variable that can be retrieved from Report Charts. Does anyone know where I can find more information?

You can save a static variable in your main AFL and retrieve it in the Report Chart AFL.

1 Like

Alternatively to keep hostname capturing dynamic, using AmiPy plug-in (thanks to @Kuba).

Place a Python file maybe in C:\Program Files\AmiBroker\Scripts named as

import os
def hostname():
    return os.environ[ 'ComputerName' ]

Then from AFL:

hostnamePyFile = "C:\\Program Files\\AmiBroker\\Scripts\\";
PyLoadFromFile( "toGetHostname", hostnamePyFile );
hostname = PyEvalFunction( "toGetHostname", "hostname" );
1 Like

He obviously is talking about trading system name not computer name.

Besides there is not python and plugin required to just get computer name.
Just single ShellExecute line of AFL.

if ( ParamTrigger("Get Computer Name", "CLICK") ) 
	ShellExecute( "cmd", "/k hostname", "" ); 

Or to store one may use OLE

if ( ParamTrigger("Get Computer Name", "CLICK") ) {
	net = CreateObject("WScript.Network");
	ComputerName = net.ComputerName;

This is the function to use: GetFormulaPath()


This topic was automatically closed 100 days after the last reply. New replies are no longer allowed.