1 2 Previous Next 17 Replies Latest reply on Sep 1, 2014 3:07 AM by Prem Reddy

    Automation of routine activities

    Richard Leeke

      I've seen (and added to) a few postings on this forum suggesting some sort of automation capability to help with routine tasks.  I think that would be really useful, but until such time as something like that makes it to the top of the priority list I thought I'd have a go at seeing what can be achieved with a simple keystroke simulation approach.

       

      I've managed to get something going for a few cases that take a lot of my time (refreshing large extracts, publishing PDFs from selected sheets, etc).  I think this is going to be a real time-saver for me.

       

      But it's very clunky - this sort of approach to automation is notoriously difficult to make robust.  The thing I had most problems with was detecting when Tableau had finished processing the latest request. If you send keystrokes too early they can get "lost" and nothing happens. It seems that when a sheet is refreshing there are a few places where it may start accepting keystrokes for a moment and then stop again - so my first approach of just repeatedly sending keys until a window popped up wasn't quite good enough and I ended up with various timeouts and retries and suchlike. It ended up taking much longer than I had hoped to get something working.

       

      Having some sort of indication of whether Tableau is actively processing something would make this sort of automation much easier and allow it to be much more robust.  It wouldn't even have to be visible on the screen - a hidden "busy" control that could be detected by a windows automation tool would be all that was needed.

       

      There are a few other things which could also help - but I'd rather think of this as a stop-gap until a proper automation facility comes along, so I'll not even mention those (for now).

        • 1. Re: Automation of routine activities
          Chris Gerrard

          I'm also keenly interested in automating Workbook operations. My client has a very specific need to generate very high quality PDFs, including 14 separate PDFs of a Worksheet, one for each specific value of a filter. In this situation generating the PDFs using Tableau Server's automation isn't really an option; if nothing else, the different visual renderings between the desktop and server make it ponderous.

           

          I've recommended the keystroke record-and-playback approach, and agree with Richard that it's a stopgap measure.

           

          Tableau's undo-redo capability suggests that there's a command processing mechanism that could be leveraged for implementing at least those operations that can be undone/redone.

          • 2. Re: Automation of routine activities
            Richard Leeke

            If you do go down the record/playback route I'm happy to share what I've found - there are a few obstacles that make it tricky to get it reliable.  I can even let you have a copy of the utility I've put together if you want - though where I've got to wouldn't fully handle your need as I haven't found a generic way to drive the shelf controls - so it wouldn't handle changing filter values.  That's possible - but I can't see how to avoid making that very specific to a particular worksheet - and the result probably wouldn't be very resilient in the face of sheet changes.

             

            What I've done uses a freeware tool called AutoIt, which has a fairly complete scripting language and lets you build standalone executables.  So I have a command line tool that supports a few basic operations (open workbook, close workbook, select sheet, refresh sheet, refresh extract, clone workbook, print PDF, etc) - but it's not 100% reliable, because of the issues I mentioned in my original posting.

             

            I suspect some of the commercial automation tools will do a better job of recognising GUI objects and GUI states - I had a quick go with one of the high-end automated testing tools just now and it seemed a bit more promising.  I just tried to do it with a free tool so I could use it at different client sites.

             

            I'm definitely going to persevere with this - even at it's current level of reliability it can be a big time saver.  I set up a script to refresh a couple of extracts and 10 or so worksheets in a workbook yesterday.  That takes about an hour and a half, and needs a few mouse clicks every 5 or 10 minutes.  Just being able to run a script before going to a meeting and come back and it's done is great.

            • 3. Re: Automation of routine activities
              Chris Gerrard

              Thanks, Richard.

               

              I'll look into AutoIt and see what it offers.

              • 4. Re: Automation of routine activities
                Peter Cuttance

                Hi Chris — did you have any success with Autoit?

                • 5. Re: Automation of routine activities
                  Richard Leeke

                  One other pitfall with this which I didn't mention in my original posting is that the scripts are quite susceptible to breakage with new versions of Tableau.  I originally scripted this with 5.0 and had to make quite a few (very minor) changes when 5.1 came out.  Some of these were user-visible changes in the interface (a couple of menu options changed name) and also the internal names for a few windows controls changed.

                   

                  So only go this way if you're prepared to do a bit of maintenance to keep it working as new releases come out.

                  • 6. Re: Automation of routine activities
                    guest contributor

                    Re: ... detecting when Tableau had finished processing the latest request

                     

                    If using together Autoit and Python Image Library, the following code snippet may be useful:

                     

                    from win32api import GetSystemMetrics

                    width = GetSystemMetrics (0)

                    height = GetSystemMetrics (1)

                    from PIL import Image, ImageGrab

                    import time

                    def wait_stale_screenshot(tick=2, timeout=30):

                        """Take sequence of screenshots separated by tick(seconds) and wait for

                        two identical screenshots.

                        Return number of screenshots taken (less by one) or 0 in case of timeout"""

                        time_start = time.time()

                        h0 = ImageGrab.grab( (0, 0, width, height,) ).histogram()

                        tick_count = 0

                        while time.time()<time_start + timeout:

                            time.sleep(tick)

                            tick_count += 1

                            h = ImageGrab.grab( (0, 0, width, height,) ).histogram()

                            if h == h0:

                                return tick_count

                            else:

                                h0 = h

                        return 0

                     

                    This works fairly reliable vs. rotating wait cursor. With carefully chosen parameters should also work for various progress indicators.

                     

                    Vladimir

                    • 7. Re: Automation of routine activities
                      Richard Leeke

                      Wonderful - I'll try to figure out how to use that.  If I can get that going I'll happily share the little command-line automation tool I've put together - I've been a bit hestitant just to post it so far because of the trouble with trying to make it robust.

                       

                      Any pointers on how to go about using the Python Image Library with Autoit, Vladimir?  That's new territory for me.

                      • 8. Re: Automation of routine activities
                        guest contributor

                        We have also built an automation app to meet our needs.  It might be interesting to have this group discuss what we are doing and what we would like to be able to do.  I am more than willing to facilitate that conversation if anyone is interested.

                         

                        I have also been bitten by the new Tableau version bug - between 5.0 and 5.1 and am going to the same issue with the move to 6.0.  It is not a lot of fun...

                        • 9. Re: Automation of routine activities
                          Richard Leeke

                          I'm certainly interested to hear how others have tacked it, what you've managed to achieve, what issues you've hit etc.  I'm also very happy to share what I've done.

                           

                          I would just reiterate my earlier comments that this sort of approach really is a band-aid - so I'd encourage people not to invest too much time and effort in something which will keep going out of date as new releases come out.  There are often other ways of coming at things within the supported capabilities, so I tend to view it as a last-resort approach.

                          • 10. Re: Automation of routine activities

                            Casting my vote for automation features or language.  Even command line parameters would be a good start.

                            • 11. Re: Automation of routine activities

                              +1 from me too.

                               

                              A proper API would be even nicer.

                              • 12. Re: Automation of routine activities
                                guest contributor

                                Hi everybody,

                                 

                                I'm a new user of Tableau, working in a French company.

                                 

                                I'm also interested in a way to automate refreshing and PDF printing with Tableau. I looked for ways to do it on the Internet, but nothing is posted about that. I'd be happy if one of you could give me some tips on this.

                                 

                                Regards,

                                 

                                Antoine

                                • 13. Re: Automation of routine activities
                                  Steve Wexler

                                  I've been asking for this since version 2.0 (five years ago).  This type of automation component was crucial to Microsoft's success with Excel and Word (and it was WordBasic that did a lot to help Word supplant WordPerfect as the preeminent word processing program.)  In any case, I'd love to see this.

                                  • 14. Re: Automation of routine activities

                                    I can see this being very useful to my organisation. The example that Chris Gerrard mentions, printing a number of graphs based on different filter selections, would be useful to me straigh away.

                                    1 2 Previous Next