Jump to content

  •  

Photo

Can variables be used with BaseElements plug-in?


  • Please log in to reply
6 replies to this topic

#1 K1200  old hand

K1200
  • Members
  • 588 posts
  • FM Application:11 Advance
  • Platform:Windows 7
  • Skill Level:Intermediate
  • Time Online: 20d 11h 23m 28s

Posted 07 February 2012 - 12:24 PM

Anyone using the BaseElements plug-in with variables on Windows?

I've been trying off and on for a week to pass filenames to the copy and move functions in the simple form:
BE_CopyFile ( $From ; $To)

BE_CopyFile and BE_MoveFile work fine when the filenames are literals (e.g., BE_CopyFile ( "C:\temp\file.txt" ; "C:\testdir\file.txt") )

But try as I might, I can't come up with a combination of text in variables that will be acted upon. And (frustratingly) the function only returns "?" on each and every combination ... which is absolutely no help in figuring anything out.

Goya (probably justifiably) doesn't offer any support for this free and open source offering, so there doesn't seem to be a way to pass this to them as a question. And, yes, I've read Goya's post on this forum regarding filename differences between Windows and Macs ... and the backslash issue, of course. But there's no mention of variables.

So I ask: has anyone deduced a workable format?

Thanks for any help.
  • 0

#2 brian rich  aging apprentice

brian rich
  • Members
  • 290 posts
  • LocationHampshire, England
  • FM Application:11 Advance
  • Platform:Cross Platform
  • Skill Level:Expert
  • Time Online: 11d 4h 48m 17s

Posted 17 February 2012 - 02:02 AM

Hi K1200

Yes, it is possible to use variables with BaseElements. For example, the script steps

Set Variable[ $source; "C:\Users\brian.rich\Desktop\52-012-02.jpg"]
Set Variable[ $dest; "C:\Users\brian.rich\Desktop\52-012-03.jpg"]
Set Variable[ $result; BE_CopyFile ( $source; $dest)]
Pause/Resume Script [Indefinitely]

will copy the file 52-012-02.jpg on my desktop to 52-012-03.jpg

$result contains the value 0 after the script is executed - if the result is a ?, then this suggests there is a problem with the way that the plug-in is installed

I did run into a number of issues when the paths in variables or fields contained back-slashes - you may need to escape them thus C:\\temp\\file.txt to get the path correct.

Do you get the same problem with other BE commands?

Brian
  • 0
Brian

#3 K1200  old hand

K1200
  • Members
  • 588 posts
  • FM Application:11 Advance
  • Platform:Windows 7
  • Skill Level:Intermediate
  • Time Online: 20d 11h 23m 28s

Posted 17 February 2012 - 05:38 PM

Brian, thanks.

It's a big step to have it confirmed that they should work. I can't imagine that the plug-in isn't installed properly because each command works with literals in the calls ... but each fails with variables. I'm aware of the back-slash issue ... although my experience is that I get it wrong more often than not. I'll go back over things with a fine-tooth comb ... and will use your desktop-to-desktop as a test template.

If Base Elements ever issues an update, maybe they'll incorporate an error return like "?<this is the call string>". Maybe?
  • 0

#4 K1200  old hand

K1200
  • Members
  • 588 posts
  • FM Application:11 Advance
  • Platform:Windows 7
  • Skill Level:Intermediate
  • Time Online: 20d 11h 23m 28s

Posted 22 February 2012 - 08:23 PM

Just a follow-up on this issue: Things are now working fine with the BaseElements Plug-in. The best I can reconstruct is that there were nested parentheses in the way I constructed the variables. I can't be certain because I tried so many variations. But using Brian's example as a template, I was able to get correct results from each of the five functions I need.

Thanks again for the help.
  • 0

#5 mr_mike  member

mr_mike
  • Members
  • 15 posts
  • LocationDenver
  • FM Application:12 Advance
  • Platform:Cross Platform
  • Skill Level:Intermediate
  • Membership:TechNet
  • Time Online: 7h 34m 38s

Posted 28 October 2014 - 02:34 PM

Thank you for posting this topic.

 

I can't seem to install the plug in correctly.  I keep getting the ? as a result.  Following the instructions in this thread, I've done the insert file (plugin 2.3.1) into a container field, then using the script step install plug in I can see that the plug in is correctly going to the Application Support/FileMaker/(version 13)/Extensions folder.  Then I restart FileMaker, and verify that that the plug in is installed under FileMaker preferences.  I tried this on two other machines with the same OS.

 

Using the script variable steps outlined in this thread I've got the correct paths generated as $source, $dest but I still get the ? for a $result.

 

This is Mac OS 10.9.5 using FileMaker Pro Advanced 13.0.3.

 

(I was expecting to see custom functions or new script steps appear, but I see none of those)

 

I know that, to some degree, it is installed because when I remove the plug in, the script script with BE_CopyFiles corrupts (loses BE_CopyFile) step.


Any advice regarding another way to install this plug in?  Something else I should be checking?
 
Thank you
Mike

  • 0

#6 eos  Paris 2016 … :-)

eos
  • Members
  • 1,167 posts
  • LocationTegernsee, Bavaria
  • FM Application:13 Advance
  • Platform:Mac OS X Mavericks
  • Skill Level:Intermediate
  • Membership:TechNet
  • Time Online: 222d 5h 7m 40s

Posted 28 October 2014 - 03:07 PM

(I was expecting to see custom functions or new script steps appear, but I see none of those)

 

You find a plug-in's functions in the External Functions section. (Custom Functions are those you create yourself.)

 

I suggest you have the documentation handy:

 

https://github.com/n.../wiki/Functions


I know that, to some degree, it is installed because when I remove the plug in, the script script with BE_CopyFiles corrupts (loses BE_CopyFile) step.

 

It was already verified by the fact that you could use the functions in the first place; if the plug-in wasn't installed, the calculation engine hadn't accepted a calculation involving its functions.


  • 0

#7 brian rich  aging apprentice

brian rich
  • Members
  • 290 posts
  • LocationHampshire, England
  • FM Application:11 Advance
  • Platform:Cross Platform
  • Skill Level:Expert
  • Time Online: 11d 4h 48m 17s

Posted 29 October 2014 - 04:19 AM

You can find the External Functions in a list when you specify a calculation - you should see something like this:

 

ExternalFunctions.JPG

 

You need to selet the function set from the dropdown and then scroll down the list of functions to find the BaseElements functions

 

If you are getting a ? as the value returned, the most likely problem is that the OS filing system is returning an error.  This is probably due to incorrectly specified file paths or a permissions error, or perhaps trying to execute the command on a drive that isn't recognised as a systems drive. If you set up a script similar to the one I suggested above, and step this through with the debugger, you should be able to determine if the paths you are requesting are valid.  Start with a file on your desktop and work from there. One way of determining the correct path to insert is to use the BE_FileExists() command in the data viewer - for example: BE_FileExists ( "C:\Users\brian.rich\Desktop\part.mer" ) will give the value of 1 (TRUE) if the file part.mer is on my desktop.

 

Variables ARE accepted by BE.  For example  Let(path = "C:\Users\brian.rich\Desktop\part.mer"; BE_FileExists ( path )) will also give the value 1

 

Sorry, I don't have a Mac to hand to give you some suitable examples using Mac file paths, and I haven't checked BaseElements on FMP13 yet, but I see no reason why it won't work.

 

You can find a Custom Function called FilePathToOS ( FMFilePath )   here:  http://www.briandunning.com/cf/902  this may help resolve any path issues you have.

 

HTH

 

Brian


  • 0
Brian




FMForum Advertisers