I’ve just discovered Servoy and i’m pretty convinced it can be the one tool to maintain all the databases we’re working with. At this moment i am planning to switch our projects to a *SQL/Servoy-based setup.
But there’s one difficulty: For catalogues and pricelists we use Applescripts to interact between Filemaker, InDesign and the Finder. Of course i’d like to do the same with Servoy. But the scripts we made are no ‘one trick ponies’ you can start by throwing a few lines through osascript. These scripts crawl through the pages of a catalogue layout, looking for text patterns, performing searches in the database, importing and exporting various database fields. Below i added some typical parts of such a script. How can i do that with Servoy? OK, i could bypass Servoy and make Applescript talk to the SQL server through another client, but i prefer an all-in-one solution. Do you plan to provide some accesibility for Applescript through Servoy in the future? Or should i first try to split our Applescript solutions into a library of ‘one trick’ functions that can be launched one by one from a Servoy script?
Sample scripts
Selecting a record
tell application "Servoy Client"
tell database 1 of window 1
try
show (every record whose cell "CatNr" = temp)
on error
return false
end try
end tell
end tell
Importing record data
tell application "Servoy Client"
tell window 1
set CR to the current record of database 1
set cell "ScrStatus" of CR to "Gegevens inlezen"
set Catnr to cell "CatNr" of CR
set CatPrijs to cell "CatPrijsNL" of CR
set CatPrijsPer to cell "CatPrijsPerNL" of CR
set CatExtra to cell "CatExtraNL" of CR
set cell "ScrStatus" of CR to "Gegevens ingelezen"
end tell
end tell
Exporting to InDesign
tell application "InDesign CS"
if not (exists BoxRef) then
set FrameRef to make text frame at M-,
beginning with properties M-,
{geometric bounds:{"10 mm", "10 mm", M-,
"72 mm", "54 mm"}, color:"none", M-,
runaround:"NNRN", name:CatID}
else
set FrameRef to object reference of BoxRef
end if
if not (exists BoxRef) then
return false
else
tell FrameRef
set x to ("art. " & Catnr & " " & CatKop & ". ")
set temp to x & CatTekst
tell text of parent story
set contents to temp
set applied paragraph style to "Normal"
end tell
end tell
end if
set CatPagina to (name of page PageNr of document 1) as text
end tell
References
An old Technote from Apple shows how to export Java objects and commands for Applescript availabity:
http://developer.apple.com/technotes/tn/tn1162.html
For the time being, this might be sneaky way to trigger some Servoy actions from AppleScript without need for ‘scriptability’:
http://www.apple.com/applescript/uiscripting/index.html