Jump to content

Applescript/custom function "do shell script" syntax?


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

Recommended Posts

I've been trying for 3 days to figure out the syntax for an FTP Upload custom function (downloaded from briandunning.com), but I can't get it to work. It always fails with error -2740, "an unknown token can't go here," which tells me nothing. Anyone care to check out my script and offer some pointers? I'm sure there's a syntax error, but I can't find it. I want to hard-code the username and password, but the password contains special characters (parentheses), and I'm not sure how to escape them:

i,e, ythr(i.K9)56

I've tried various escaping approaches: ythr(i.K9)56 , "ythr" & "(" & "i.K9" & ")" & "56", etc.

FTPUpload (path, directory, file)






"

set thePath to quoted form of "ftp://<username>:<password>@ftp.remotehost.com/targetfolder/"



do shell script "curl -T"  path & "/" & directory & "/" & file thePath



"



Any ideas?

Link to post
Share on other sites

Haven't posted in a while, so the first thing I thought was "I wonder how many people are going to post to ask me to change my avatar?

Actually, the entire script step is

Perform Applescript (calculated)

FTPUpload($path, $directory, $file)

where $path, $directory and $file are local variables

Link to post
Share on other sites

I suggest you step away from the custom function and do some experimenting in AppleScript Editor or directly in the terminal until you find out what kind of escaping is necessary and acceptable in cURL. Until then, this is not a Filemaker or even AppleScript issue.

I suspect that as long as your password doesn't contain quotes, colons or at signs, it shouldn't need any escaping. But that's merely a guess.

Edited by comment
Link to post
Share on other sites

I wonder how many people are going to post to ask me to change my avatar

I had the same concern as you, and was waiting to see if anyone actually did reply, as I tagged your post for follow-up in case no one did, and to see what others had to say about it. Personally I couldn't concentrate on your question with your avatar on-screen, maybe others had the same problem.

I'm curious as to why you would use it when you, yourself, thought it was over the top?

Lee

Link to post
Share on other sites
  • Newbies

Just use a simple shell script, see the code below:

Enjoy!

-----------------

#!/bin/sh

ftpserver="ftp.server.com"

remotepath="Import"

ftplogin="myuserid"

ftppass="mypass"

function ftpfile {

ftp -n $ftpserver <<INPUT_END

quote user $ftplogin

quote pass $ftppass

cd $remotepath

prompt off

mput TheFile2BUploaded.csv

exit

INPUT_END

}

ftpfile

exit

---------

Link to post
Share on other sites

This topic is 3167 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
  • Similar Content

    • By 360Works
      Email, Scribe, and FTPeek FileMaker Plugins Have New Updated Versions with Improvements
      Learn about the new updates available and download now!
      Last week we were excited to announce that all of our plugins are compatible with the new FileMaker 19 platform!

      This week, we have additional feature enhancements and improvements specific to three of our most popular plugins: 360Works Email, Scribe, and FTPeek.

      While these are minor updates, we encourage you to update now for the best experience using each plugin.
      Download new plugin versions and check out the latest improvements using the links below!
      360Works Email Plugin (Version: 3.316) - FileMaker plugin for sending and receiving emails using IMAP, SMTP, or POP, plus adds sending SMS/Text Messages from FileMaker capabilities.
      Added "attachmentsDir" parameter to EmailReadMessages, allowing users to specify a local directory where they want attachments downloaded. Downloaded attachments are now deleted when EmailDisconnect is called. Implemented a fix for some rare DHC issues that were occurring. Improved inline attachments in emails for better downloading. Reworked the "secureconnection" parameter. SecureConnection will now set both ssl and tls to true. However these can be set individually with "ssl=true" or "tls=true". This resolves issues with certain mail servers that require tls, but reject ssl. IMAP servers better retrieve the messageId and better loading of body structure in messages. 360Works Scribe Plugin - (Version: 4.0710) - FileMaker PDF plugin, OCR plugin, Microsoft Word and Excel integration - all in one.
      Improved how keywords are being pulled from PDFs. Improved Windows file-locking, temporary files are now deleted when ScribeDocCancel is called. Better conversion of Excel files to text with merged cells. Improved Textract results downloads for better accuracy. Improved inserting images into Excel documents. 360Works FTPeek Plugin - (Version 2.305) - FileMaker plugin that can upload, download, and manipulate remote files on an FTP (File Transfer Protocol) server.
      Updated FTP libraries, resolving some connection issues. Reworked the Forcetrust parameter on FTPeek_ConnectFTPS. It should now accept most invalid certificates.
       
      Interested in Three or ALL Plugins from 360Works?
      Get the BEST DEAL with the Portfolio Bundle.
          Stay updated with 360Works
    • By Asu
      Hello, the following is the essence of a problem I need to resolve. The code is AppleScript 
      display dialog "Hello \"world\" "  This code needs to run in FMP18 as a calculated applescript.

      I tried:
      Perform AppleScript [display dialog \"Hello "world" \"] 
      Perform AppleScript [display dialog \"Hello \""world"\" \"]
      Perform AppleScript [display dialog \"Hello "\"world"\" \"]
      Perform AppleScript [display dialog \"Hello \""world\"" \"]
      and other permutations of 1 backslash and 2 quotation marks cause the calculation to be unsavable b/o error.
      Perform AppleScript [display dialog \"Hello \"world\" \"] results in "A identifier can’t go after this “"”." -- after the calculation is saved. (Yes, "A identifier")
      Perform AppleScript [display dialog \"Hello \"\"world\"\" \"] results in A “"” can’t go after this “"”. -- after the calculation is saved
      and an error message of -2740.
      Can anyone help me please?
       

    • By 360Works
      The 360Works FTPeek plugin uploads, downloads, and manipulates remote files on an FTP (File Transfer Protocol) server from within any FileMaker solution.
      FTPeek version 2.1 is now available with an added feature supporting uploads and downloads from Amazon S3!
      Amazon Simple Storage Service (S3) runs on the AWS Cloud Infrastructure. It remains a highly-rated, industry-standard for data storage and retrieval, of any amount of data. As with most AWS services, S3 is versatile, reliable, and secure. It offers flexible storage management and administration capabilities, along with a simple interface that you can use to retrieve data from anywhere on the web.
      Getting started with Amazon S3 in the 360Works FTPeek plugin is easy. Using the function FTPeek_ConnectS3 will connect to your Amazon Web Services account when specifying the parameters for your AWS region and bucket, access key, and secret key. Once connected, you can then upload, download, and list files like any other FTP Server. Full reference documentation can be obtained at 360works.com/ftp-plugin
      Pricing for FTPeek starts at $195 for a 10-user workgroup license - less than $20 per user! Current version 2 license holders can upgrade to FTPeek 2.1 at no additional cost. Version 1 license holders can upgrade to version 2 at a nominal cost. For more on upgrade pricing or to download, please visit 360works.com/ftp-plugin
      More Reasons to Use the 360Works FTPeek plugin:
       
      Security: public encryption key is included with support for FTP over SSL (FTPS) and FTP over SSH (SFTP) Universal Binary cross-platform support: Windows and Mac compatible Runs on your FileMaker Server: Automate nightly FTP batch transfers with scheduled scripts or embed FTP scripts into WebDirect or Custom Web Publishing Transfer directly to/from FileMaker fields: FTP documents and images directly from text and container fields to the FTP server Includes a built-in FTP user interface: Give users full FTP access to the server, a full-featured, 100% FileMaker FTP solution is included with the plugin  
      What Do Other FileMaker Developers Think?
      "I think you guys are filling a big gap with that single plugin. The fact that it supports FTP, SFTP, and FTPS is key . We have replaced two plug-ins (one for FTP and one for SFTP) with a single plugin and can now offer FTPS as an alternative to our customers." - Matt Klein, Small Business Computers of New England, Inc.
      Free Demo or Download FTPeek 2.1 Stay updated with 360Works
       
    • By rramsdale
      I understand this is an old thread, however I am having an issue with this and I am using BE_ExecuteSystemCommand.
       
      I am working on using the baseelements plugin to convert a file. 
      I have the BE_ExportFieldContents working properly, but I am not having much luck with converting the file using ffmpeg. 
      I have 
      BE_ExecuteSystemCommand ("ffmpeg -i \"/Library/FileMaker Server/Data/Documents/IMG_4039.MOV\" -acodec copy \"/Library/FileMaker Server/Data/Documents/robert.m4v\""; 15000) 
      Which doesnt seem to work. 
      I have used terminal to get it working successfully with 
      ffmpeg -i "/Library/FileMaker Server/Data/Documents/IMG_4039.MOV" -acodec copy "/Library/FileMaker Server/Data/Documents/robert.m4v" 
      I have also tried 
      BE_ExecuteSystemCommand ("/bin/bash -c ffmpeg -i \"/Library/FileMaker Server/Data/Documents/IMG_4039.MOV\" -acodec copy \"/Library/FileMaker Server/Data/Documents/robert.m4v\""; 15000)
      I have used the BE_ExecureSystemCommand successfully by calling 
      BE_ExecuteSystemCommand ("osascript -e 'tell app \"Finder\" to display dialog \"Hello World\"'"; 60000) 
      adding /bin/bash -c before the above code does not seem to work. 
      I am on a mac running filemaker pro advanced using filemaker server.
      Also can I call the BE_ExportFieldContents using perform script on server. I couldnt seem to get it working, but the script schedule worked, as well as a local script not performed on the server.
      Thank you for any help.
    • By wedgeman
      We are working on a process for passing certain info nuggets out of a solution (FMP 13) in an encrypted method.
      For various reasons a version upgrade isn't feasible. So the plan is to encrypt the nuggets, then pass them into a format for transport.
      Currently, we're using Applescript to pass the particular fields into an AES-256-CBC encryption process in a calculated Applescript step, as follows :
       
       
      The problems which concern me here:
      1. The password is "traveling" into Terminal in plaintext.   Is there a way this can be viewed during the process (a 'ps' or some other method)??
      2. Is there a better method to accomplish this without running as an echo?
       
      I've tried various flavors of this process (successful encryption & transport, etc), but am most concerned about the potential vulnerability from within OSX.. I've run various flavors, then attempted to grep for any of the password strings in log files and Library/Application Support/ folders, but haven't found anything...
      Is this an unfounded issue, or should I be going a different direction?
  • Who Viewed the Topic

    3 members have viewed this topic:
    Rick Whitelaw  Nuri Baba  Lee Smith 

×
×
  • Create New...

Important Information

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