Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

First off my background is 20 years developing applications in high level language, less then 6 months working in FM and 3 days trying to use Applescript.

My current situation is to try to integrate AS with FM to auto create folders for use in our companys "ERP". The DB I have setup has the AS in a calculation field, there were no errors when I finished setting it up.

The DB contains 4 fields...

1. FolderPath Text

2. SubFolderPath Text

3. Program_ID_Serial_No Text Serial Number on creation with Current Value: “PGMR00486” Increment: “1”

4. _cFolder_AS Calculation (Text)

 Unstored, = "tell application "Finder"¶ 

If not exists folder "" & FolderPath & Program_ID_Serial_No & ":") then¶ 

make new folder at alias "" & FolderPath & "" with properties {name: "" & 

Program_ID_Serial_No & ""}¶ 

if not exists folder "" & SubFolderPath & Program_ID_Serial_No & "_Accounting" & 

":") then¶ 

make new folder at alias "" & SubFolderPath & "" with properties {name: "" & 

Program_ID_Serial_No & "_Accounting" & ""}¶ 

end if¶ 

if not (exists folder "" & SubFolderPath & Program_ID_Serial_No & "_Art_BW" & ":") 

then¶ 

make new folder at alias "" & SubFolderPath & "" with properties {name: "" & 

Program_ID_Serial_No & "_Art_BW" & "" }¶ 

end if¶ 

end if¶ 

end tell" 



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

The script that executes the AS thsi is where the problem occurs....


Set Variable [ $FolderPath; Value:"Users:michaellange:Documents:Programs:" ] 

Set Variable [ $SubFolderPath; Value:"Users:michaellange:Documents:Programs:ProgramName:" ] 

Set Field [ AStest::FolderPath; $FolderPath ] 

Set Field [ AStest::SubFolderPath; $SubFolderPath ] 

Perform AppleScript [ Calculated AppleScript: AStest::_cFolder_AS ]

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

When it gets to the point of the Perform AS the fields FolderPath and SubFolderPath do not contain anything.

The SET FIELD doesn't seem to insert the variable, not sure why not.

Could it be because of the way I defined the SET VARIABLE.

Thanks

Michael

Double-check that the fields FolderPath and SubFolderPath are defined to be Text fields.

Also make sure that the script is launched from (or changes to) an appropriate layout so that the target fields are reachable.

Edited by Guest

Why don't you throw that whole AS calc in the Data Viewer and see what it looks like (assuming you've put the paths into the FolderPath and SubFolderPath fields first).

  • Author

OK, got it working to a certain degree.

I've been running this sequence from my test DB and layout before going live.

I ran into a similar issue a couple of weeks ago.

I was trying to print a layout I was working on to see how it would look on paper but was unable to print it, the reason no records.

Seems FM actually requires a record be present before you can actually do anything with it(insert expletive here).

This has been added to my FM #$%##^ list.

Anyway, I now just have to fix a few things in my AS and I should be good to go.

Thanks for the help.

Michael

Create an account or sign in to comment

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.