Since I've been working on the TouchPad support, I found that many of the gestures I have defined for use with the mouse aren't practical for a TouchPad (like actions which use the left mouse button as a modifier).
So it became obvious that I needed to easily switch config files (StrokesPlus.xml). I made a copy of my StrokesPlus.xml and named it StrokesPlusTouch.xml and put it in the same directory as StrokesPlus.xml and made this action to allow switching between mouse and TouchPad configs:
--set the config directory to a variable for easy reading below
local base = "C:\\Users\\Rob\\AppData\\Roaming\\StrokesPlus\\"
if acInputBox("Profile", "Select S+ Config:", "Mouse|TouchPad", "|") == "Mouse" then
--Mouse selected, check to see if StrokesPlusMouse.xml exists
if file_exists(base.."StrokesPlusMouse.xml") then
--rename StrokesPlus.xml to StrokesPlusTouch.xml
os.rename(base.."StrokesPlus.xml", base.."StrokesPlusTouch.xml")
--rename StrokesPlusMouse.xml to StrokesPlus.xml
os.rename(base.."StrokesPlusMouse.xml", base.."StrokesPlus.xml")
end
else
--TouchPad selected, check to see if StrokesPlusTouch.xml exists
if file_exists(base.."StrokesPlusTouch.xml") then
--rename StrokesPlus.xml to StrokesPlusMouse.xml
os.rename(base.."StrokesPlus.xml", base.."StrokesPlusMouse.xml")
--rename StrokesPlusTouch.xml to StrokesPlus.xml
os.rename(base.."StrokesPlusTouch.xml", base.."StrokesPlus.xml")
end
end
--Tell S+ to reload the config and Lua engine
acReloadConfig()
Note that as of 2.6.4 Beta 4, acReload() behaves differently, posting a message to the EXE, which waits 500ms, then reloads the config and Lua engine. As such, make sure that if you're calling acReloadConfig(), you do not have any Lua that runs after the call, including functions in sp_after_action and sp_after_release (if either of those preferences are enabled).
If there is still Lua executing when S+ reloads everything (after 500ms), there's a possibility S+ will crash.