Home > Community > Forums > Custom IC SKILL > pull down menu with directory contents

Email

* Required Fields

Recipients email * (separate multiple addresses with commas)

Your name *

Your email *

Message *

Contact Us

* Required Fields
First Name *

Last Name *

Email *

Company / Institution *

Comments: *

 pull down menu with directory contents 

Last post Wed, Apr 10 2013 12:17 PM by frogconsultant. 2 replies.
Started by frogconsultant 08 Apr 2013 12:00 PM. Topic has 2 replies and 725 views
Page 1 of 1 (3 items)
Sort Posts:
  • Mon, Apr 8 2013 12:00 PM

    • frogconsultant
    • Top 200 Contributor
    • Joined on Wed, Feb 17 2010
    • Bourron Marlotte, Seine-et-Marne
    • Posts 40
    • Points 605
    pull down menu with directory contents Reply

    Hi All,

     I looked through the community for inspiration on this subject but I cannot find a first step for it. I would like to have a field in one of my menu containing the directory content (list of file) either through a cyclic or pulldown field.

     Does someone could give me an idea of how to grab the content of a directory path through a field menu?

    Regards,

    Filed under: ,
    • Post Points: 20
  • Tue, Apr 9 2013 3:44 PM

    • psill00
    • Top 500 Contributor
    • Joined on Tue, Jan 15 2013
    • Posts 18
    • Points 330
    Re: pull down menu with directory contents Reply

    I am kinda doing this on the fly since this is pieced together. If there is an error post it and we will work through it. This creates or adds to the menus on the CIW. You can do something similar to the layout menus too.

    This setup lists a directory and loads a file when you click on the slider.

     

    Try this:

    Create a ~/menus

    Copy/Paste or create ciw.menus in the ~/menus directory

     daMenu      = '(myMenu "My Stuff" (
                    (trySlider      "Cool Stuff" (
                            (booya1        "Test1" "println(1)")
                            (booya2        "Test2" "println(2)")
                            ))
                    )); end of Utilities menu

    loadFile  = '(lscr "mySkill" (
                    (skLintGui      "Lint"          "skShowForm()")
                    (cdsFind        "cdsFinder"     "startFinder()")
                    (skillIde       "Skill IDE"     "_ilgRunSkillIde()")
                    (refresh        "Refresh List"  "refreshMySkillMenu()")
                    (xscripts       "xScripts File" (
                            (holder "" "")
                            ))
                    (virtuoso       "Virtuoso File" (
                            (holder "" "")
                            ))
                    (bindkey        "Bindkey File"  (
                            (holder "" "")
                            ))
                    )); end of loadFile

    localCiwMenu = '(daMenu loadFile)

    ciwMenuList = append(ciwMenuList localCiwMenu)

     

    -------------------------------------------------------------------------------------------------------------------------------------------

    Another copy and paste file and make sure it loads when you start cadence and execute skForum_custCiwMenuBuild().

    Example of what to put in your ~/.cdsint file

    load("FILE_PATH")

    skForum_custCiwMenuBuild().

    Copy/Paste below:

    procedure(skForum_addFileMenuItems(@optional (bool nil))
    let(    (item fileItem
        (ext ".il$")
        (dir "ADD_YOUR_SKILL_DIRECTORY _HERE")
        )
    foreach(file skForum_sortLastModified(dir ext t)
        item        = car(parseString(file "."))
        fileItem    = hiCreateMenuItem(?name stringToSymbol(item)
                        ?callback  strcat("load(\"" dir file "\")")
                        ?itemText file)
        hiAddMenuItem(xscripts fileItem)
    ); end of foreach
    hiDeleteMenuItem(xscripts 'holder)
    t
    ); end of let
    ); end of skForum_addFileMenuItems

    procedure(skForum_delFileMenuItems()
    let(    (tmp
        )
    unless(member('holder hiGetMenuItems(xscripts))
        tmp = hiCreateMenuItem(?name 'holder ?itemText "tmp" ?callback "xB()")
        hiAddMenuItem(xscripts tmp)
        )

    foreach(item    hiGetMenuItems(xscripts)
        unless(equal(item 'holder) hiDeleteMenuItem(xscripts item))
        )
    t
    )); end of skForum_delFileMenuItems

    procedure(skForum_refreshMySkillMenu() skForum_delFileMenuItems() skForum_addFileMenuItems())

    procedure(skForum_sortLastModified(dir ext sort)
    let(    (fileList vFile tmp len
        )
    foreach(file getDirFiles(dir)
        if(rexMatchp(ext file) fileList = cons(file fileList))
        )
    if(sort then
        vFile    = listToVector(fileList)
        len    = length(vFile)-2
        for(i 0 len
            for(j 0 len
            if(greaterp(fileTimeModified(strcat(dir vFile[j])) fileTimeModified(strcat(dir vFile[j+1]))) then
                tmp        = vFile[j]
                vFile[j]    = vFile[j+1]
                vFile[j+1]    = tmp)
            )
        )
        reverse(vectorToList(vFile))
    else    sort(fileList nil))
    ); end of let
    ); end of skForum_sortLastModified

    procedure(skForum_reloadFile()
    let(    (file
        (dir "ADD_YOUR_SKILL_DIRECTORY_HERE")
        )
    file = car(skForum_sortLastModified(dir ".il$" t))
    printf("Loading file... %s\n" file)
    load(strcat(dir file))
    )); end of skForum_reloadFile

    procedure(skForum_custCiwMenuBuild()
    let(    (item fileItem
        (virt "virtuoso/")
        (bind "bindkeys/")
        (loadDir "ADD_YOUR_SKILL_DIRECTORY _HERE")
        )

    foreach(file skForum_sortLastModified(strcat(loadDir virt) ".il$" nil)
        item        = car(parseString(file "."))
        fileItem    = hiCreateMenuItem(?name stringToSymbol(item)
                        ?callback  strcat("load(\"" loadDir virt file "\")")
                        ?itemText file)
        hiAddMenuItem(virtuoso fileItem)
    ); end of foreach

    foreach(file skForum_sortLastModified(strcat(loadDir bind) ".il$" nil)
        item        = car(parseString(file "."))
        fileItem    = hiCreateMenuItem(?name stringToSymbol(item)
                        ?callback  strcat("load(\"" loadDir bind file "\")")
                        ?itemText file)
        hiAddMenuItem(bindkey fileItem)
    ); end of foreach
    hiDeleteMenuItem(virtuoso 'holder)
    hiDeleteMenuItem(bindkey 'holder)
    t
    ); end of let
    ); end of skForum_custCiwMenuBuild

     

    • Post Points: 20
  • Wed, Apr 10 2013 12:17 PM

    • frogconsultant
    • Top 200 Contributor
    • Joined on Wed, Feb 17 2010
    • Bourron Marlotte, Seine-et-Marne
    • Posts 40
    • Points 605
    Re: pull down menu with directory contents Reply

    Hi

    I tried the first skill. I am not having the extra pulldown or I am not sure I understand the outcome of your first skill.

    Regards, Fabian

    • Post Points: 5
Page 1 of 1 (3 items)
Sort Posts:
Started by frogconsultant at 08 Apr 2013 12:00 PM. Topic has 2 replies.