• Skip to main content
  • Skip to search
  • Skip to footer
Cadence Home
  • This search text may be transcribed, used, stored, or accessed by our third-party service providers per our Cookie Policy and Privacy Policy.

  1. Community Forums
  2. Custom IC SKILL
  3. Exit procedure and/or script

Stats

  • Locked Locked
  • Replies 4
  • Subscribers 143
  • Views 3009
  • Members are here 0
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Exit procedure and/or script

netbug
netbug over 8 years ago

Dear all,

I have a script that, the first time is used,asks the user to enter the directory where he wants to save his files.This path is stored into a config file (config.txt).

Next time the script is called, in first place it will check if a config file exists, if it doesn't it creates a new one, otherwise will use the one that is store on the hdd.

However, if the user wants to change the path where his plots are going to be saved, the user can call the menu to enter a new path and,as a consequence, the old config file will be delete and a new one written. The problem arises if the user invokes the menu and then hits the cancel button. Despite the cancel button has been pressed the file will be erased !

So I would like to exit the procedure and/or the script whenever the cancel button is pressed.

 

The user menu is called automatically if there is no config file, or if the user wants to open it., pressing "j".

;==============================================================================
;======================  Function called when "j" is pressed  =================
;==============================================================================
procedure(displayMenu()
      let((ConfigFileLocation)
        ; Default Config File location
        ConfigFileLocation="~/config.txt"

        ; Create form
        createMainForm()
        
        ; Delete config.txt
        deleteFile(ConfigFileLocation) ; deletes de config file
        printf("File Deleted !!")        
        ; Save data to config.txt
        save2config(ConfigFileLocation) ;saves a new config file

      )
)      

;==============================================================================
;=====================  Actions to take when cancel is pressed ================
;==============================================================================
procedure(testCancel()
  dispMessage("Cancel button pressed")
  println("Cancel button: Pressed !!")
 
)

Thanks in advance.

Best regards,

Pedro

  • Cancel
  • skillUser
    skillUser over 8 years ago
    Hi Pedro,
    Can't you make the delete operation (etc.) part of the Apply/OK button flow, rather than with just displaying the form? You can set a different cancel action (to the Apply/OK button) if needed, for the Cancel button.
    Regards,
    Lawrence.
    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • netbug
    netbug over 8 years ago
    Hi skillUser,
    Thanks a lot your solution worked like a charm.
    I've placed the delete instruction inside the CB for the OK button and now only deletes the config file if OK is pressed :-).
    Cheers,
    Pedro
    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • netbug
    netbug over 8 years ago
    Hi,
    Just one more question. If I have more than on Cadence session opened, how can I use the script on both ? As the config file is unique, both sessions will be writing, deleting and changing the file. Any ideas ?
    I thought of creating different config files per session, generating an unique id that identifies that session, for eg. config_some_indentifier.txt. Which could that identifier be ?
    Best regards,
    Pedro
    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett over 8 years ago

    See 

    Andrew Beckett
    Replied to: Identify uniquely a session
    Hi Pedro, You could use getCurrentTime(), ipcGetPid() to get the current time or process id respectively if you want it to be meaningfully named, or you could use makeTempFileName() to make the filename…
    By Andrew Beckett over 8 years ago in Cadence Technology Forums > Custom IC SKILL

    Regards,

    Andrew.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel

Community Guidelines

The Cadence Design Communities support Cadence users and technologists interacting to exchange ideas, news, technical information, and best practices to solve problems and get the most from Cadence technology. The community is open to everyone, and to provide the most value, we require participants to follow our Community Guidelines that facilitate a quality exchange of ideas and information. By accessing, contributing, using or downloading any materials from the site, you agree to be bound by the full Community Guidelines.

© 2025 Cadence Design Systems, Inc. All Rights Reserved.

  • Terms of Use
  • Privacy
  • Cookie Policy
  • US Trademarks
  • Do Not Sell or Share My Personal Information