Reputation: 7004
Is there a way by which, when I open a query in LINQPad, it executes it and puts me in the result-only view? The intended use case for this is to write small applications within LINQPad. I don't want to hit F5 and Ctrl+Shift+R every time.
The motivation for this is the recently released RegEx utility in 5.36. This is also a script that does the same.
Upvotes: 4
Views: 600
Reputation: 30964
I've added an Util.OpenQuery
method to the next build:
public static Task<bool> OpenQuery (string queryPath, bool run = false,
bool hideEditor = false, params object[] args)
You'll then be able to call this from the Automator query:
void Main (System.Windows.Forms.Keys key, string currentQueryPath)
{
if (key == (Keys.Shift | Keys.Control | Keys.Alt | Keys.F1))
Util.OpenQuery (@"my query.linq", true, true);
}
This will allow you to automate up to 12 queries (with hotkeys Alt+Shift+Ctrl+ [F1-F12])
Upvotes: 7
Reputation: 26926
You can launch LINQPad from the command line with arguments to run a script file:
linqpad "path to file" -run
Then if you add the line
System.Windows.Forms.SendKeys.SendWait("^+R");
As the first line in Main
, the code will be hidden.
Note the linked answer's suggestion for closing LINQPad at the end of the script.
Upvotes: 4