Jump to content

john renfrew

  • Content Count

  • Joined

  • Last visited

  • Days Won


john renfrew last won the day on October 24 2019

john renfrew had the most liked content!

Community Reputation

43 Excellent

About john renfrew

  • Rank
    enthusiast, with a bit of geek
  • Birthday 06/21/1957

Profile Information

  • Gender
  • Location

Contact Methods

  • Website URL
  • Skype

FileMaker Experience

  • Skill Level
  • FM Application
    16 Advanced

Platform Environment

  • OS Platform
  • OS Version

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. What you get back is JSON version of the information you asked the function for.. so instead of SMGetVariable calls you would use JSONGetElement instead.. The benefit was to show how this was possible - not to make you change how you do things, it's up to you if change your implementation, but was to show how to export the data out as a JSON block
  2. Those error codes are FileMaker error codes afaik therefore 102 == field missing Groovy errors will refer to things like class issues or things like inability to do an action on a null object..
  3. after the vsm_Image = line needs a ¶ at the end if you literally copy/paste
  4. I presume at the moment you are doing lots of SMGetVariable calls after running this function If you added the return statement right at the end you would get back all the answers as a transformed JSON block you could process in a different way...
  5. you could also be really smart and return the whole thing as a JSON block too... (this definitely needs SM 5.2+) return JsonOutput.toJson([vsm_titre: vsm_titre, vsm_auteur1: vsm_auteur1, vsm_auteur2: vsm_auteur2, vsm_nbPages: vsm_nbPages, vsm_Editeur: vsm_Editeur, vsm_Image: vsm_Image])
  6. The issue is that these books have no authors - so it fails quite early on... I changed the code to test for each presence
  7. can you post the sample URL?? I am pretty sure it might be because the 'cover' node does not exists and so it can't find the medium sub-node on it... try replacing the line with... vsm_urlImage = keySet.cover?keySet.cover.medium:null
  8. Try this RegisterGroovy( "JSON2FMP( url )" ; "import groovy.json.*¶ ¶ vsm_titre = vsm_auteur1 = vsm_auteur2 = vsm_nbPages = vsm_urlImage = vsm_Image = vsm_Editeur = ''¶ ¶ parsedResponse = new JsonSlurper().parse(new URL(url))¶ ¶ if (parsedResponse.size() == 1 ){¶ root = parsedResponse.keySet()[0]¶ keySet = parsedResponse.\"${root}\"¶ ¶ vsm_titre = keySet.title?:''¶ ¶ vsm_auteur1 = keySet.authors[0]?keySet.authors[0].name:''¶ vsm_auteur2 = keySet.authors[1]?keySet.authors[1].name:''¶ vsm_nbPages = keySet.number_of_pages?:''¶ vsm_Editeur = keySet.publishers.name?:''¶ vsm_urlImage = keySet.cover.medium?:null¶ ¶ vsm_Image = vsm_urlImage?new URL ( vsm_urlImage ):''¶ ¶ } else {¶ return ''¶ }" ; "isGui = false" ) it just tests each node is there and then extracts the value if it is
  9. I have client machine Mac 10.15.something and latest ScriptMaster For some while the plugin seems to turn itself off after being used successfully The machine was recently updated, and I was in yesterday to install FMP18.0.3 but this morning I am getting error notifications which are because it has turned off again. Can you offer any light on why this might be and how to go about troubleshooting it??
  10. can you post your function Noel... I have used open books already.. john
  11. What version of the plugin?? I have experienced problems in the past with older versions
  12. See, we all learned something... To make things more Groovy, you don't need any semicolons at the end of lines, and in most cases you don't need the class assignments at the start for line, Groovy auto typecasts as it knows what the returned object is...
  13. The issue is what you get back from Groovy and how to interpret it this is my setup I can get that there are two displays ( an array with two values at 0 and 1 ) I can get the starting position and size, but the values returned in this case show both of them as 2560*1440 BUT with a monitor2 on the right I get [0] == java.awt.Rectangle[x=2560,y=0,width=2560,height=1440] [1] == java.awt.Rectangle[x=-0,y=0,width=2560,height=1440] and with the monitor 2 dragged to the left I get [0] == java.awt.Rectangle[x=-2560,y=0,width=2560,height=1440] [1] == java.awt.Rectangle[x=-0,y=0,width=2560,height=1440] you can get these values by using this code and changing the gs[0] for gs[1] to see the differences import java.awt.GraphicsConfiguration import java.awt.GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment() gs = ge.getScreenDevices() gd = gs[0] gc = gd.getConfigurations() return gc[0].getBounds() if you use Toolkit and getScreenSize the docs say getScreenSize DimensiongetScreenSizeHeadlessException GraphicsConfiguration GraphicsDevice import java.awt.Toolkit screenSize = Toolkit.getDefaultToolkit().getScreenSize() return screenSize however as I pointed out this will not help as both displays report the same size so I have no way of inferring which one is positioned where
  14. Some of the things you mention like Get(WindowDesktopWidth) and Adjust Window [Maximize] ARE already fileMaker and I am not sure how you expect Groovy to control the FileMaker environment, and particularly not the windows.
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.