system.cook

A script that runs at startup.

The system.cook is a script runs at startup automatically. If the system.cook is in the same directory as Cooker.exe, the Cooker will try to call the appropriate method when needed.

Method calls are tried when the application starts and ends, and when the appropriate shortcut key is pressed.


The definition of system.cook is optional. If it exists, the system will try to call the appropriate method.

Initial implementation.

The distribution archive contains system.cook. The implementation is shown below.

1:

class main

2:

browser _br;

3:

message _m;

4:

open method void start()

5:

endmethod

6:
7:

open method void end()

8:

endmethod

9:
10:

open method void F1()

11:

_br.LoadUrl("https://www.google.co.jp/");

12:

endmethod

13:

open method void F2()

14:

_br.GoBack();

15:

endmethod

16:

open method void F3()

17:

_br.GoForward();

18:

endmethod

19:

open method void F4()

20:

_m.Icon = 3;

21:

_m.Show("F4() is not implemented.");

22:

endmethod

23~50:

...

51:

open method void F12()

52:

_m.Icon = 3;

53:

_m.Show("F12() is not implemented.");

54:

endmethod

55:

endclass

start(browser) and start()

If the following methods are defined in system.cook, they will be called only once after the first page navigation of the Main-browser is finished.

open method void start(browser)

open method void start()

If only one is defined, the defined method will be called. If both are defined, start(browser) will be called and start() will not be called.

If start(browser) is defined, the instance of the browser class passed as an argument represents the Main-browser.


You have to define either start(browser) or start() in a normal .cook script, but these are optional in system.cook.

The above code defines an empty start(), but it works fine without it.

end(browser) and end()

If the following methods are defined in system.cook, they will be called at the application ends.

open method void end(browser)

open method void end()

If only one is defined, the defined method will be called. If both are defined, end(browser) will be called and end() will not be called.

If end(browser) is defined, the instance of the browser class passed as an argument represents the Main-browser.


Definition of the end method is optional. The above code defines an empty end(), but it works fine without it.

Shortcut keys

If the methods F1() to F12() are defined, the shortcut keys, Alt + F1 to F12, will call the corresponding methods. The definition of these methods is optional. It works fine without it.

Termination of the application has been assigned to Alt + F4. If the F4() method is defined, the call to the F4() method takes precedence, otherwise the application exits.

Copyright © Cooker All rights reserved.