One minor thing in the scripting interface:
Retrieving a URL for the root row will probably be a bit marginal and unusual:
tell application "Bike" to tell front document
URL of root row
end tell
but if we do evaluate an expression like that we get a duplication of the document ID in the virtual row ID, and attempting to follow a link of the pattern:
bike://YZDjdHU_#YZDjdHU_
(where the duplicated ID is that of an actual document)
seems to trip a problem:
Expand disclosure triangle to view log fragment
Termination Signal: Illegal instruction: 4
Termination Reason: Namespace SIGNAL, Code 0x4
Terminating Process: exc handler [78837]
( perhaps more of a url-handling issue than a scripting interface issue ? )
1 Like
Good catch, I’ll fix soon.
Good catch, I’ll fix soon.
On that topic – the URL
property appears to be defined for document
objects, but while this returns a value immediately,
tell application "Bike"
URL of first row of front document
end tell
I’m not sure whether the I error I get from evaluating URL
as a direct property of document
tell application "Bike"
URL of front document
end tell
Bike got an error: AppleEvent handler failed.
is expected ?
What is best practice, at this stage, for detecting childless ‘leaf’ rows ?
Is the best approach just to see whether the rows
property evaluates to an empty list ?
Expand disclosure triangle to view AppleScript draft
on isLeaf(bikeRow)
using terms from application "Bike"
{} = rows of bikeRow
end using terms from
end isLeaf
--------------------------- TEST -------------------------
on run
tell application "Bike"
set doc to front document
if exists doc then
if my isLeaf(front row of doc) then
"First row is a leaf"
else
"First row has child rows"
end if
else
"No document open in Bike"
end if
end tell
end run
Or perhaps to check for an empty entire contents
list ?
Expand disclosure triangle to view alternative isLeaf
on isLeaf(bikeRow)
using terms from application "Bike"
{} is entire contents of bikeRow
end using terms from
end isLeaf
What is best practice, at this stage, for detecting childless ‘leaf’ rows ?
I’m not sure, but I think checking count rows of bikeRow
would be fastest.
1 Like