add to "Global Lua" a function sp_init() to execute code at fist start after initialitation. f.e. if i insert acSetProcessPriority(acFindWindow("STROKESPLUS"), nil, nil, 0x00000020) in the "Global Lua" it not work at start because it is reinitialized.
Instead of a new function support, which I don't think is necessary here, I'm moving the Lua init code to be called after all S+ initialization is complete in 2.4.6.
So your code above would work fine, so would the tray icon toggle call...which are really the reasons you're requesting this feature, I believe.
quote:Originally posted by RobSo your code above would work fine, so would the tray icon toggle call...which are really the reasons you're requesting this feature, I believe.
acToggleTrayIcon() not seem to work at startup.
If i use: acMessageBox("1","2",0) acToggleTrayIcon()
the icon appear and show messagebox click the icon disappear and show messagebox click the icon reappears
Ok, sp_init() is needed because of the dual Lua states; added in patch 2.4.7.
sp_init() will ONLY be called from Lua state 1. What this means is you shouldn't use sp_init() for anything which you want initialized/defined/called in both Lua states...only stateless/non-persistent code should be used here.
Also note that when you click Apply or OK in the Settings window, both Lua states are re-initialized. This means that sp_init() will be called again...and if you click Reload Config and Lua Engine from the tray icon.
I've also updated acToggleTrayIcon to accept a parameter:
-1 : Hide icon
0 : Toggle icon (same as passing no parameter)
1 : Show icon
So if you call acToggleTrayIcon(-1) and the tray icon is already hidden, nothing will happen.