This project has moved. For the latest updates, please go here.

Script to self-terminate?

Aug 12, 2014 at 10:16 PM
Hello, would like to have a script that causes Move Mouse to close after a certain amount of time, so that I could enable the option for Move Mouse to call the script upon "start" and then after the amount in the script the program would close. Can anyone help?
Coordinator
Aug 13, 2014 at 10:38 AM
Here you go:
Start-Sleep -Seconds 5
Stop-Process -Name 'Move Mouse' -Force
Marked as answer by sw3103 on 1/26/2015 at 4:55 PM
Aug 13, 2014 at 2:11 PM
Thanks, but not sure if I'm doing it right? I cut and pasted this into the script and set it to be executed when the program starts, but it remains open.
Coordinator
Aug 13, 2014 at 5:01 PM
Edited Aug 13, 2014 at 5:01 PM
If you open PowerShell and run these commands whilst Move Mouse is open, do they work?
Aug 14, 2014 at 5:42 PM
I got an error message but then again I'm not very familiar with PowerShell...
Coordinator
Aug 14, 2014 at 10:57 PM
Can you give me some more details? Was it an error opening up PowerShell, or running the commands?

What was the error?
Aug 20, 2014 at 4:11 PM
I was able to use your suggestion successfully by manually creating a batch file and putting in the following: "powershell Start-Sleep -Seconds 5 ;
Stop-Process -Name 'Move Mouse' -Force"

However, I'm confused as to how I can implement either the batch file or the language in it through the Script function. I tried putting a link to the batch file in the script box, and also copying the language directly into the box, but neither worked. Any suggestions?
Coordinator
Sep 8, 2014 at 1:39 PM
Edited Sep 8, 2014 at 1:39 PM
In the "Scripts" tab, tick the "Execute a script when Move Mouse starts" option. Make sure the other options are un-ticked.

In the "Scripting Language" drop-down box, select "PowerShell".

The "Edit" button should be enabled next to the "Execute a script when Move Mouse starts" option. Click this button to launch the script editor (probably Notepad).

Paste the following code into the script editor (replacing anything in there already), then close and save the file:
Start-Sleep -Seconds 5
Stop-Process -Name 'Move Mouse' -Force
That should be it.
Sep 15, 2014 at 11:52 PM
I followed your instructions but still not working unfortunately, the program simply remains open as usual. Oh well, perhaps this can be implemented in a future version? :)
Coordinator
Sep 16, 2014 at 9:58 AM
Can you type the following command in a PowerShell window, and let me know what the result is?
Get-ExecutionPolicy
Sep 16, 2014 at 3:25 PM
It said "restricted" so I was able to figure out how to change that, and now script works, thanks!
Coordinator
Sep 16, 2014 at 3:44 PM
Phew!

:o)