Jump to content
Server Maintenance This Week. ×

Can variables be used with BaseElements plug-in?


K1200

This topic is 3466 days old. Please don't post here. Open a new topic instead.

Recommended Posts

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.

Link to comment
Share on other sites

  • 2 weeks later...

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

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

  • 2 years later...

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
Link to comment
Share on other sites

(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/nickorr/BaseElements-Plugin/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.

Link to comment
Share on other sites

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

 

post-53652-0-95437700-1414584945_thumb.j

 

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:Usersbrian.richDesktoppart.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:Usersbrian.richDesktoppart.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

Link to comment
Share on other sites

This topic is 3466 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

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