EAGLE Central Forums
Where the EAGLE community meets. Sponsored by Stratford Digital.

Home » CadSoft Support Forums » eagle.userchat.eng » local/user information in a ULP?
local/user information in a ULP? [message #168152] Thu, 22 December 2016 18:27 Go to next message
Chris Styles
Messages: 14
Registered: September 2006
Junior Member
HI All,

I have scanned the extensive ULP documentation, i could well have missed it, but I have not been able to find any way for a ULP to access information about Eagle revision number, registered user, serial number, etc etc.

I'm doing some experiments with ULPs, never written them before, and the ability to understand who exactly is running the ULP would be pretty useful!

Any hints/tips appreciated..

Cheers,
Chris

--
To view any images and attachments in this post, visit:
https://www.element14.com/community/message/211653
Re: local/user information in a ULP? [message #168153 is a reply to message #168152] Thu, 22 December 2016 19:10 Go to previous messageGo to next message
rk
Messages: 386
Registered: February 2005
Senior Member
Hi Chris,

an ULP does not have registration information accessible, but you have
access to EAGLE's version numbers through some predefined constants.
You'll find these constants in the HELP under "User Language" ->
"Builtins" -> "Builtin Constants", for example:

string s;
sprintf(s, "%d.%d", EAGLE_VERSION, EAGLE_RELEASE);
dlgMessageBox(s);

dlgMessageBox(EAGLE_SIGNATURE);


Rene
Re: local/user information in a ULP? [message #168154 is a reply to message #168153] Thu, 22 December 2016 19:24 Go to previous messageGo to next message
Chris Styles
Messages: 14
Registered: September 2006
Junior Member
Thanks for the rapid reply!

Too bad I can't get at the serial number, as that would uniquely identify the installation, while maintaining anonymity...

While I am here, are there any plans to add "version" properties to sch, brd and library files? Another built in variable that can be set/seen in the UI, or munged directly in the XML if needed?

im really interested in starting a trial with cadlab.io ... looks like we're thinking along similar lines...

Cheers,
Chris

--
To view any images and attachments in this post, visit:
https://www.element14.com/community/message/211665
Re: local/user information in a ULP? [message #168155 is a reply to message #168154] Thu, 22 December 2016 21:31 Go to previous messageGo to next message
rk
Messages: 386
Registered: February 2005
Senior Member
Am 22.12.2016 um 20:24 schrieb Chris Styles:
> While I am here, are there any plans to add "version" properties to sch, brd and library files? Another built in variable that can be set/seen in the UI, or munged directly in the XML if needed?

Not for the library, but for the schematic and board you can add such
information right now, through global ATTRIBUTEs. But keep in mind that
global ATTRIBUTEs aren't really global - they are local to the drawing
you're editing. An ATTRIBUTE added to the schematic is not visible in
the board and vice versa.

Rene
Re: local/user information in a ULP? [message #168156 is a reply to message #168154] Thu, 22 December 2016 21:50 Go to previous message
warrenbrayshaw
Messages: 1756
Registered: January 2010
Location: New Zealand
Senior Member
Chris Styles wrote on Fri, 23 December 2016 08:24
Thanks for the rapid reply!

Too bad I can't get at the serial number, as that would uniquely identify the installation, while maintaining anonymity...

Cheers,
Chris

--
To view any images and attachments in this post, visit:
https://www.element14.com/community/message/211665


The ULP command "system()" may provide a solution for you.
As an example, if your computer names provide anonymity you can get the computer name via the command "system()" command. The following ULP targets the computer name in a Windows system via the Windows cmd.exe
The attached could be the basis of an #include ULP that is included with each of your custom ULPs.
The idea could be extended to acquire any info you required from the OS. Alas there may be a speed penalty for the primary ULP being run.

string myFile = "eagleULP_MyComputerName.txt";
string myPath,syscmd,myPathFile,hostname;
string line[];

if(board) board(B){myPath = filedir(B.name);}
if(schematic) schematic(S){myPath = filedir(S.name);}
if(library) library(L){myPath = filedir(L.name);}
myPathFile = myPath + "/" + myFile;

//create file that will be overwritten with each run of this ulp and removed when Eagle is closed
output( myPathFile,"wtD");

sprintf(syscmd,"cmd.exe /q/c hostname > %s",myPathFile); //prep to call Windows cmd.exe
system(syscmd); //place computer name into file

//read computer name from file
fileread(line,myPathFile);
hostname = line [0];
//display computer name
dlgMessageBox(hostname);
exit(0);


HTH
Warren
Previous Topic: What revision/version control do you use for EAGLE files?
Next Topic: Unable to delete certain object.
Goto Forum:
  


Current Time: Fri Jul 21 20:48:13 GMT 2017