How do I pause a vlc process from the command line? [duplicate] - cmd

Well i have an adobe air which runs vlc-player at background as service. i check that in Windows Task Manager , the service runs when air application launches.
here is the code
processArgs.push("--extraintf");
processArgs.push("rc"); //Remote control
processArgs.push("--rc-fake-tty"); //Use terminal as output
processArgs.push("screen://");
processArgs.push(":screen-fps=15");
processArgs.push(":screen-caching=100");
processArgs.push(":sout=#transcode{venc=x264{bframes=0,nocabac,ref=1,nf,level=13,crf=24,partitions=none},vcodec=h264,fps=15,vb=3000,width=800,height=600,acodec=none}:duplicate{dst=std{mux=mp4,access=file,dst='"+targetFile.nativePath+"'}}");
startupInfo.arguments = processArgs;
p = new NativeProcess();
p.addEventListener(ProgressEvent.STANDARD_OUTPUT_DATA, onOutputData);
p.addEventListener(ProgressEvent.STANDARD_ERROR_DATA, onErrorData);
p.addEventListener(NativeProcessExitEvent.EXIT, onExit);
now i want to close vlc-player on the button click event and i have searched the vlc- documents and found quit command and its syntax, it does not work as i have tried that syntax from windows command prompt also..
Which are the vlc-player commands that can pause,stop and close vlc-player??
Any useful link will be much helpful to me..

I've had quite a look around and looks like this (--rc-fake-tty) can't be done from Windows command line. Which means your current approach is out.
I don't no anything about Adobe but I have done some searching around and this guy has something written in C using the libVLC. Not sure if that will help or point you in the right direction.
The other thing I found was this post Adobe Air and VLC player which mentions that you should be able to use javascript and ActiveX controls on Windows. A guy in this forum has a javascript script which uses an ActiveX control to start, stop, pause etc.
There is a VLC command that you can send to override or set certain hotkeys. Search for next, prev, stop, quit, vol-up, etc in this document.
That's the best of my Googling abilities, hope it helps.

I dont want to agree that your code runs well on windows, becasue --rc-fake-tty will not run on windows, to hide the entire vlc window (it will be listed among the processes in Windows Task Manager) use --rc-quiet but to see command window use --no-rc-quiet.
To stop and quit using p.standardInput.writeUTFBytes("stop" + "\n"); is not working for me as well.

Related

Magnify.exe command line args

Does anyone know if there is any command line args that i could pass to the windows magnifier (magnify.exe) so it would open using the Lens view.
Or maybe some other way, I tried opening and sending a keyboard input using the shortcut to change the view, but often it blinks before changing the view! =/
I just had the need to do the same thing, and wound up here trying to find a solution. It's ridiculous to think that they wouldn't have a command line switch to set the views, so I started just trying some. And behold! I scored:
Magnify.exe /lens (defaults to lens view)
Magnify.exe /fullscreen (defaults to fullscreen view)
Magnify.exe /docked (defaults to docked view)
Good luck!
Magnify.exe /? on the command line does not expose any sort of help for the executable. And a search online does not seem to provide evidence of any command line arguments. Leads me to conclude that magnify.exe does not take command line arguments.
I recommend reading this article on sending keystrokes to another application. His demo app worked for me to send keyboard shortcuts to magnify.exe. His source code is available as well so you can integrate into your application.
you could try something with autoit, its a scripting language similar to basic that is really well suited for automating tasks
Along those lines this autoit script might be helpful - it lists some msdn doco and if you know
autoit a script.
Maginifier UDF
I am using a work-around.
I created a Windows-8-style batch file that has a command "magnify /on".
I'm not sure if the "/on" part is necessary.
The program that I am trying to magnify,
(which is an old DOS program that runs in a DOS-Box),
launches with the magnify window conveniently available for me to change the magnification setting.
I tried to include a command after closing, "magnify /off", but it does not work;
therefore the magnifier window box has to be clicked to change the magnification back to normal.
This is a great case for the UNIX "strings" utility, of which there is a Sysinternals version here
It takes some digging and testing, but I found these options:
wait (doesn't magnify until you hit a key)
noutilman
hardwarebuttonlaunch
fullscreen
lens
docked
hilight
globalhotkey

Completely locking down Windows 7 using Python 3.2?

This might be a more difficult question since I don't even know how to do it outside of Python...
I want to write a terminal program that completely locks up my PC until a password is entered. In the locked state no one should be able to do anything outside the terminal. In it, the user may rampage and write silly commands, but he should not be able to switch windows, click outside of it, open the task manager, open the menu with Ctrl + Alt Gr + Del and so on.
While searching for a way to accomplish this I've thought of two approaches that Python is also able to do:
Modifying the registry -> can disable task manager and some other functions, but not the app switcher neither the menu
Task-killing explorer.exe and dwm.exe -> killing explorer.exe just removed the taskbar, killing dwm.exe seems like the right way, but as it's the window manager it automatically boots up itself again as soon as it gets killed
I know this is a kind of weird question and doesn't contain any code snippet, but the front-end is no problem and as said I don't even got a working approach for the back-end.
write a while loop
Into the while loop write the command to taskkill dwm.exe
It's a poor solution, but the only one I know.
Regards!

Putting the display to sleep (⇧⌃⏏/shift+control+eject) in AppleScript

Is it possible to write an AppleScript to put the display to sleep (which locks the display if the computer is set to lock on sleep)? You can do this from the keyboard by entering ⌃⇧⏏ (shift+control+eject); this leaves all the programs, etc., running, and just turns off the screen.
I've been wanting to do this for a while now. I just found out how in the man pages. You can use the following command to achieve instant display sleep. (I have tested it on OS X 10.10.)
pmset displaysleepnow
(no root privileges / sudo required!)
I'm not sure if this works for 10.9.4 yet but by all means give it a shot!
you can use: tell application "Finder" to sleep
Or use bettertouchtool. It is a small app which you can use native functions in addition to applescript.
do shell script "pmset displaysleepnow"
Edit 2015-08-23: This is possible (from the shell) as of OS X 10.9! Go see user3064009's answer for the update :-)
There's no good way to do this; there's a SuperUser question about this same thing. Depending on why you want this, however, there's one workaround I know: activate the screen saver. (This is what they suggest over on SuperUser). You can do this in AppleScript with launch application id "com.apple.ScreenSaver.Engine", or from the command line by running the application /System/Library/Frameworks/ScreenSaver.framework/Resources/ScreenSaverEngine.app/Contents/MacOS/ScreenSaverEngine. I don't know whether or not this is technically documented anywhere, but it's worked for several iterations of the OS now. It may not do exactly what you want—your screen saver may, for instance, be colorful, which isn't helpful if you want a black screen—but it will be the same in that it does lock the screen if you have that set up.
For a nice catalog of other workarounds, check out this MacScripter thread: it documents that
There's no scriptable way to do this.
You can't tell AppleScript to key code EJECT, as there's no such key code.
You can use pmset to tell the display to go to sleep in one minute, but then you have to wait.
There's an undocumented IOKit way to do this; there's a mailing list post explaining how.
I haven't found an easy way to do it programmatically, but I did find a very small, free app that puts the display immediately to sleep, called "SleepDisplay." (There is another app of the same name that did NOT work for me.)
So you can just
tell application "SleepDisplay" to activate
Link: http://www.macupdate.com/app/mac/26234/sleep-display

Do webdevelopers need "confim resend" protection?

I use firefox for my web development and I bet most of you guys too. I've been doing a lot of form development recently and this annoying message
"To display this page, Firefox must send information that will repeat any action (such as a search or order confirmation) that was performed earlier."
is just beginning to piss me off.. I mean, come on! I don't need protection on my localhost, thank you! So, my question is: are you aware of any config, hack, plugin to suppress it? If not, how do you live with it?
Apparently there is neither configuration option nor extension to turn off this annoying confirmation window.
However, the workaround I use is as follows.
Download and install application AutoHotkey from: http://www.autohotkey.com/
Create the following script:
^f5::
Send {f5}
sleep 100
Send {enter}
Save with .ahk extension.
Double click to run it (a new icon should show up in the system tray).
Now every time you press Ctrl+F5, the script presses F5 and then Enter. Voila, the confirmation window supressed.
Here's an equivalent of Patrick's answer for Linux users (Ubuntu in my case).
Install autokey (it's in the repos). Add this python script:
import time
keyboard.send_keys("<f5>")
time.sleep(0.5)
keyboard.send_keys("<enter>")
Hook this script to f5 and you will never see the confirm message again. Tested with latest firefox.

Automatically Position Application Window Using Command File in Windows

I'm using PuTTY to access my BSD file server and I have several terminal windows open at once. I wrote a simple command file to automate opening the terminal windows and I'd like to know if it is possible to place them at a specific location.
I have two monitors and as it is now, I have to manually drag the terminal windows over to my second monitor.
AFAIK you can't do it directly from a batch file without using some 3rd party software like AutoHotkey.
It makes it incredibly easy to move a window. For example this script would start Calculator and move it to the top-left corner:
Run, calc.exe
WinWait, Calculator
WinMove, 0, 0
You can also easily compile your script into an .exe if you want to share it with other people that don't have AHK installed. It will basically answer all your automation needs, just as it has done mine :)

Resources