I’m working on a C++ editor.
How do I make it so that when I double-click a file associated with my app, it will set the contents of it into the main text field? I’ve tried this:
on open (f)
set (the contents of text view 1 of scroll view 1 of window 1) to read file f
end open
and it doesn’t work. Can someone please help? :o
Also, if I save the file in another program, like simpletext, then it associates it with xcode.
I’ve already added this to the infoPlist.strings:
Here’s the code I’m using to open files (+o)
set savepath to choose file with prompt "Open..."
set the contents of text field 1 of window 1 to savepath as string
set f to paragraph 2 of "
" & (savepath)
set (the contents of text view 1 of scroll view 1 of window 1) to read file f