In order to remember old-posts, I show 4 posts (selected at random from all posts) in top page of my blog via :
$newquery = new WP_Query(‘showposts=4&orderby=rand’).
How to write an Applescript to do the same function in EF?
For example, it shows four records (selected at random from ALL records) with title in Records list windows.
I tried to follow examples of EF scripts, but they seem to concern “selected” records and not to “selecting”.
The selected records property is settable. For example:
tell application "EagleFiler"
tell library document 1
set _records to {library record id 157}
end tell
tell browser window 1
set selected records to _records
end tell
end tell
I CAN get record via changing library record id from 157. Selected record (in Record list window) appears with auto-scroll and is highlighted with grey color. Great !!
Two more questions:
How to add such an id number on each record in EF?
In alphabetical way, with first-come and first-import style or under other rule? Some ids seem to miss records.
Maximum number of id is total number of records?
Scope of random id generator needs this value.
I can get record at random from oldest 1/10 of all records.
set _count to get count of library records
set _num to random number from 1 to round (_count / 10)
set _myrecord to get library record _num
set _title to _myrecord’s title
By the way, _count is 2 even when the library has NO record.
Index number 1 and 2 may correspond to [Records], [Files] or [Trash] ?
I will try to make more complicated script from now.