Zugriff auf Safari Bookmarks aus 4D

Suppose while using 4D webarea you’d like to have access to Safari-Bookmarks (which are synched between your devices since iOS8 and Yosemite if you opt in). Seems easy, this runs fine in terminal
/usr/bin/plutil -convert xml1 -o - ~/Library/Safari/Bookmarks.plist | grep -E -o 'http[s]{0,1}://.*' | grep -v icloud | sed -E 's/<\/{0,1}string>//g'

LAUNCH EXTERNAL PROCESS needs some help.

    • you need to escape the backslash „\“ by „\\“.

So the code reads
/usr/bin/plutil -convert xml1 -o - ~/Library/Safari/Bookmarks.plist | grep -E -o 'http[s]{0,1}://.*' | grep -v icloud | sed -E 's/<\\/{0,1}string>//g'

    • the pipe „|“ is a shell-command

This means executing the command through a shell like this $cmd:=“/bin/sh -c \““+$cmd+“\““

Here the three lines in their entirety
// I keep that kind of string outside of the 4D method-editor, Xliff is just fine and supports utf-8
$cmd:=Get localized string(„termSafariBookmarks“)
$cmd:=“/bin/sh -c \““+$cmd+“\““
LAUNCH EXTERNAL PROCESS($cmd;$in;$out;$err)
in $out there will be all bookmark-urls, linefeed-separated