Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Some problems encountered in copying code LA from Linqpad
#8
If want to use script.setup but not in script code, probably the best way is this:

1. Create a class file like this:
Code:
Copy      Help
// class "script_setup_tray_icon.cs"
class _ModuleInit_ {
    [
ModuleInitializer]
    public static void Function1() {
        script.setup(trayIcon: true, sleepExit: true);
    }
}

2. Add the class file in scripts where you want to use this script.setup, like this:

Code:
Copy      Help
// script ""
/*/ c \script_setup_tray_icon.cs; /*/

dialog.showYesNo("Do you see my tray icon?");

You can create several such class files, each with different script.setup arguments or completely different code. Then some scripts can use class file 1, some scripts class file 2...

And edit the template in Options. Let it be empty or contain just the /*/ ... /*/.

Note that module initializers run before other code, therefore something may not work. But script.setup should work. Not tested much.


Messages In This Thread
RE: Some problems encountered in copying code LA from Linqpad - by Gintaras - 10-13-2022, 02:28 PM

Forum Jump:


Users browsing this thread: 2 Guest(s)