Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

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

Recommended Posts

Posted

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

Posted (edited)

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
Posted

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).

Posted

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

This topic is 5464 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.