Page 1 of 1

Syntax for opening newly created files?

Posted: 09 Jan 2016 00:59
by Megalith
Sorry, this is probably obvious, but what syntax should I add to a script so a file is not only created but immediately opened?

Re: Syntax for opening newly created files?

Posted: 09 Jan 2016 02:12
by highend
open / openwith / run?

Re: Syntax for opening newly created files?

Posted: 09 Jan 2016 03:44
by Megalith
Yeah, but I can't figure out how to integrate the open command with, say, new("info.txt");.

Re: Syntax for opening newly created files?

Posted: 09 Jan 2016 10:14
by highend

Code: Select all

open new("info.txt", "file"), "w";

Re: Syntax for opening newly created files?

Posted: 10 Jan 2016 00:09
by Megalith
Oh, duh, so it was just a matter of adding "open" at the beginning. I played around with it and

Code: Select all

open new("info.txt");
seems to work fine; what does "file" and "w" do in your version?

Re: Syntax for opening newly created files?

Posted: 10 Jan 2016 00:15
by highend
"file" is the default for type in new() so it's not a necessity but I'm used to it (auto completion in my editor)
"w" = Use Window's associated application instead of preferring XY's PFA (and I use a script for all my PFAs...)