How to avoid the (posix) file bug when using framework "Foundation"

Because I do time conversions I have

use framework "Foundation" 

in my script. However this makes things like

set theText to read POSIX file "/Users/olli/myfile.txt"

fail

I saw Question about ‘use framework “Foundation”, and the solution seems to be a type coercion

... as <<class furl>>

but I have no idea how to type the Guillemets. (Yes, I didn’t know either that these chars are called Guillemets…)

Furthermore I hope that there is another, more general way to do this…

On an English-language keyboard they are option-\ and option-shift-, but I think it varies in other languages. If you are using Script Debugger, go to Preferences → Text Substitutions, turn it on, and click the entries that turn << into « and >> into » as you type them.

Either:

set theText to read ("/Users/olli/myfile.txt" as POSIX file)

or in this particular case:

set theText to read "/Users/olli/myfile.txt"

The latter is fine with scripting addition commands like read, but applications should generally be sent file objects rather than just paths.

As far as I know, every machine is able to give you needed infos about the keyboard.
System Preferences > Keyboard > Input Sources
check the box entitled “Show Input menu in menu bar”

Then, in the menu bar select the [Input menu] among the set of menus available on the right of the menu bar (often just at left edge of the date)

Select the item “Show Keyboard Viewer”
press alt or alt + shift and look carefully what is displayed.
On a French Azerty keyboard the « is get when we press alt + [7] (è)
On a French Azerty keyboard the » is get when we press alt + shift + [7] (è)

Yvan KOENIG running High Sierra 10.13.6 in French (VALLAURIS, France) mercredi 27 mai 2020 13:56:41

Super thanks. That’s exactly what I was hoping for. :slight_smile: