I'd like to use a perl script to apply a the contents of text data to a windows executible.
In this particular case, a Answer File to a 'Acrobat Reader' installer.
Here's an ugly way of doing it with the script below:
This outputs a answerfile to the computers hardrive and THEN applies it to the executible
It's the only thing that works...
open(ACROBAT, ">c:\\acrobat5.iss" ) || die "acrobat5.iss: $!\n";
format ACROBAT=
[InstallShield Silent]
Version=v5.00.000
File=Response File
[File Transfer]
OverwriteReadOnly=NoToAll
[DlgOrder]
Dlg0=SdWelcome-0
Count=3
Dlg1=SdAskDestPath-0
Dlg2=MessageBox-0
[SdWelcome-0]
Result=1
[SdAskDestPath-0]
szDir=C:\Program Files\Adobe\Acrobat 5.0
Result=1
[Application]
Name=Reader
Version=5.0
Company=Adobe
Lang=0009
[MessageBox-0]
Result=1
.
write ACROBAT;
my $pkg = '\\acrobat5.exe /a /s /sms /f1_$';
system $pkg;
close ACROBAT;
unlink ("c:\\acrobat5.iss");
It would be nice not to author a seperate file, as above
but the way windows executables apply text files confuses me.
Windows executibles that get instructions from whole text files,
such as answerfiles and AutoIt scripts, seem to require those files
have a actual location. Parsing them from __DATA__ dosn't work, as
in this unssucsful example below
(just starts a new instance of acrobat5.exe for each line each line of DATA)
while( <DATA> ){
my $pkg = "c:\\acrobat5.exe /a /s /sms /f1$_";
system $pkg;
}
__DATA__
[InstallShield Silent]
Version=v5.00.000
File=Response File
[File Transfer]
OverwriteReadOnly=NoToAll
[DlgOrder]
Dlg0=SdWelcome-0
Count=3
Dlg1=SdAskDestPath-0
Dlg2=MessageBox-0
[SdWelcome-0]
Result=1
[SdAskDestPath-0]
szDir=C:\Program Files\Adobe\Acrobat 5.0
Result=1
[Application]
Name=Reader
Version=5.0
Company=Adobe
Lang=0009
[MessageBox-0]
Result=1
I attempted this without luck too...
It was supposed to feed all the data at once, but it didn't work either;
my $answer_file = ('
[InstallShield Silent]
Version=v5.00.000
File=Response File
[File Transfer]
OverwriteReadOnly=NoToAll
[DlgOrder]
Dlg0=SdWelcome-0
Count=3
Dlg1=SdAskDestPath-0
Dlg2=MessageBox-0
[SdWelcome-0]
Result=1
[SdAskDestPath-0]
szDir=C:\Program Files\Adobe\Acrobat 5.0
Result=1
[Application]
Name=Reader
Version=5.0
Company=Adobe
Lang=0009
[MessageBox-0]
Result=1');
my $pkg = "c:\\acrobat5.exe /a /s /sms /f1$answer_file";
system $pkg;
Ideas? It's seems it's all about tricking the installer to think the data is a file on the harddrive.
Yes, it would be easy just to keep a seperate answer file, but I'm trying to avoid the overhead and keep things compact.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.