element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet & Tria Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • About Us
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      • Japan
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Vietnam
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Autodesk EAGLE
  • Products
  • More
Autodesk EAGLE
EAGLE User Support (English) ULP: Create reliable temp filename for scripts
  • Blog
  • Forum
  • Documents
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Autodesk EAGLE to participate - click to join for free!
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • State Not Answered
  • Replies 19 replies
  • Subscribers 182 subscribers
  • Views 2323 views
  • Users 0 members are here
  • ulp
  • mac
Related

ULP: Create reliable temp filename for scripts

Former Member
Former Member over 12 years ago

Hello,

as far as I understand, the only way to manipulate the data structure of either an eagle schematic, board or library through an ULP is to collect the necessary commands in a text file and execute it using exit ("script <filename>"). This method works as long as there is a suitable filename available that is writeable. On a unix system, this would be somewhere in /tmp, on windows, this would be some other location. I have failed so far to find a way to create a temporary filename that works across all supported operating systems. I suggest to add a function to create a temporary path for exactly that purpose and to document it together with the whole approach of collecting commands to manipulate the data structure in a script and execute that script after the ULP is finished. This would have the other advantage that the script could get deleted after execution because it is intended for a single execution anyway.

 

What do you think about this? Does anyone has a realiable solution to create a temporary filename? I think the currently most used approach is to place the script into the same directory as the currently edited schematic or library. This works because the user usually has the rights to write to the directory of the currently edited file. But I think this is a hack because the file remains after execution and does not belong there. Another interesting idea would be to have a magic filename, for example ":memory" so the commands get stored somewhere in memory, exeuted and never become an object in the users filesystem.

  • Sign in to reply
  • Cancel
Parents
  • Problemchild
    0 Problemchild over 12 years ago

    MD5 or some other hash of say the date is normally quite good.... Unlikely to randomly generate two of these together.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
Reply
  • Problemchild
    0 Problemchild over 12 years ago

    MD5 or some other hash of say the date is normally quite good.... Unlikely to randomly generate two of these together.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
Children
  • Problemchild
    0 Problemchild over 12 years ago in reply to Problemchild

    by date I mean date and time of course. Depending on the rate you are opening files the second time maybe enough but you may need the millisecond timer.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • Former Member
    0 Former Member over 12 years ago in reply to Problemchild

    The problem is not to generate a unique filename but to find path to write to. This is plattform dependant so I cannot just assume /tmp

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube