Read from Safari's bookmarks.plst: "extractText" vs. "set the text"

23 views
Skip to first unread message

komouton

unread,
Jun 21, 2018, 2:18:25 PM6/21/18
to superca...@googlegroups.com

I want to read information of Safari's bookmarks.plst and put it into a variable.


The plist file is a binary plist "~/Library/Safari/Bookmarks.plist".


Two ways are available: one is using "extractText" function, and another is using "set the text" command. The latter needs a field for buffering.


[Method 1]

on mouseUp

  put the ticks into t

  get extractText(POSIXtoHFS(cd fld "plistPath"),"plist")

  put the ticks - t into cd fld "result1"

end mouseUp


[Method 2]

on mouseUp

  put the ticks into t

  set the text of cd fld "buffer" to utf8 file POSIXtoHFS(cd fld "plistPath")

  get cd fld "buffer"

  put the ticks - t into cd fld "result2"

end mouseUp


I think these ways are essentially identical, but, elapsed times of them are significantly different.


In my trials, "extraText" function requires few minutes, while "set the text" command only few seconds.




Why does "extraText" need such long time?

Mark Lucas

unread,
Jun 21, 2018, 5:03:12 PM6/21/18
to superca...@googlegroups.com
That’s a bug.

BTW the difference between these is that extractText returns the raw text (which may be Unicode), whereas setting the text converts to MacRoman.
Reply all
Reply to author
Forward
0 new messages