Javascript for Digital Dashboards

  • Javascript for Digital Dashboards

    Posted by Doug McLean on March 13, 2021 at 3:32 pm

    I have a collection of Dashboards that I use for my projects. They all have the same basic layout and have buttons for various places that I want to link too.
    Our folder structure is also set up in a consistent manner.
    Does anyone have any JavaScript that I can run to automatically set these links up so I don’t have to set up 10 hyperlinks every time I use one of my Dashboards?

    Liz Larsen replied 1 year, 1 month ago 7 Members · 22 Replies
  • 22 Replies
  • Andrew Veggian

    Member
    March 15, 2021 at 4:51 pm
    Points: 2,608
    Rank: UC2 Brainery Orange Belt UC2 Brainery Orange Belt Rank

    I have used JavaScript for making dashboards more dynamic, but I don’t know of a way to automate the creation of hyperlinks. I do have an idea that might work, but it depends on how your files are named. Are the files always named the same thing (Drawings.pdf, Specifications.pdf, etc.) or are they project-specific (ProjectName_Drawings.pdf, ProjectName_Specifications.pdf, etc.) or do they have random names every time?

  • Doug McLean

    Member
    March 24, 2021 at 5:02 pm
    Points: 13,200
    Rank: UC2 Brainery Blue Belt III UC2 Brainery Blue Belt III

    Yes, most of them are the same.

    They will go to a specific sub folder within our Estimate folder.

    Everything is consistent. Everything is all contained within the same parent folder.

    • David Cutler

      Member
      November 7, 2022 at 11:54 am
      Points: 24,313
      Rank: UC2 Brainery Brown Belt IIII UC2 Brainery Brown Belt IIII

      Looking back through some older threads and saw this one @Doug McLean (have to study history so I know where to get my hyperlinks from for @Vince ). Did you find a way to simplify this process? If not, perhaps some of those who have joined the Brainery since your original post might have some ideas.😎

      • Vince

        Member
        November 7, 2022 at 12:15 pm
        Points: 12,373
        Rank: UC2 Brainery Blue Belt II UC2 Brainery Blue Belt II

        😅

      • Doug McLean

        Member
        November 7, 2022 at 1:38 pm
        Points: 13,200
        Rank: UC2 Brainery Blue Belt III UC2 Brainery Blue Belt III

        @lizlarsen is mulling this over as I understand it

        • Liz Larsen

          Member
          November 7, 2022 at 4:55 pm
          Points: 4,835
          Rank: UC2 Brainery Orange Belt IIII UC2 Brainery Orange Belt IIII

          I’m still working on it. My optimism fades, though.

          Any method I think of, there are security reasons for disabling JavaScripts ability to do it. Such as JavaScript being able to open folder leads to the possibility of inserting malicious code onto your computer.

          Like, I get it. But at the same time I’m frustrated because I have it planned out in my head and it would be possible if not for security reasons. Ugh.

  • Troy DeGroot

    Organizer
    November 7, 2022 at 4:28 pm
    Points: 21,551
    Rank: UC2 Brainery Brown Belt I UC2 Brainery Brown Belt I

    @Doug McLean What are you trying to automate? I’ve seen lots of digital dashboard strategies, here is what I’ve always done:

    1. Create a template project folder structure, Saved on your network.
    2. Save the Template Dashboard in the root directory of that project.
    3. Create all the links, and make sure all your links are set to Relative.
    4. When a new project comes in, make a duplicate where you save your project data, whether that’s a network location or Studio Project. All the paths should remain if you move the entire thing together.

    I saw a video a year ago using javascript to turn layers on/off on a dashboard. I didn’t really understand why they took that approach. It’s a lot easier to create several pages that look different, than to script hiding things on one page.

    I’d love to hear what ideas you guys picked up from @mechave presentation. Digital Dashboards are one of my favorite things to do in Bluebeam.

    • Liz Larsen

      Member
      November 7, 2022 at 4:57 pm
      Points: 4,835
      Rank: UC2 Brainery Orange Belt IIII UC2 Brainery Orange Belt IIII

      Coincidentally, my newest video (debuting tomorrow!) goes over a dashboard that uses JavaScript to hide and show layers.

      And you’ll see exactly why JavaScript was used here, rather than creating a bunch of similar pages.

      (P.S. if anyone needs help adding JavaScript to their dashboards, come see me)

      • Troy DeGroot

        Organizer
        November 7, 2022 at 5:11 pm
        Points: 21,551
        Rank: UC2 Brainery Brown Belt I UC2 Brainery Brown Belt I

        You might convince me @lizlarsen we’ll see. 🤣

        • Liz Larsen

          Member
          November 7, 2022 at 5:18 pm
          Points: 4,835
          Rank: UC2 Brainery Orange Belt IIII UC2 Brainery Orange Belt IIII
    • Doug McLean

      Member
      November 7, 2022 at 5:26 pm
      Points: 13,200
      Rank: UC2 Brainery Blue Belt III UC2 Brainery Blue Belt III

      the folder structure is set, that’s not the issue, its the location of that folder structure within our Jobs/ Estimating Drive.
      Every project has a different starting location, which is the main problem really, even being on SharePoint.
      It would just be nice to not have to set up those initial links.

  • Troy DeGroot

    Organizer
    November 7, 2022 at 9:22 pm
    Points: 21,551
    Rank: UC2 Brainery Brown Belt I UC2 Brainery Brown Belt I

    I’m really pulling at straws here, but if you go to the Hyperlink Panel you could Edit Action and paste the Root folder into the front of the path…. For each one… I know….

    Maybe there could be a script for that @lizlarsen

    • Liz Larsen

      Member
      November 8, 2022 at 7:27 am
      Points: 4,835
      Rank: UC2 Brainery Orange Belt IIII UC2 Brainery Orange Belt IIII

      This is exactly one of the things I’m looking at.

      With writing JavaScript in Bluebeam, there’s the eternal questions of:

      • Does my code not work because I wrote it wrong?
      • or
      • Does my code not work because it’s not possible?

      With such limited documentation available for what I’m doing, I have no idea if I should continue down some pathways in an attempt to fix my code, or if that will be a fruitless endevour.

      • David Cutler

        Member
        November 8, 2022 at 7:45 am
        Points: 24,313
        Rank: UC2 Brainery Brown Belt IIII UC2 Brainery Brown Belt IIII

        Perhaps the question needs to be “what do I need to break to make this work?” @lizlarsen 😎

      • Isaac Harned

        Member
        April 26, 2023 at 4:27 pm
        Points: 6,796
        Rank: UC2 Brainery Purple Belt I UC2 Brainery Purple Belt I

        This is pretty frustrating, it looks like one way to do this would be to place a field on the page to collect the base of the address, then concatenate with a set of standard relative links. Couple of problems I am running into playing with this, and maybe you can expand Liz:

        So there is no way that I can see to manipulate active hyperlinks as they are not named form fields, and as noted earlier, Revu has not made a method available to create link.

        The work around that I see would be to set the action of buttons or other dashboard items. Unfortunately I am having issues getting the second half of my “setAction” command to work. I am pretty unfamiliar with the usable function calls here, but I have tried a couple, icluding this one, which seemed the most obvious:

        (simplified without concatenating for now, just trying to get the base to work)

        // Get the value of the form field

        var fieldValue = this.getField(“Text1”).value;

        // Set the action of the button to follow the hyperlink on MouseUp

        this.getField(“Button1”).setAction(“MouseUp”, “this.getDoc().launchURL(\”” + fieldValue + “\”);”);

        • Isaac Harned

          Member
          April 26, 2023 at 5:09 pm
          Points: 6,796
          Rank: UC2 Brainery Purple Belt I UC2 Brainery Purple Belt I

          ok got the base of this working, let me know if I’m on the right track or if you need to do this a different way before I take it any further:

          Global code:

          function launcher() {

          var link = this.getField(“Text1”).value

          app.launchURL(link);

          }

          Button code (mouse up, javascript)

          launcher()

          If this is the right idea, we can take an input and concat with a set of standard relative locations.

          Alternatively, we can use the openDoc method instead of launchURL if we want to open in Revu.

          • Isaac Harned

            Member
            April 26, 2023 at 5:58 pm
            Points: 6,796
            Rank: UC2 Brainery Purple Belt I UC2 Brainery Purple Belt I

            Ok getting more into the weeds of what Liz was referring to with security:

            I tried to add a “File//” at the beginning in order to call file explorer if trying to go to a directory. it seems to concat just fine, but gave me a security error when I tried to execute.

            It WILL however concatenate to open a specific file, i.e.:

            var dataLink = this.getField(“Text1”).value + “M0-22CD Schedules Area CD.pdf”;

            app.openDoc(dataLink);

            This works and open up right in Revu, BUT it freezes the program for some random reason

            Here is the File explorer code if anyone wants to play:

            function launcher() {

            var dataLink = “file://” + this.getField(“Text1”).value + “/DATA”;

            app.launchURL(dataLink);

            }

            • Liz Larsen

              Member
              April 27, 2023 at 7:41 am
              Points: 4,835
              Rank: UC2 Brainery Orange Belt IIII UC2 Brainery Orange Belt IIII

              I’ll have to take a look at this over the weekend.

              I do agree with you that manipulating hyperlinks is not a function that Bluebeam has allowed with their JavaScript API. I like your workaround to use buttons, but it’d be nice to just straight be able to insert hyperlinks.

            • Isaac Harned

              Member
              April 27, 2023 at 10:16 am
              Points: 6,796
              Rank: UC2 Brainery Purple Belt I UC2 Brainery Purple Belt I

              I think technically you could accomplish it through the A-word, but would be annoying to have to use that every time to update links. Hopefully that API expansion is coming soon and is not a let-down.

            • Liz Larsen

              Member
              April 27, 2023 at 3:36 pm
              Points: 4,835
              Rank: UC2 Brainery Orange Belt IIII UC2 Brainery Orange Belt IIII

              Hopefully that API expansion is coming soon and is not a let-down.

              Yeah….. My optimism on this has lowered over the past several weeks.

            • Isaac Harned

              Member
              April 28, 2023 at 11:17 am
              Points: 6,796
              Rank: UC2 Brainery Purple Belt I UC2 Brainery Purple Belt I

              A small update to this, I tried to play with some of the trust settings to see if it could be a reason, but no luck. Added the network drive and the specific folder, but still get a security error.

            • Liz Larsen

              Member
              April 28, 2023 at 11:21 am
              Points: 4,835
              Rank: UC2 Brainery Orange Belt IIII UC2 Brainery Orange Belt IIII

              I have also had no luck when trying to modify trust settings (in previous projects, I haven’t tried recently).

Log in to reply.