Jump to content

applescript set var to cell "myfield" ...


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

Recommended Posts

fmp 14 last release.

i put this applescript in a global field  and also all the fmp field are global.

i don't understand  wy it doesn't work, if the applescript var are set as ... "set ServerDisk to "afp://2.236.100.143/dati" ... it work.

Were i am wrong?

Many thanks.


    set ServerDisk to field ("ServerDisk_as" as text) of table ("__AS" as text)
    set ServerFolder to field ("ServerFolder_as" as text) of table ("__AS" as text)
    set VarAccount to field ("VarAccount" as text) of table ("__AS" as text)
    set VarPw to field ("VarPassWord" as text) of table ("__AS" as text)

tell application "Finder"
    display dialog ServerFolder
    if not (disk ServerDisk exists) then
        mount volume ServerFolder as text as user name VarAccount with password VarPw
    end if
end tell

Link to comment
Share on other sites

33 minutes ago, Franco Pagano said:

i don't understand  wy it doesn't work

"doesn't work" is not a useful description.

Anyway, your title says set var to cell "myfield" but you are actually using set ServerDisk to field ("ServerDisk_as"...) - which is a quite different thing.

If your field is global, then:

set ServerDisk to cell "ServerDisk_as" of table "__AS"

should do the job.

 

Edited by comment
Link to comment
Share on other sites

solved also in this way:

 

set ServerFolder to cell "_PathLocalAfp" of current record as text
set VarAccount to cell "Server account" of current record as text
set VarPw to cell "Server pw" of current record as text

tell application "Finder"
    --display dialog ServerFolder
    try
        if  not (disk ServerFolder exists) then
            mount volume ServerFolder as user name VarAccount with password VarPw
        end if
    end try
end tell


many thank for your help

Link to comment
Share on other sites

21 minutes ago, Franco Pagano said:

set ServerFolder to cell "_PathLocalAfp" of current record as text

Just as a point of good practice: the value of a global field is the same for all records in the table - so the qualification "of current record" is quite redundant. If the field is present on the current layout, and the current layout is a layout of the table where the global field is defined, you can get its value just by:

set myVar to cell "gSomeglobalfield"

I also don't see what difference the "as text" part makes.

Link to comment
Share on other sites

This topic is 1803 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
 Share

  • Similar Content

    • By Asu
      Hello, I hope this is a simple question: Is there a reverse of the "Quote()" function, that would turn a calculated AppleScript in FM back to a straight AppleScript? I have a very complex  calculated AppleScript that I need to retest. Thanks.
    • By Asu
      Hello, I have a database that I run on 3 different computers, all with Mac OS 11.2. FMpro is 18.0.3.317.
      A script uses an AppleScript that opens a browser. The AppleScript invokes System Events and contains a "do shell script" step.
      On all computers, FMPro, Script Editor Script Menu are "allowed to control computer" in System Prefs.
      In the other 2 computes, with the Intel chips, the script runs flawlessly but it stumbles on the M1. M1 vs Intel is the only difference between there 3 setups. I know that v18 is not officially supported with Big Sur but the programs runs perfectly well. Any suggestions would be appreciated.
    • 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 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?
    • By fed
      I just upgraded to FMP16 from FMP13.  My applescripts no longer work.  I get an error of -10004, for which I cannot find an explanation.
      Any idea what I must change to make Applescripts work in FMP16?
  • Who Viewed the Topic

    3 members have viewed this topic:
    whardy  Bert de Vries  doughemi 
×
×
  • Create New...

Important Information

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