How to Access "My DAZ 3D Library" from Script in Daz Studio?

MaX PupkinMaX Pupkin Posts: 49

Hello everyone,

I'm writing a script for Daz Studio that allows quick navigation to specific folders in the Content Library pane.
So far, everything works fine when accessing folders under "My Library" — for example, paths like People/Genesis 8 Female/Clothing are correctly found and opened.

However, I’ve run into a problem: when I try to access the "My DAZ 3D Library" (located by default at C:/Users/Public/Documents/My DAZ 3D Library), the script does find the path, but the Content Library does not switch to it. No errors are shown, but nothing happens.

What I’ve tried:
Using browseToNativeFolder() with both relative and full paths.

Calling browseToIDPath() with arrays like ["DAZ Studio Formats", "My DAZ 3D Library", "People", "Genesis 8 Female", "Clothing"].

Getting the correct content base path using getContentDirectoryPath(libIndex) where libIndex = 1.

Confirming that the directory does exist using DzDir.exists() — and it does.

Alternative methods like browseToProduct, App.getContentMgr(), and so on — none of them work to activate or open the location inside the UI.

All of these work as expected for "My Library", but do not for "My DAZ 3D Library".

My question:
Is there a reliable way to programmatically browse to folders inside "My DAZ 3D Library" from a DAZ Script?

Am I missing a special format or function required for that library?
Any working example, suggestion, or workaround would be greatly appreciated!

Thanks in advance for your help and time.

 

var PATH_GROUPS = [
  {
    title: "My Library",
    libIndex: 0,
    entries: [
      { label: "G8F Clothing", path: "People/Genesis 8 Female/Clothing", method: "native" },
      { label: "G8M Clothing", path: "People/Genesis 8 Male/Clothing", method: "native" },
      { label: "G8F Poses", path: "People/Genesis 8 Female/Poses", method: "native" },
      { label: "G8M Poses", path: "People/Genesis 8 Male/Poses", method: "native" }
    ]
  },
  {
    title: "My DAZ 3D Library",
    libIndex: 1,
    entries: [
      { label: "G8F Clothing", path: "People/Genesis 8 Female/Clothing", method: "native" },
      { label: "G8M Clothing", path: "People/Genesis 8 Male/Clothing", method: "native" }
    ]
  }
];

function openPane() {
  var pm = MainWindow.getPaneMgr(),
      p = pm.findPane("DzContentLibraryPane");
  if (p) {
    pm.showPane(p);
    p.setVisible(true);
    print("Content Library shown");
  } else {
    MessageBox.warning("Content Library pane not found.", "Warning", "OK");
  }
}

function assertPath(pathRel, libIndex) {
  var cm = App.getContentMgr(),
      base = cm.getContentDirectoryPath(libIndex),
      full = base + "/" + pathRel,
      exists = new DzDir(full).exists();
  print("Check:", full, "exists?", exists);
  return { exists: exists, base: base, full: full };
}

function jump(pathRel, libIndex, method) {
  var pane = MainWindow.getPaneMgr().findPane("DzContentLibraryPane");
  if (!pane) return;

  var info = assertPath(pathRel, libIndex);
  if (!info.exists) {
    return MessageBox.information("Folder not found:\n" + info.full, "Not Found", "OK");
  }

  try {
    if (method === "native") {
      pane.browseToNativeFolder(pathRel, true);
    }
    pane.refresh();
    print("Jumped via:", method);
  } catch (e) {
    MessageBox.critical("Error: " + e, "Jump Failed", "OK");
  }
}

function showDialog() {
  openPane();
  var dlg = new DzBasicDialog();
  dlg.caption = "Quick Jump";
  dlg.setFixedWidth(300);
  dlg.addSpacing(6);

  for (var g = 0; g < PATH_GROUPS.length; g++) {
    var group = PATH_GROUPS[g];
    var lbl = new DzLabel(dlg);
    lbl.text = "<div align='center'><b>" + group.title + "</b></div>";
    dlg.addWidget(lbl);

    for (var e = 0; e < group.entries.length; e++) {
      (function(entry) {
        var btn = new DzPushButton(dlg);
        btn.text = entry.label;
        btn.clicked.connect(function() {
          jump(entry.path, group.libIndex, entry.method);
        });
        dlg.addWidget(btn);
      })(group.entries[e]);
    }

    dlg.addSpacing(5);
  }

  dlg.exec();
}

showDialog();

Post edited by MaX Pupkin on

Comments

  • MaX PupkinMaX Pupkin Posts: 49

    Richard Haseltine said:

    Why not use http://docs.daz3d.com/doku.php/public/software/dazstudio/4/referenceguide/scripting/api_reference/object_index/contentmgr_dz#a_1aef29793c065994572cc7fa8e9be961d1 to get the count and then http://docs.daz3d.com/doku.php/public/software/dazstudio/4/referenceguide/scripting/api_reference/object_index/contentmgr_dz#a_1a1740a91a0d8d45ab86491fa8bd46ff73 to iterate over the list, using http://docs.daz3d.com/doku.php/public/software/dazstudio/4/referenceguide/scripting/api_reference/object_index/contentfolder_dz#a_1a4ebc7bf898ba8f67cbacd65f5ad00116 to find the folder of interest (or make the script more genral and simply check them regardless of name).

    Need Help Accessing "My DAZ 3D Library" via Script

    Hello again, and thank you for the suggestions earlier.

    I’ve followed the advice given in this thread and tried all the suggested methods using the ContentMgr and ContentFolder API:

    • getContentDirectoryCount()
    • getContentDirectoryPath(index)
    • getFolderCount() + getFolder(index)
    • findFolder()

    For each of these, I verified that the path does exist, for example:

    Path exists: true, Path: C:/Users/Public/Documents/My DAZ 3D Library/People/Genesis 8 Female/Clothing

    I also tested:

    • browseToNativeFolder(path)
    • browseToIDPath()
    • browseToProduct()
    • setPrimaryLibraryPath() and similar (though these were undefined in my context)

    Each method confirms that the folder exists and even logs "Jumped to..." – but nothing visibly changes in the Content Library pane. It appears that the jump silently fails or is ignored for "My DAZ 3D Library" (libIndex = 1).

    However, jumping to folders inside "My Library" (libIndex = 0) works perfectly.

    Tested Example (Jumping via Native Folder)

    var oPane = MainWindow.getPaneMgr().findPane("DzContentLibraryPane");var oContentMgr = App.getContentMgr();var path = oContentMgr.getContentDirectoryPath(1) + "/People/Genesis 8 Female/Clothing";if (new DzDir(path).exists()) {    oPane.browseToNativeFolder(path, true);    print("Jumped to: " + path);} else {    MessageBox.information("Path does not exist: " + path, "Error", "OK");}

    Log says:

    Jumped to: C:/Users/Public/Documents/My DAZ 3D Library/People/Genesis 8 Female/Clothing

    But the UI doesn't change — nothing happens.

    Question

    Is there any special consideration needed for accessing the My DAZ 3D Library via script? Is there a workaround or hidden requirement?

    Thanks again for your time and help!

  • MaX PupkinMaX Pupkin Posts: 49
    edited June 29

    DAZ Script: Quick Folder Jump with Multiple Methods

    I'm trying to programmatically jump to specific folders inside both My Library and My DAZ 3D Library from a custom script. While folders inside My Library work perfectly, I'm having trouble getting My DAZ 3D Library paths to work — even though the folders exist and are confirmed as valid.

    Below is a full DAZ Studio script I've prepared. I would appreciate it if someone could verify if any of the methods used here work in your setup and let me know if there's something wrong with how I'm addressing the second library.

     Script 

    var PATH_GROUPS = [  {    title: "My Library",    libIndex: 0,    entries: [      { label: "G8F Clothing", path: "People/Genesis 8 Female/Clothing", method: "native" },      { label: "G8M Clothing", path: "People/Genesis 8 Male/Clothing", method: "native" },      { label: "G8F Poses", path: "People/Genesis 8 Female/Poses", method: "native" },      { label: "G8M Poses", path: "People/Genesis 8 Male/Poses", method: "native" }    ]  },  {    title: "My DAZ 3D Library",    libIndex: 1,    entries: [      { label: "G8F Clothing", path: "People/Genesis 8 Female/Clothing", method: "nativeFull" },      { label: "G8M Clothing", path: "People/Genesis 8 Male/Clothing", method: "nativeFull" }    ]  },  {    title: "Test Methods for DAZ 3D Library",    libIndex: 1,    entries: [      { label: "Test: Native", path: "People/Genesis 8 Male/Clothing", method: "nativeFull" },      { label: "Test: IDPath", path: "People/Genesis 8 Male/Clothing", method: "idpath" },      { label: "Test: Native Full Path", path: "People/Genesis 8 Male/Clothing", method: "nativeFull" }    ]  }];function openPane() {  var pm = MainWindow.getPaneMgr();  var p = pm.findPane("DzContentLibraryPane");  if (p) {    pm.showPane(p);    p.setVisible(true);    print("Content Library shown");    return p;  } else {    MessageBox.warning("Content Library pane not found.", "Warning", "OK");    return null;  }}function assertPath(pathRel, libIndex) {  var cm = App.getContentMgr();  var base = cm.getContentDirectoryPath(libIndex);  var full = base + "/" + pathRel;  var exists = new DzDir(full).exists();  print("Check:", full, "exists?", exists);  return { exists: exists, base: base, full: full };}function jump(pathRel, libIndex, method) {  var pane = openPane();  if (!pane) return;  var info = assertPath(pathRel, libIndex);  if (!info.exists) {    MessageBox.information("Folder not found:\n" + info.full, "Not Found", "OK");    return;  }  try {    if (libIndex === 0) {      print("Using browseToNativeFolder for My Library");      pane.browseToNativeFolder(pathRel, true);    } else {      if (method === "native") {        print("Test: Using browseToNativeFolder for My DAZ 3D Library");        pane.browseToNativeFolder(pathRel, true);      } else if (method === "nativeFull") {        print("Test: Using browseToNativeFolder with full path for My DAZ 3D Library");        pane.browseToNativeFolder(info.full, true);      } else if (method === "idpath") {        print("Using browseToIDPath for My DAZ 3D Library");        var aIdPath = ["My DAZ 3D Library"].concat(pathRel.split("/"));        pane.browseToIDPath(aIdPath);      }    }    pane.refresh();    print("Jumped to:", info.full);  } catch (e) {    print("Error:", e);    MessageBox.critical("Error: " + e, "Jump Failed", "OK");  }}function showDialog() {  openPane();  var dlg = new DzBasicDialog();  dlg.caption = "Quick Jump";  dlg.setFixedWidth(300);  dlg.addSpacing(6);  for (var g = 0; g &lt; PATH_GROUPS.length; g++) {    var group = PATH_GROUPS[g];    var lbl = new DzLabel(dlg);    lbl.text = "&lt;div align='center'&gt;&lt;b&gt;" + group.title + "&lt;/b&gt;&lt;/div&gt;";    dlg.addWidget(lbl);    for (var e = 0; e &lt; group.entries.length; e++) {      var entry = group.entries[e];      var btn = new DzPushButton(dlg);      btn.text = entry.label;      btn.clicked.connect(function(p, idx, m) {        return function() {          print("Button clicked:", entry.label);          jump(p, idx, m);        };      }(entry.path, group.libIndex, entry.method));      dlg.addWidget(btn);    }    dlg.addSpacing(5);  }  dlg.exec();}showDialog();

     Problem Summary

    •  Jumping to My Library folders works perfectly.
    •  Jumping to My DAZ 3D Library does not visually work, although the folder path is valid and exists.

    What’s the proper way to programmatically open a subfolder inside My DAZ 3D Library using a script?

    Post edited by MaX Pupkin on
  • Richard HaseltineRichard Haseltine Posts: 107,860

    What happens if you use Content Directory Manager (e.g. launched from Edit>Preferences>Content tab) to revese the order in which the directories are listed - does the oen that worked then fail and vice versa? 

  • MaX PupkinMaX Pupkin Posts: 49

    Richard Haseltine said:

    What happens if you use Content Directory Manager (e.g. launched from Edit>Preferences>Content tab) to revese the order in which the directories are listed - does the oen that worked then fail and vice versa? 

    44

    1. Excuse me, I did not understand what I should do?
    2. You tried to launch the script on my computer, what did I publish in the post of post?

  • Richard HaseltineRichard Haseltine Posts: 107,860

    Select one of the foldrs under Daz Studio Formats and then click the Move Up or Move Down button to switch their order, then click Accept back to the application and see if the script switches which folder it works with.

  • MaX PupkinMaX Pupkin Posts: 49
    edited June 30

    Sometimes I get the impression that different buttons have started to work, but navigation still only happens within "My Library".
    Is it possible to change this behavior programmatically?

    Post edited by MaX Pupkin on
  • MaX PupkinMaX Pupkin Posts: 49
    edited June 30

    Can you run a script on your side to test it?

    Post edited by MaX Pupkin on
  • OmnifluxOmniflux Posts: 427
    edited June 30

    Attaching an animated gif did not work, but here is a screen capture of using your script

    MaX Pupkin Script Test.webp

    Post edited by Omniflux on
  • MaX PupkinMaX Pupkin Posts: 49

    Omniflux said:

    Attaching an animated gif did not work, but here is a screen capture of using your script

    MaX Pupkin Script Test.webp

    Buddy, I'd be happy if it worked correctly, but the script moves exclusively within the "My Library" library. Check out the paths for yourself.

  • OmnifluxOmniflux Posts: 427

    I have renamed my libraries, so

    image

     

    First set of buttons work with the first library (libIndex 0 in scripts PATH_GROUPS)

    image

     

    Second set of buttons work with the second library (libIndex 1 in scripts PATH_GROUPS)

    image

     

    Previously posted screen capture shows buttons jumping to expected folders in the Content Library pane.

     

    MaX Pupkin said:

    Buddy, I'd be happy if it worked correctly, but the script moves exclusively within the "My Library" library. Check out the paths for yourself.

    Not sure what you mean here, the screen capture clearly shows the script switching between libraries; what paths am I supposed to be checking for myself?

  • MaX PupkinMaX Pupkin Posts: 49

    I have renamed my libraries, so

    image

    Hi! Where exactly should I rename the libraries to avoid breaking anything?

  • OmnifluxOmniflux Posts: 427

    Rename the folder, then re-add it in the Content Directory Manager

  • TugpsxTugpsx Posts: 792

    Omniflux said:

    I have renamed my libraries, so

    image

     

    First set of buttons work with the first library (libIndex 0 in scripts PATH_GROUPS)

    image

     

    Second set of buttons work with the second library (libIndex 1 in scripts PATH_GROUPS)

    image

     

    Previously posted screen capture shows buttons jumping to expected folders in the Content Library pane.

     

    MaX Pupkin said:

    Buddy, I'd be happy if it worked correctly, but the script moves exclusively within the "My Library" library. Check out the paths for yourself.

    Not sure what you mean here, the screen capture clearly shows the script switching between libraries; what paths am I supposed to be checking for myself?

    Cool testing, works thus far. Your added options should be useful also.

     

  • MaX PupkinMaX Pupkin Posts: 49

    5

    556

    I renamed, but does not work. Tell me what I'm doing wrong? Or what else needs to be corrected?

  • MaX PupkinMaX Pupkin Posts: 49
    var PATH_GROUPS = [  {    title: "My Library",    libIndex: 0,    entries: [      { label: "G8F Clothing", path: "People/Genesis 8 Female/Clothing", method: "native" },      { label: "G8M Clothing", path: "People/Genesis 8 Male/Clothing", method: "native" },      { label: "G8F Poses", path: "People/Genesis 8 Female/Poses", method: "native" },      { label: "G8M Poses", path: "People/Genesis 8 Male/Poses", method: "native" },      { label: "G3F Clothing", path: "People/Genesis 3 Female/Clothing", method: "native" },      { label: "G3M Clothing", path: "People/Genesis 3 Male/Clothing", method: "native" },      { label: "G3F Poses", path: "People/Genesis 3 Female/Poses", method: "native" },      { label: "G3M Poses", path: "People/Genesis 3 Male/Poses", method: "native" }    ]  },  {    title: "My DAZ 3D Library",    libIndex: 1,    entries: [      { label: "G8F Clothing (ID Path)", path: "People/Genesis 8 Female/Clothing", method: "idpath" },      { label: "G8M Clothing (ID Path)", path: "People/Genesis 8 Male/Clothing", method: "idpath" }    ]  },  {    title: "Another My Library",    libIndex: 0,    entries: [      { label: "Props", path: "Props", method: "native" }    ]  }];function openPane() {  var pm = MainWindow.getPaneMgr();  var p = pm.findPane("DzContentLibraryPane");  if (p) {    pm.showPane(p);    p.setVisible(true);    return p;  } else {    MessageBox.warning("Content Library pane not found.", "Warning", "OK");    return null;  }}function assertPath(pathRel, libIndex) {  var cm = App.getContentMgr();  var base = cm.getContentDirectoryPath(libIndex);  var full = base + "/" + pathRel;  var exists = new DzDir(full).exists();  return { exists: exists, base: base, full: full };}function jump(pathRel, libIndex, method) {  var pane = openPane();  if (!pane) return;    print("Attempting to jump:");  print("  Path Relative: " + pathRel);  print("  Library Index: " + libIndex);  print("  Method: " + method);  var info = assertPath(pathRel, libIndex);  print("  Full Path Derived: " + info.full);  print("  Path Exists: " + info.exists);  if (!info.exists &amp;&amp; method !== "absolute") { // Allow absolute path to be tried even if initial check fails    MessageBox.information("Folder not found:\n" + info.full, "Not Found", "OK");    return;  }  try {    if (method === "native") {      print("  Calling pane.browseToNativeFolder with relative path: " + pathRel);      pane.browseToNativeFolder(pathRel, true);    } else if (method === "idpath") {      var aIdPath = ["My DAZ 3D Library"].concat(pathRel.split("/"));      print("  Calling pane.browseToIDPath with array: " + aIdPath.join("/"));      pane.browseToIDPath(aIdPath);    } else if (method === "absolute") {      print("  Calling pane.browseToNativeFolder with absolute path: " + pathRel);      pane.browseToNativeFolder(pathRel, true);    }    pane.refresh();    print("  Navigation attempt complete.");  } catch (e) {    print("  ERROR during navigation: " + e);    MessageBox.critical("Error navigating to path: " + e + "\nPath: " + pathRel + "\nLibrary Index: " + libIndex + "\nMethod: " + method + "\n\nPlease ensure the correct Content Library root is selected.", "Jump Failed", "OK");  }}function showDialog() {  openPane();  var dialog = new DzDialog();  dialog.caption = "Quick Jump";  dialog.width = 350; // Increased width for new buttons and labels  var layout = new DzVBoxLayout(dialog);  layout.spacing = 6;  for (var g = 0; g &lt; PATH_GROUPS.length; g++) {    var group = PATH_GROUPS[g];    var lbl = new DzLabel(dialog);    lbl.text = "&lt;div align='center'&gt;&lt;b&gt;" + group.title + "&lt;/b&gt;&lt;/div&gt;";    layout.addWidget(lbl);    for (var e = 0; e &lt; group.entries.length; e++) {      var entry = group.entries[e];      var btn = new DzPushButton(dialog);      btn.text = entry.label;      btn.clicked.connect((function(p, idx, m) {        return function() {          jump(p, idx, m);          dialog.close(); // Keep closing for standard buttons        };      })(entry.path, group.libIndex, entry.method));      layout.addWidget(btn);      if (e === 3 &amp;&amp; group.entries.length &gt; 4) {        layout.addSpacing(10);      }    }    layout.addSpacing(5);  }  // --- Test Buttons Section ---  var testLbl = new DzLabel(dialog);  testLbl.text = "&lt;hr&gt;&lt;div align='center'&gt;&lt;b&gt;Test Options (No Dialog Close)&lt;/b&gt;&lt;/div&gt;";  layout.addWidget(testLbl);  layout.addSpacing(5);  // Test 1: My DAZ 3D Library (libIndex 1, native method, relative path)  var testBtn1 = new DzPushButton(dialog);  testBtn1.text = "Test My DAZ 3D Library (libIndex 1, Native, Relative)";  testBtn1.clicked.connect(function() {    print("\n--- Test Button 1 Clicked ---");    jump("People/Genesis 8 Female/Clothing", 1, "native");  });  layout.addWidget(testBtn1);  // Test 2: My DAZ 3D Library (libIndex 1, ID Path method, relative path)  var testBtn2 = new DzPushButton(dialog);  testBtn2.text = "Test My DAZ 3D Library (libIndex 1, ID Path, Relative)";  testBtn2.clicked.connect(function() {    print("\n--- Test Button 2 Clicked ---");    jump("People/Genesis 8 Female/Clothing", 1, "idpath");  });  layout.addWidget(testBtn2);  // Test 3: Absolute Path (example: D:\My DAZ 3D Library\People\Genesis 8 Female\Clothing)  var testBtn3 = new DzPushButton(dialog);  testBtn3.text = "Test My DAZ 3D Library (Absolute Path)";  testBtn3.clicked.connect(function() {    print("\n--- Test Button 3 Clicked ---");    jump("D:/My DAZ 3D Library/People/Genesis 8 Female/Clothing", -1, "absolute"); // -1 or any other index as it's absolute  });  layout.addWidget(testBtn3);  layout.addSpacing(10);  var closeBtn = new DzPushButton(dialog);  closeBtn.text = "Close";  closeBtn.clicked.connect(function() {    dialog.close();  });  layout.addWidget(closeBtn);  dialog.show();  while (dialog.visible) {    processEvents();    sleep(50);  }}showDialog();

     

    Please run this script and check or really transfer you to the library "My DAZ 3D Library"

  • TugpsxTugpsx Posts: 792
    edited July 17

    Check your library indexing, In my case i have 6 mapped Daz libraries and your index refers to lib 0 or 1, to test your script flow i have changed the index to other libraries and it works.

    The trick you will have is to define the users mapped libraries in an if exist statement and then use those iinex in your flow.

     

    Screenshot 2025-07-17 112819.png
    973 x 337 - 25K
    Post edited by Tugpsx on
Sign In or Register to comment.