I want to write a code in perl which automatically opens vlc player and start playing.
I am stuck when I open the vlc player.
I use
But when I execute the lines below this code doesn't not execute.
Is there any other way to open vlc player?
ok, I changed my code
Here is it -
#!usr/bin/perl
-
-
#exec (vlc);
-
#print "vlc launched";
-
$directoryListing = `vlc`;
-
print $directoryListing; //opens vlc
-
-
print "vlc playinng";
-
-
my @keys = ("%{m}", "{ENTER}");
-
for my $key (@keys){
-
-
SendKeys ($key);
-
}
-
Problem here is once I execute, the statements after print $directoryListi ng; does not work.
6 4753 RonB 589
Recognized Expert Moderator Contributor
You should have received the following error:
Undefined subroutine &main::SYSTE M called at
Perl is case sensitive.
It's system not SYSTEM
chorny 80
Recognized Expert New Member
Do a fork and run vlc in fork. `` waits for program to finish.
I dont want to wait after I run vlc. I want the below statements to execute after the vlc is opened.
what I get is
The VLC will open and a message "[0x9bfa140] main libvlc: Running vlc with the default interface. Use 'cvlc' to use vlc without interface." appears in the terminal and the program is waiting for vlc to quit. once the vlc quits(CTRL +C or close vlc using mouse) the rest of the statements execute. Btw I tried forking and had no luck.. same result.
here the forking code -
#!usr/bin/perl
-
$pid = fork();
-
if( $pid == 0){
-
system("vlc");
-
exit 0;
-
}
-
print "vlc playinng";
-
-
my @keys = ("%{m}", "{ENTER}");
-
for my $key (@keys){
-
SendKeys ($key);
-
}
-
-
-
miller 1,089
Recognized Expert Top Contributor
The following example with fork does work for me, however, the script won't exit until vlc is closed. -
#!usr/bin/perl
-
-
use strict;
-
-
my $vlc = q{C:\Program Files\VideoLAN\VLC\vlc.exe};
-
-
unless (fork) {
-
system($vlc);
-
exit;
-
}
-
-
print "Hello world\n";
-
Since you're running on a windows machine though, you have the option of using Win32::Process -
#!usr/bin/perl
-
-
use Win32::Process;
-
-
use strict;
-
-
my $vlc = q{C:\Program Files\VideoLAN\VLC\vlc.exe};
-
-
Win32::Process::Create(
-
my $processobj,
-
$vlc,
-
"vlc",
-
0,
-
NORMAL_PRIORITY_CLASS,
-
"."
-
) or die "Can't Create - $!";
-
-
print "Hello world\n";
-
The above will start vlc, and continue to Hello World and exit, leaving vlc running.
- Miller
sorry for not mentioning the OS.
I am using Linux ubuntu.
I have a well running vlc automation script in windows.
And yes, I used the same package as the above(Win32::Pr ocess).
But you know that we cant use these in linux.
I am unaware of packages in linux that is to be used.
miller 1,089
Recognized Expert Top Contributor
Well, if all else fails, just use & to start the process as an independent daemon. -
#!/usr/bin/perl-w
-
# waitforme.pl
-
-
use strict;
-
-
my $log = 'waitforme.log';
-
-
open my $fh, '>>', $log or die "$log, $!";
-
for (1..5) {
-
print $fh scalar(localtime), " - $_\n";
-
sleep 2;
-
}
-
and the main script -
#!/usr/bin/perl-w
-
# dontwait.pl
-
-
use strict;
-
-
my $prog = q{perl waitforme.pl};
-
-
system(qq{$prog &});
-
-
print "Hello world\n";
-
- Miller
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Stephen Ferg |
last post by:
I need to translate some Perl scripts into Python.
When I went looking for a tool that would help automate the
translation, I was rather surprised that I couldn't find anything.
BridgeKeeper, the only real candidate that I could find, is no longer
available. There are of course general-purpose parsing packages, but
I'm looking for something target specifically to Perl-to-Python
translation.
Since I couldn't find anything, I've...
|
by: Someone |
last post by:
there's a korn shell script that i would like to wrap a perl script
around to automate it, as a task i need to do always chooses the same
options from this script (it's menu driven). can i somehow redirect
my perl scripts stdout to print to this scripts stdin? does that make
sense? thanks.
sean rowe
|
by: Greg |
last post by:
We're looking for CGI/PERL programmer who can help us integrate CamFrogWeb's
video conferencing software
with our site's user management system (login system)
Our site uses customized vesrion of BAC software for our backend, see
www.buildacommunity.com
|
by: Santosh |
last post by:
Dear all i am created one animated image in Macromedia flash player i
want to call it from asp.net page. how i can call it. help greatly
apreciated.
Santosh Shinde.
|
by: peteinglastonbury |
last post by:
I'd be most grateful if someone would help me. I hope I'm in the right forum (apologies if not) - I'm not sure whether my problem is CGI or Javascript related.
I found a script called BatmoAudiopop.js which opens a pop-up browser window with an audio player when a link is clicked. Basically, it sets the right mime-type depending on the operating system and audio file type, then opens a window with the audio file (passed as a parameter) in...
| |
by: subeen |
last post by:
Hi,
I am trying to parse a rss similar to the one found here (in example) http://www.feedforall.com/mediarss.htm
<!-- Snipped for Brevity -->
<item>
<title>FeedForAll's Show Tunes and Song</title>
<link>http://www.feedforall.com/songs.htm</link>
<description>FeedForAll cool show tunes and lyrics. </description>
|
by: mithunmo |
last post by:
I am trying to automate the process of filling up the webforms and do a submit .
I have the below program written but If I run the program . I get the following error message
Can't call method "value" on an undefined value at C:/Perl/site/lib/Win32/IE/Mec
hanize.pm line 900.
Please let me know your inputs on the same
#!c:\perl\bin\perl.exe
|
by: Peter Michaux |
last post by:
I have a Perl script that I want to run as a set-user-ID program. Many
OSes don't allow scripts run as set-user-ID. To make this script
portable, it seems I need to write a C wrapper program that calls exec
or system to give the Perl script the necessary effective permissions.
How can I make the C wrapper program secure? or "more" secure?
The Perl script, which is "-rwsr-xr-x root root" will look at the real
user id and then check a...
|
by: gajendra98 |
last post by:
Hi All
I Have installed Active perl in my system and I am new to perl and automation...Could some one tell me how to install the perl modules and how to use those modules with the perl for autmating the website ... it will be very helpful for me to start automation...
|
by: raghavendrap |
last post by:
Hello friends,
I need help to automate verilog modules.
Suppose i have verilog modules
ax.v, bx.v, cx.v, dx.v ---------- individual modules,
ab.v ----------------- contains instantes of ax.v,bx.v
cd.v ----------------- contains instances of cx.v,dx.v
abcd.v -------- top-level module contains instances of ab.v, cd.v
...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |