Author |
Topic |
|
tia34531
18 Posts |
Posted - 11/25/2013 : 21:30:59
|
Hi... I have some questions 1. Can I use "OS-running-time from the boot"? ----------------------------------------------------------------- if acGetProcessIDFromPattern("ucloud.exe" == 0) then acRunProgram("C:\\Program Files (x86)\\ucloud2\\ucloud.exe","",0, 1) end ------------------------------------------------------------------- When I add some start-pragram in the "Global Lua" tab of S+ like above code, It would be better if I could use such conditions as "within 1 munite from the boot" because when I write 'S+ actions' and click 'apply' or 'ok' button, it runs every time if it's not running.
2. ----------------------------------------------------------------- if acGetProcessIDFromPattern("uTorrent.exe" == 0) then acRunProgram("D:\\uTorrent(portable)\\uTorrent.exe","",0, 1) end ------------------------------------------------------------------- In this case, I want to add "if *.torrent file exists (in specific folder), run uTorrent" when I start the computer
3. file deleting....(Configure Actions tab) I searched about Lua Scipt in the web, and found some, but can't apply to S+. File name is in the Clipboard, and path and extentions are already given, could you give me some examples performing file deleting... The code I can think of : --------------------------------------------------- local aFile= acGetClipboardText() OS. remove("D:\\temp\\aFile.exe") ------------------------------------------------------
4. Getting ControlFocus... I know it's not possible in the S+, but I thought it might be possible, when using Lua. Can I get specific control focuesd when I know the control name and class name of the window. It is the case that sending keys, if not correct control focused, is not working. additionaly, by using Lua Scipt, Could I terminate a process by finename(ex.SMSvcHost.exe)?
Sorry for so many questions,,, Have a nice day.. |
Edited by - tia34531 on 11/25/2013 22:10:48 |
|
Rob
USA
2615 Posts |
Posted - 11/25/2013 : 22:17:08
|
1 & 2:
Generally speaking, S+ wasn't designed to start programs on boot. However, you could put the code above in Global Lua using the sp_init function which is only executed once when S+ starts:
function sp_init() if acGetProcessIDFromPattern("ucloud.exe" == 0) then acRunProgram("C:\\Program Files (x86)\\ucloud2\\ucloud.exe","",0, 1) end end
3:
Does this not work?
local aFile= acGetClipboardText() os.remove(aFile)
I'm not able to test at the moment, though.
4:
That is a very advanced request. Honestly, I'm not sure if it's possible at all, Lua or WinAPI, but the only way it might be possible is via WinAPI calls, which can be defined and called via Lua, but I really don't feel with a great deal of confidence that you will be successful. However, you may be able to manually set focus to a given window (control) handle prior to sending keystrokes, but it may be a little tricky to accomplish. Using SetFocus along with the required AttachThreadInput, it is technically possible; although unless you're really committed to making it happen, it may not be a fruitful endeavor
|
|
|
|
Topic |
|
|
|