Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > win32::job window attributes

Reply
Thread Tools

win32::job window attributes

 
 
Cameron
Guest
Posts: n/a
 
      07-03-2004
Hello All --

I am trying to launch a windows application either in the background
or with a minimized window using the following code:

my $job = Win32::Job->new;

$job->spawn(q{D:\Link32\Link32.exe}, q{Link32.exe}, {
stdout => 'output.txt',
stderr => 'error.txt',
window_attr => 'hidden'
});

The app is spawned successfully, but no matter how I try to redirect
stdout or set window_attr to hidden or minimized, it launches full screen.

Any thoughts or suggestions appreciated. I am not married to this module, so
if anyone has done this successfully in the past using something else, I'll
give it a try.

Thnx,

Cameron
 
Reply With Quote
 
 
 
 
MrReallyVeryNice
Guest
Posts: n/a
 
      07-03-2004
Hello Cameron,

Using your syntax, I was able to reproduce your problem. Of course, I don't
have a D:\Link32\Link32.exe on my computer so I used Notepad.exe. Notepad
would start but it would not be hidden or minimized. By the same token,
output.txt and error.txt were not created. I went back to the documentation
for Win32::Job and used the exact syntax. Here is a little sample that
worked for me on W2K:

==== Beginning script sample =====
use strict;
use warnings;
use Win32::Job;

my $job = Win32::Job->new();
my %opts=( window_attr=>'hidden',
stdout => 'output.txt',
stderr => 'error.txt');
$job->spawn(q{c:\winnt\system32\notepad.exe}, q{notepad "d:\temp\temp.txt"},
\%opts);
$job->run(10);

==== End script sample =====

As you noticed, the main difference with your script is that I defined the
hash %opts. I was then able to successfully minimize or hide the window. Of
course, output.txt and error.txt were also created successfully.

You might want to give it a try and see if the syntax documented for
Win32::Job does not fix your problem as well.

I would be great if you could report your future failure/success.
Additional questions are of course always welcome.

MrReallyVeryNice


 
Reply With Quote
 
 
 
 
Cameron
Guest
Posts: n/a
 
      07-03-2004
"MrReallyVeryNice" <(E-Mail Removed)> wrote in message news:<(E-Mail Removed)>...
> Hello Cameron,
>
> Using your syntax, I was able to reproduce your problem. Of course, I don't
> have a D:\Link32\Link32.exe on my computer so I used Notepad.exe. Notepad
> would start but it would not be hidden or minimized. By the same token,
> output.txt and error.txt were not created. I went back to the documentation
> for Win32::Job and used the exact syntax. Here is a little sample that
> worked for me on W2K:
>
> ==== Beginning script sample =====
> use strict;
> use warnings;
> use Win32::Job;
>
> my $job = Win32::Job->new();
> my %opts=( window_attr=>'hidden',
> stdout => 'output.txt',
> stderr => 'error.txt');
> $job->spawn(q{c:\winnt\system32\notepad.exe}, q{notepad "d:\temp\temp.txt"},
> \%opts);
> $job->run(10);
>
> ==== End script sample =====
>
> As you noticed, the main difference with your script is that I defined the
> hash %opts. I was then able to successfully minimize or hide the window. Of
> course, output.txt and error.txt were also created successfully.
>
> You might want to give it a try and see if the syntax documented for
> Win32::Job does not fix your problem as well.
>
> I would be great if you could report your future failure/success.
> Additional questions are of course always welcome.
>
> MrReallyVeryNice


Hey Nice --

No go ..... I was able to reproduce your results with notepad as well,
but the application (a bastardized copy of wIntegrate used by car
dealers to access an old PICK system from Reynolds & Reynolds) still
refuses to open in a minimised window. Thanks for your input!

Cameron
 
Reply With Quote
 
Petri
Guest
Posts: n/a
 
      07-03-2004
In article <(E-Mail Removed) >, Cameron says...
> but the application (a bastardized copy of wIntegrate used by car
> dealers to access an old PICK system from Reynolds & Reynolds) still
> refuses to open in a minimised window.


You could of course use SendKeys to send alt-space, n to the window when it
opens.

http://search.cpan.org/search?query=sendkeys&mode=all

http://msdn.microsoft.com/library/de...thsendkeys.asp


Petri

 
Reply With Quote
 
MrReallyVeryNice
Guest
Posts: n/a
 
      07-04-2004
Hello again,

In addition to trying SendKeys as suggested by Petri, you might also
validate if your application (Link32.exe) has not been built/compiled with
the wrong switch. In which case no matter what you try, you will not be able
to minimize/hide it.

In the spirit of helping you debugging this problem, and certainly not
trying to drive you away from Perl, I would suggest that you take a look at:
http://msdn.microsoft.com/library/de...us/shellcc/pla
tform/shell/reference/objects/ishelldispatch2/shellexecute.asp. If you
create a small VBScript, you will have a second data point. If you are
successful with a VBScript then you can decide to debug Win32::Job or try to
find another Perl module.

Here is a little untested sample program with Link32:
=== Beginning Script ===
Option Explicit
fnShellExecuteVB()

function fnShellExecuteVB()
dim objShell
set objShell = CreateObject("Shell.Application")
objShell.ShellExecute "Link32.exe", "", "D:\Link32", "open", 2
set objShell = nothing
end function
=== End Script ===

As earlier, please report your failures/successes.
MrReallyVeryNice


 
Reply With Quote
 
Cameron
Guest
Posts: n/a
 
      07-04-2004
"MrReallyVeryNice" <(E-Mail Removed)> wrote in message news:<(E-Mail Removed)>...
> Hello again,
>
> In addition to trying SendKeys as suggested by Petri, you might also
> validate if your application (Link32.exe) has not been built/compiled with
> the wrong switch. In which case no matter what you try, you will not be able
> to minimize/hide it.
>
> In the spirit of helping you debugging this problem, and certainly not
> trying to drive you away from Perl, I would suggest that you take a look at:
> http://msdn.microsoft.com/library/de...us/shellcc/pla
> tform/shell/reference/objects/ishelldispatch2/shellexecute.asp. If you
> create a small VBScript, you will have a second data point. If you are
> successful with a VBScript then you can decide to debug Win32::Job or try to
> find another Perl module.
>
> Here is a little untested sample program with Link32:
> === Beginning Script ===
> Option Explicit
> fnShellExecuteVB()
>
> function fnShellExecuteVB()
> dim objShell
> set objShell = CreateObject("Shell.Application")
> objShell.ShellExecute "Link32.exe", "", "D:\Link32", "open", 2
> set objShell = nothing
> end function
> === End Script ===
>
> As earlier, please report your failures/successes.
> MrReallyVeryNice



Thanks to both of you ..... what I finally decoded to do was to
execute the
wIntegrate scripting command "Session Show 3" as soon as the app opens
which basically accomplishes the same thing. I'm a bit disapointed
that I couldn't do it with Perl, but I can waste too much time on it.

Cheers,

Cameron
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
data attributes override method attributes? Jayden Python 16 09-29-2012 03:20 AM
attributes ala java annotations or .Net attributes? Kyle Schmitt Ruby 3 07-24-2007 07:48 PM
class attributes & data attributes james_027 Python 2 06-20-2007 03:12 PM
WebControl.Attributes.Add and custom attributes P4trykx ASP .Net 2 01-31-2007 04:33 PM
Parse reserved attributes as normal attributes Max XML 1 09-22-2006 12:04 PM



Advertisments