Suppose I want to have a keyboard key which when pressed once, runs nomousy.exe with a parameter, to hide the mouse cursor:
nomousy.exe /hide
Then I press the key again to run:
nomousy.exe
...which brings the cursor back again. So it's a toggle on-off mouse cursor.
I can't find how to run external programs from Freepie!
How do I run a small external program from Freepie?
-
- One Eyed Hopeful
- Posts: 6
- Joined: Sat May 30, 2015 4:28 pm
-
- Cross Eyed!
- Posts: 197
- Joined: Mon Mar 02, 2015 3:58 pm
Re: How do I run a small external program from Freepie?
This seems to work:
Code: Select all
import subprocess
if keyboard.getPressed(Key.A):
subprocess.call(['C:\\Windows\\SysWOW64\\calc.exe'])
- zelmon64
- Cross Eyed!
- Posts: 134
- Joined: Thu Apr 09, 2015 4:27 am
Re: How do I run a small external program from Freepie?
I didn't know of the subprocess python module so I had a go at adding open and close functions to the window plugin. It can be used like this:
@Jabberwock do you if adding these functions to the window plugin would have any benefits over the subprocess module?
Code: Select all
program = "notepad"
windowopen = False
if starting:
windowopen = window.open(program, r'/A "settings.xml"')
if stopping:
windowopen = window.closeMainWindow(program)
diagnostics.watch(windowopen)
diagnostics.watch(window.getActive)
You do not have the required permissions to view the files attached to this post.
-
- Cross Eyed!
- Posts: 197
- Joined: Mon Mar 02, 2015 3:58 pm
Re: How do I run a small external program from Freepie?
I have no idea, as I have just found the code online...
-
- One Eyed Hopeful
- Posts: 6
- Joined: Sat May 30, 2015 4:28 pm
Re: How do I run a small external program from Freepie?
Thanks both, your ideas have helped me make progress, I'll keep fiddling for a while
-
- One Eyed Hopeful
- Posts: 6
- Joined: Sat May 30, 2015 4:28 pm
Re: How do I run a small external program from Freepie?
I'm having trouble. I want to hide the mouse cursor with a toggle hotkey, using a tiny utility called nomousy.exe
Usage: hide cursor -- execute "nomousy.exe /hide"
show cursor again -- execute "nomousy.exe"
Suppose the cursor has been hidden by a successful call of
nomousy.exe /hide
Then, this works in Freepie to unhide the cursor:
import subprocess
if keyboard.getPressed(Key.ScrollLock):
subprocess.call(['C:\\Windows\\SysWOW64\\nomousy.exe'])
But I cannot get Freepie to do the hiding bit successfully, e.g.
subprocess.call(['C:\\Windows\\SysWOW64\\nomousy.exe /hide'])
I have tried many variations of path and syntax, different combos of quotation marks, etc. with no luck. It seems I don't know the right code to add a parameter to a program call. What do you think?
By the way I didn't understand the code about the 'window plugin' because I don't know what the 'window plugin' is, I'm afraid.
I've attached nomousy for your cursor-hiding pleasure!
Usage: hide cursor -- execute "nomousy.exe /hide"
show cursor again -- execute "nomousy.exe"
Suppose the cursor has been hidden by a successful call of
nomousy.exe /hide
Then, this works in Freepie to unhide the cursor:
import subprocess
if keyboard.getPressed(Key.ScrollLock):
subprocess.call(['C:\\Windows\\SysWOW64\\nomousy.exe'])
But I cannot get Freepie to do the hiding bit successfully, e.g.
subprocess.call(['C:\\Windows\\SysWOW64\\nomousy.exe /hide'])
I have tried many variations of path and syntax, different combos of quotation marks, etc. with no luck. It seems I don't know the right code to add a parameter to a program call. What do you think?
By the way I didn't understand the code about the 'window plugin' because I don't know what the 'window plugin' is, I'm afraid.
I've attached nomousy for your cursor-hiding pleasure!
You do not have the required permissions to view the files attached to this post.
-
- Cross Eyed!
- Posts: 197
- Joined: Mon Mar 02, 2015 3:58 pm
Re: How do I run a small external program from Freepie?
It seems it has to be a list of arguments, so possibly:
subprocess.call(["C:\\Windows\\SysWOW64\\nomousy.exe", "/hide"])
subprocess.call(["C:\\Windows\\SysWOW64\\nomousy.exe", "/hide"])
-
- Cross Eyed!
- Posts: 197
- Joined: Mon Mar 02, 2015 3:58 pm
Re: How do I run a small external program from Freepie?
There is also this:
http://nullege.com/codes/search/pygame. ... et_visible
but I do not know how to make pygame work with FreePIE.
http://nullege.com/codes/search/pygame. ... et_visible
but I do not know how to make pygame work with FreePIE.