• 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. Not getting correct path while using browse button to select...

Stats

  • Locked Locked
  • Replies 15
  • Subscribers 143
  • Views 14695
  • 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

Not getting correct path while using browse button to select directory

saurabh96
saurabh96 over 3 years ago

Hello,

I have made a script to browse directory...but when am selecting the directory ,its creating wrong path to directory 

path_label=hiCreateLabel(
?name 'path_label ?labelText "Path*"
?justification 'left)

path_enter=hiCreateStringField(
?name 'path_enter
?defValue "/pkg/abc/xyz"
)

browse_Entry=hiCreateButton(
?name 'browse_Entry
?buttonText "Browse..."
?callback "ddsFileBrowseCB(hiGetCurrentForm() 'path_enter \"*\" 'directoryOnly)"
)

When am selecting directory /pkg/abc/efg its giving /pkg/.nh/05/efg...that path to directory is wrong and doesn't exist.

IS THERE A WAY WHEN I SELECT ANY DIRECOTRY THROUGH BROWSE OPTION i.e /pkg/abc/klj/ then in text box it automatically comes as realpath of /pkg/abc/klj of this directory?

to avoid above path error

regards,

thomas

  • Cancel
  • Andrew Beckett
    Andrew Beckett over 3 years ago in reply to saurabh96

    Given that your explanation of what you wanted was really unclear, I just focused on illustrating how a callback could be used to change the path, not the precise details of what you wanted (since I didn't know that - you just gave one example of the starting path and what the result would be and no indication of the relationship between the code). I'm not writing your code for you - the point is that you can do whatever string substitution you want in the callback, and you can adapt the idea to whatever you need.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • saurabh96
    saurabh96 over 3 years ago in reply to saurabh96

    Hello Andrew,

    i have tried this way -

    path_label=hiCreateLabel(
    ?name 'path_label ?labelText "Path"
    ?justification 'left)

    path_enter=hiCreateStringField(
    ?name 'path_enter
    ?defValue "/pkg/power/test/check/thomas"
    ?callback "MyTrimPathCB(hiGetCurrentForm())"
    )

    browse_Entry=hiCreateButton(
    ?name 'browse_nxperc_Entry
    ?buttonText "Browse..."
    ?callback "ddsFileBrowseCB(hiGetCurrentForm() 'path_enter \"\" 'directoryOnly)"
    )

    procedure(MyTrimPathCB(form)unless(boundp('MyInCallback) && MyInCallback
    let((pat (MyInCallback t))
    pat=pcreCompile("/[^/]*/[^/]*/[^/]*/[^/]*")
    form->path_enter->value=strcat("/pkg" pcreReplace(pat form->path_enter->value "" 1)

    although from above test script am getting output as /pkg/check/thomas but /pkg is popping in spite when i want field to be empty...

    So , my question is there a way i press browse button then only above string manipulation's should be done otherwise not?

    Regards,
    Thomas

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett over 3 years ago in reply to saurabh96

    The code above doesn't work because the MyTrimPathCB procedure is scrambled (the unless has no space after the close bracket) and has missing close parentheses, but other than that I think I understand what you're saying (the use model is very odd, so I'm having to guess a bit). You don't want the callback firing if you type in the field, but only if you use the browse button?

    If so, you'll have to use something other than ddsFileBrowseCB for the file browser because the callback which updates the path_enter field is built-in and you can't get it to do additional actions. Calling something after the ddsFileBrowseCB won't help because it is non-blocking and returns immediately. The option would be to launch a file browser yourself using hiDisplayFileDIalog and have a callback for that which does the trimming of the path and updating of the field.

    Andrew

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • saurabh96
    saurabh96 over 3 years ago in reply to Andrew Beckett

    Hello Andrew,
    exactly ....above seen is happening ...i don't want callback to be fired i.e.("/pkg") if i type other things in field or if i want field to be empty.

    Andrew, for removing the starting characters or path am using 

    pat=pcreCompile("/[^/]*/[^/]*/[^/]*/[^/]*")

    and for removing back characters we use 

    pat=pcreCompile("/[^/]*/[^/]*$")

    Suppose if i have to remove character's in between … then how should i modify the above line...for eg-
    in "/pkg/thomas/test/cadence/virtuoso/andrew"
    i want only "/pkg/thomas/virtuoso/andrew" how i can get that?

    also can you help me with an example for hiDisplayFileDIalog or any link where i get to understand how to use.

    Thanks in advance,

    regards,

    thomas

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • saurabh96
    saurabh96 over 3 years ago in reply to saurabh96

    Any help/suggestion for above doubts?

    • 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