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

Hi, Im struggling with the syntax to perform AppleScript (Calc applescript section)


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

Recommended Posts

  • Newbies
Posted

I can  get the native apple script to work within the scripting , however when I try and covert it to work within the Calculated section I'm struggling to find the correct method and syntax. Having searched the net for days and tried multiple ways I'm desperate for some help.

 

The native apple script is 

 

set theStartDate to (current date) + (1 * days)

set hours of theStartDate to 15 set minutes of theStartDate to 0

set seconds of theStartDate to 0 set theEndDate to theStartDate + (1 * hours)

tell application "Calendar"    

tell calendar "Home"         make new event with properties {summary:"Important Meeting!", start date:theStartDate, end date:theEndDate}    

end tell

end tell

 

What I am trying to do by moving it to Calc section is introduce  variables for the message summary " $TempName" and $TempDays which will create an event in the Calendar with the clients name at a given number of days from today.

Any suggestions would be greatly appreciated

 

Regards

 

Colin

  • Newbies
Posted

Hi Thanks, No that didn't help . I can get it to work by putting the whole apple script in a text field and then just run it through the cal script.

But I can't see how to integrate the variables- when ever I try I just can't get the syntax right either by using forward slashes etc.

If its possible to see an example  of what the syntax would look like if the above script was entered into the calc filed of the apple script

 

Thanks

 

Colin

Posted
10 minutes ago, Colin Yorkshire said:

I can't see how to integrate the variables

I thought that's exactly what that post shows. If you had followed the first option, you would have ended up with something like:

"set theStartDate to (current date) + (" & $TempDays & " * days) 
set hours of theStartDate to 15 
set minutes of theStartDate to 0 
set seconds of theStartDate to 0 
set theEndDate to theStartDate + (1 * hours) 
tell application \"Calendar\" 
tell calendar \"Home\" 
make new event with properties {summary:\"" & $TempName & "\", start date:theStartDate, end date:theEndDate} 
end tell 
end tell"

(line breaks added for readability).

If you had followed the second option, you would have:

Let (
template = "set theStartDate to (current date) + («tempdays» * days) ¶set hours of theStartDate to 15 ¶set minutes of theStartDate to 0 ¶set seconds of theStartDate to 0 ¶set theEndDate to theStartDate + (1 * hours) ¶tell application \"Calendar\" ¶tell calendar \"Home\" ¶make new event with properties {summary:\"«tempname»\", start date:theStartDate, end date:theEndDate} ¶end tell ¶end tell"
;
Substitute ( template ; 
[ "«tempdays»" ; $TempDays ] ;
[ "«tempname»" ; $TempName ]
)
)

--
Please note that I did not test your original AppleScript.

  • Newbies
Posted

Hi. Sorted out the problem using method 2. Great-Many Thanks for the help. 

Is there a possibility of transferring a message along with the create event to put into the notes section

 

Colin

Posted (edited)
1 hour ago, Colin Yorkshire said:

Is there a possibility of transferring a message along with the create event to put into the notes section

Not sure what that means exactly. You can pass any data to the AppleScript using one of the methods suggested above.

Edited by comment
  • Newbies
Posted

Yes, I understand that but I’m trying to find out what the field names are for calendar so I can specify it in the apple script. did a lot of searching but couldn’t find anything specifying the notes field

Posted (edited)

I still don't understand your question. It seems to be more about the Calendar application than about Filemaker. If you need to know how to make AppleScript do something in Calendar, open the Calendar's dictionary in Apple's Script Editor.

Edited by comment

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