Restart WL programmatically?
Author: kelvinyip
Creation Date: 7/28/2018 12:01 PM
profile picture

kelvinyip

#1
I have this strategy that would add/remove symbols to my dataset daily. However, as Eugene pointed out in my other questions, I need to restart WL so those updated dataset would get picked up by WL.

Is there an API I can call to just restart WL ?

Upon restart, can I launch strategy monitor automatically ? (WL API to do stuff upon startup ?)

I was going to look at my previous questions and see if Eugene answered those in my prior post before but I can't figure out how to search by user handle in the forum....

thx
profile picture

Eugene

#2
This is not a use case and there is no need in such API. As a completely unsupported workaround you could try something like this:

https://stackoverflow.com/questions/779405/how-do-i-restart-my-c-sharp-winform-application#3737299
https://stackoverflow.com/questions/9603926/restart-an-application-by-itself

An alternative might be to use a 3rd party scripting solutions like AutoIT. The process might work like this: your Strategy creates a semaphore file on your disk when it's ready to get WLP restarted, the AutoIT script restarts the application etc.

Note that we will not guarantee that using any of these approaches won't break something like corrupting some WLP configuration files along the way.

P.S. Just for the sake of completeness. It is possible for custom tools to pick up the symbol changes across DataSets without restarting WL. Extensions like the Data Tool accomplish this by inheriting their GUI classes from IItemTracker<DataSource>. It's completely undocumented and no code example exists. I doubt it would work in a Strategy anyway so it's not your use case.
profile picture

Panache

#3
It's pretty trivial using AutoHotKey.

CODE:
Please log in to see this code.
profile picture

kelvinyip

#4
thx. let me google this hotkey thing
profile picture

Panache

#5
https://www.autohotkey.com/

Basically, it allows you to do programmatically just about anything you can type on your computer. #w:: tells AutoHotKey that when the Windows Key and the W are pressed at the same time, to do all this.

I have a slightly more complex script which starts Wealth-Lab Pro every weekday morning, runs my Strategies and shuts Wealth-Lab Pro down at night. Somewhere on the forums, there's a post from me describing this in detail.
profile picture

kelvinyip

#6
thx. didn't know that windows can now do what unix can do ha ha
profile picture

Eugene

#7
Sorry for offtopic.

What do you mean "unix can do"? It's AutoHotKey that inspired the creation of its Linux ports like xaut and IronAHK. Not the other way around.
This website uses cookies to improve your experience. We'll assume you're ok with that, but you can opt-out if you wish (Read more).