Page 1 of 1
Using Applescript libraries from LC
Posted: Wed Aug 29, 2018 9:54 am
by trevix
In the AS Script Editor, after having installed the Shane's "CalendarLib EC" in the script folder, this script
works fine, deleting a specific event from the OSX Calendar.app (replace <UID> with the UID of the event):
Code: Select all
use script "CalendarLib EC" version "1.1.3" -- put this at the top of your scripts
use scripting additions
set theStore to fetch store
set theEvents to fetch events by UID "<UID>" event store theStore
try
remove event event item 1 of theEvents event store theStore with future events
on error theErr
return "NotFound"
end try
Saved in the LC properties and run from a LC script with the "using Applescript",
does not work any more.
Please note that other conventional AS scripts, that don't use the Shane's library, work fine, like creating new events or the following (check if Calendar.app is open or not)
Code: Select all
set appName to "Calendar"
if application appName is running then
tell application appName
--activate
set TheVis to the visible of front window
if TheVis is false then
set the visible of front window to true
--keystroke "0" using command down
end if
end tell
return true
else
return false
end if
All permissions are fine.
Any clues?
Trevix
Re: Using Applescript libraries from LC
Posted: Wed Aug 29, 2018 4:59 pm
by trevix
One more thing.
I modified and streamlined the script to this:
Code: Select all
use scripting additions
use myLib : script "CalendarLib EC" version "1.1.3"-- Stored in my ~/Library/Script
try
set theStore to (fetch store)
on error terr
return terr
end try
in the result I get:
"Unable to load the" EventKit "bundle because it does not contain any version for the current architecture."
Re: Using Applescript libraries from LC
Posted: Wed Aug 29, 2018 5:45 pm
by richmond62
1. I understand absolutely nothing about how one might use AppleScript inside LiveCode.
2. I don't know why one would bother when one can use LiveCode's own language.
3. BUT, I did read this:
http://runtime-revolution.278305.n4.nab ... 61727.html
Which would seem to suggest you need to have something like this:
do tScript as applescript
somewhere.
There's nothing quite like a web-crawl after supper:
"you cannot tell LC "do script xyz" from OUTSIDE of Livecode"

Re: Using Applescript libraries from LC
Posted: Wed Aug 29, 2018 5:57 pm
by richmond62
the current architecture
PPC/INTEL . . .
32/64 bit . . .
https://macscripter.net/viewtopic.php?id=18010
Re: Using Applescript libraries from LC
Posted: Wed Aug 29, 2018 6:40 pm
by trevix
Hi
2. I guess you never had the need to add/modify/delete events on the OSX Calendar. (No way with LC)
3. off course I do a "do as applescript". That's not a problem
I use the Shane's external library because is fast (based on the OSX EventKit) and does not need the Calendar.App to be open.
I also read/modify/create Calendars and Events using a mix of Applescript and SQLite reading (from the Calendar cache file).
What I am not able to do is delete an Event.
The only Applescript that seems to be able to delete an event is if using Shane's library.
Works perfectly in the "Script Debugger.App" but not on Livecode
Regards
Trevix
Re: Using Applescript libraries from LC
Posted: Wed Aug 29, 2018 7:38 pm
by trevix
News: solved
I downloaded LC 9.0.1 (I was using 8.1.10).
Everything works fine for deleting events using the Library "CalendarLib EC".
I guess is a LC8.1.10 bug.
Should I report it or LC8 is dead?
Re: Using Applescript libraries from LC
Posted: Wed Aug 29, 2018 7:43 pm
by bogs
That is a good question. I wish I had a good answer
Myself, I would report it if it hasn't already been done.
Re: Using Applescript libraries from LC
Posted: Wed Aug 29, 2018 7:57 pm
by richmond62
Should I report it or LC8 is dead?
It is supposed to be dead: but I think it is a "
bit naughty" leaving it with several bugs.
Had a "shaky" problem with it on Linux about 3 days ago.
Re: Using Applescript libraries from LC
Posted: Wed Aug 29, 2018 11:02 pm
by FourthWorld
richmond62 wrote: ↑Wed Aug 29, 2018 7:57 pm
Should I report it or LC8 is dead?
It is supposed to be dead: but I think it is a "
bit naughty" leaving it with several bugs.
In 30 years in the biz I've never seen bug-free software. As with companies and big and small, from drawing apps to operating systems, each new version is a superset of capabilities found in older version, along with new bug fixes as well.
Everything you like about 8 should be in 9. If you find something that isn't, please file a bug report.
Re: Using Applescript libraries from LC
Posted: Thu Aug 30, 2018 8:18 am
by richmond62
Everything you like about 8 should be in 9.
One thing isn't: it doesn't run on my favourite hardware.
