Jump to content

Help: ACDsee 3.1 & Others - Post-Setup Start Menu Window


kelaniz

Recommended Posts

Hello all,

I'm having this problem with a number of apps, but to keep it simple, I'll use ACDSee 3.1 as an example. This is (I think) a non-packaged EXE installer. I can get it to successfully install silently with a /s switch if you import various registry settings before you run setup. That's all good.

What happens is, many of these (usually older) apps open an explorer window at the end of setup containing their newly-created shortcuts in that program's folder in the start menu. In ACDsee 3.1, it's something like: %AllusersProfile%\Start Menu\Programs\ACD Systems\ACDSee

The problem is, the installer keeps running until you close that window. This breaks unattended setup.

Is there any way to kill this explorer window (and as a result, the installer) so that unattended install can continue? I've tried using taskkill.exe, but since the installer's still running, taskkill won't run until it ends. I was tihnking it may be possible to somehow call another batch file when setup starts to run concurrently, but sleep, say 45 seconds, until setup (technically) finishes, then kill the process, but I don't know how to do that. :/

I have about 12 "vintage" apps and utilities on my UXPCD that have this problem. To the best of my knowledge, none of them have any switches that stop the post-setup window opening, so if I can get something to work for ACDSee 3.1, then I can adapt it to those programs as well.

ANY help would be greatly appreciated, by me and anyone else trying to silent-install any of the thousands of programs that have this annoying little feature. This has been such a problem for me, we're now talking "you're definitely on my Christmas list" appreciation if you have a working solution! :)

Please, no unhelpful comments like "Upgrade to a version made this century, ya moron!" IMO ACDSee went to crap after 3.1, and I have tried (and greatly dislike) all versions past that one. As for the rest of the 12 programs in this category, half of them have no upgrades, and the other half also started to suck as they evolved.

Thanks in advance..

KZ

Link to comment
Share on other sites


In such situations, I use a JS script. Some others use a VBS. Both are effective.

That's a good idea. Could you please post an example of a script you used, or at least a good place to find more info on how to do that? I haven't worked with JS in 3 years, and wasn't that great with it to begin with, so creating one from scratch is not possible. I was even worse with VB. I could do it in PHP, Perl or ColdFusion, though, but that's not much help.

I checked a few JS repositories, but didn't see anything that I could modify for this purpose.

KZ

Link to comment
Share on other sites

Well!

Let me assume you want to install ACDSee 3.1. (I haven't done it myself!)

Then, you need both files (ACDSee.exe and ACDSee.js) in the same place.

Let me assume, again, you put both files as these; on your CD:

$OEM$\$1\Install\ACDSee\ACDSee.exe

$OEM$\$1\Install\ACDSee\ACDSee.js

At installation time of Windows, $OEM$\$1\ will be C:\, or whatever your %SystemDrive% is.

So, your JS script will be like this:

var WshShell = WScript.CreateObject ("WScript.Shell");

WshShell.RUN ("%SystemDrive%\\Install\\ACDSee\\ACDSee.exe /S");//running EXE with silent switch

WScript.Sleep(5000);//time taken by the installer to unpack and install its files

WshShell.SendKeys ("%{F4}");//this is Alt+F4 to close whatever active at the moment

5000 means 5 seconds.

When the installer finishes its work (but still waiting for the shortcut folder to be closed), it's time for %{F4} to do its job.

So, adjust the sleep time to the time taken by the installer to unpack and install its files.

However, since the path to ACDSee.exe is written in the script, it's not obligatory to put both files in the same place.

Using that script means that you will not call ACDSee.exe from your CMD (or whatever).

If you use a CMD, then you call ACDSee.js, like this:

Start /Wait %SystemDrive%\Install\ACDSee\ACDSee.js

NB: As mentioned, many times before, run your scripts before installing your AntiVirus programs. AV progs might block your scripts.

Hope this helps.

Link to comment
Share on other sites

Thanks very much for that info, that definitely should solve that similar problem with those 12 ancient apps I'm installing.

Alt+F4 will work just fine, provided I set the timing generous enough :) unless something else steals the focus in that millisecond, that is. Since that installer sometimes won't unload even when you kill the Start Menu explorer window, I assume I can handle that and make sure both processes are sufficiently killed by adding a command and changing the last command to run taskkill to kill that specific process. Something like this...

WshShell.RUN ("taskkill.exe /F /FI \"WINDOWTITLE eq C:\\Profiles*\""); \\Kill the Start Menu window opened by the installer

WshShell.RUN ("taskkill.exe /F /IM Acdsee*"); \\ Kill the installer, if killing the explorer process leaves it running

Again, thanks a bunch. Looks like I'm gonna have to give JScript another chance. :)

KZ

Link to comment
Share on other sites

You can add this line above the %{F4} statement so that the script brings focus to your Window.

WshShell.AppActivate("Documents");//part of or the whole name of the running Window

Change "Documents" according to your situation.

For timing, it's not, practically; a problem. You just use sleep time that's equal to or greater than the actual installation time.

Link to comment
Share on other sites

For timing, it's not, practically; a problem. You just use sleep time that's equal to or greater than the actual installation time.

This I know. :) That was just a random observation that if I did set the sleep time too short, the installer would be killed too early, with obvious consequences. Since I'm doing all the testing of my DVD on VMware, program start and install times are somewhat different than they will be on my production box. Add to that, the installer's completely silent. It'll take 2-3 tries to dial it in, which isn't a problem.

I know I could just set a safe sleep time, allowing for any delays, and that's what I'll probably end up doing. Just want to get it reasonably close. If I happen to be attending an unattended install, 12 consecutive 30 second pauses would definitely add up :)

Thanks for the extra tip. The script you posted works perfectly for this purpose, and takes care of a few other issues I didn't cover in this post. THis is good. Now the only two things I have left to work out for this DVD are, 1. Create a similar script to automatically click the Confirm button for a program with a forced "Do you want to Install?" dialog (Can't be bypassed with a /SP- switch.)

And 2. Find something to create additional start menu shortcuts that an installer doesn't create, but that one's no problem, as I believe there's a command-line utility in the XP Resource Kit that will handle that.

Thanks again for your help and fast reply, mazin.

-Kel

Edited by kelaniz
Link to comment
Share on other sites

This is how I create a shortcut in a shortcut folder that does not exist:

var WshShell = WScript.CreateObject("WScript.Shell");

var fso = new ActiveXObject("Scripting.FileSystemObject");//needed for the "Dest" variable.

LinkPlace = WshShell.SpecialFolders("AllUsersPrograms");//needed for the "Dest" variable.

var Dest = fso.CreateFolder(LinkPlace + "\\Accessories\\Extra");//this creates the Dest_ination shortcut-folder.

var Link1 = WshShell.CreateShortcut(LinkPlace + "\\Accessories\\Extra\\PDF Reader.lnk");//puts a shortcut in the Dest_ination folder!

Link1.TargetPath = ("%ProgramFiles%\\PDF Reader\\PDF Reader.exe");//where's your EXE?

Link1.WindowStyle = 1;//Normal Window; not Maximized or Minimized.

Link1.IconLocation = ("%ProgramFiles%\\PDF Reader\\PDF Reader.exe");//where to get the shortcut icon from?

Link1.Description = "Foxit Reader";//Comment.

Link1.WorkingDirectory = ("%ProgramFiles%\\PDF Reader");//the source folder of your EXE.

Link1.Save();

This is how I create a shortcut in a shortcut folder that exists:

var WshShell = WScript.CreateObject("WScript.Shell");

LinkPlace = WshShell.SpecialFolders("AllUsersPrograms");//this is: "%AllUsersProfile%\Start Menu\Programs"

var Link2 = WshShell.CreateShortcut(LinkPlace + "\\Accessories\\System Tools\\System Configuration Utility.lnk");

Link2.TargetPath = ("%WinDir%\\pchealth\\helpctr\\binaries\\msconfig.exe");

Link2.WindowStyle = 1;

Link2.IconLocation = ("%WinDir%\\pchealth\\helpctr\\binaries\\msconfig.exe");

Link2.Description = "System Configuration Utility";

Link2.WorkingDirectory = ("%WinDir%\\pchealth\\helpctr\\binaries");

Link2.Save();

For your request No. 1, see this post:

http://www.msfn.org/board/index.php?s=&amp...st&p=576814

Edited by mazin
Link to comment
Share on other sites

Thanks once again for more excellent info. Seriously, what do you want for Christmas? :)

I tested the script you originally posted, and had some problems. Seems no matter what I did, the script couldn't find any of the files it referenced, even if they were in the same directory as the script. I tried including the actual path (D:\wpi\kel\apps\ACDSee\), the variable-controlled path (%CDROM%\wpi\kel\apps\ACDSee\), putting just the program name, and even calling the .js from a .cmd file that set the working dir to the script's location.

FYI - The installer is on a CD, which on my VMware test machine has a C: HD and D: CD-ROM. The path is D:\wpi\kel\apps\ACDSee\ACDSee_3.1.exe

I'm installing this using WPI, and it uses the variable %CDROM% which = D:

Even when I replaced %CDROM% with D:, it couldn't find the file (ACDSee_3.1.exe) No idea why..

Here's the script you posted, and the modifications I made.

var WshShell = WScript.CreateObject ("WScript.Shell");
WshShell.RUN ("%CDROM%\\wpi\\kel\\apps\\ACDSee\\ACDSee_3.1.exe /S"); //running EXE with silent switch
WScript.Sleep(23000); //time taken by the installer to unpack and install its files
WshShell.SendKeys ("%{F4}"); //this is Alt+F4 to close whatever active at the moment

Funny thing was, when I ran it locally, it worked. Just didn't on the CD (My source dir was F:\kelxp\wpi\kel\apps\ACDSee\)

In the end, I used a bit of the code you provided, plus a few other bits I found scattered around various forums, and here's what I ended up with. It works like a champ, though I don't have ANY idea why this is any different:

var WshShell = WScript.CreateObject ("WScript.Shell");
var path = WScript.ScriptFullName; // path to this script
var CDR = path.substring(0,2); //extract DriveLetter: from the path
WshShell.RUN (CDR + "[url="file://\WPI\Kel\apps\ACDSee\ACDSee_3.1.exe"]\\WPI\\Kel\\apps\\ACDSee\\ACDSee_3.1.exe[/url] /s"); //exe to run...
WScript.Sleep(24000); //Sleep 24sec for the installer to finish
WshShell.AppActivate("C:\\Profiles"); //part of or whole name of the running Window
WScript.Sleep(800); //Sleep 800ms to allow for delay in window becoming active
WshShell.SendKeys ("%{F4}"); //Send Alt+F4 to close active window
WScript.Sleep(4000); //Sleep 4 sec to allow for delay in window close. Cross fingers.
WshShell.RUN ("taskkill.exe /F /FI \"WINDOWTITLE eq C:\\Profi*\""); //In case previous command fails somehow
WshShell.RUN ("taskkill.exe /F /IM Acdsee*"); //In case installer does not close when window closes.

So, it works, although why the original doesn't is a mystery that bugs me. :)

The shortcut creation code works perfectly. I've added that in various places to create at least 80 shortcuts that I need. So, MANY thanks for that.

Offhand, do you know of any way to use a similar script to click an option on those atypical dialogs that you can't switch between the selections with TAB, or hit any specific key to access the command? Just curious.

DVD is looking great now. All these minor annoyances are gone, thanks to your help. Now I just need to make another build with whatever updates have been released for my addons, and fix a problem where Windows/office update still wants to download hotfixes I've already slipstreamed, and I'm done... I finally see the light at the end of the tunnel...After 5 months and 367 revisions. :)

KZ

Edited by kelaniz
Link to comment
Share on other sites

Thank you for the compliment!

First, I just assumed (my bad!) you install those apps from your HDD.

And, this is why I used %SystemDrive% in my script.

Second, it's ALWAYS SAFE to use the command "ExpandEnvironmentStrings" with

predefind variables like %SystemDrive%, %WinDir%, etc. (my bad, again!)

So, my first script should be like this:

var WshShell = WScript.CreateObject ("WScript.Shell");

var SysDrv = WshShell.ExpandEnvironmentStrings("%SystemDrive%");//expanding my current system drive

WshShell.RUN (SysDrv + "\\Install\\ACDSee\\ACDSee.exe /S");//running EXE with silent switch

WScript.Sleep(5000);//time taken by the installer to unpack and install its files

WshShell.SendKeys ("%{F4}");//this is Alt+F4 to close whatever active at the moment

Third, accordingly; the scripts of creating shortcuts should be as follows:

- This script creates a folder for the shortcut to be placed in. Then, it creates the shortcut, itself:

var WshShell = WScript.CreateObject("WScript.Shell");

var fso = new ActiveXObject("Scripting.FileSystemObject");//needed for the "Dest" variable

LinkPlace = WshShell.SpecialFolders("AllUsersPrograms");//needed for the "Dest" variable

var Dest = fso.CreateFolder(LinkPlace + "\\Accessories\\Extra");//this creates the Dest_ination shortcut-folder

var ProgFile = WshShell.ExpandEnvironmentStrings("%ProgramFiles%");//expanding my current directory of "Program Files"

var Link1 = WshShell.CreateShortcut(LinkPlace + "\\Accessories\\Extra\\PDF Reader.lnk");//puts a shortcut in the Dest_ination folder!

Link1.TargetPath = (ProgFile + "\\PDF Reader\\PDF Reader.exe");//where's your EXE?

Link1.WindowStyle = 1;//Normal Window; not Maximized or Minimized.

Link1.IconLocation = (ProgFile + "\\PDF Reader\\PDF Reader.exe");//where to get the shortcut icon from?

Link1.Description = "Foxit Reader";//Comment.

Link1.WorkingDirectory = (ProgFile + "\\PDF Reader");//the source folder of your EXE.

Link1.Save();

- This script creates a shortcut in an existing folder:

var WshShell = WScript.CreateObject("WScript.Shell");

LinkPlace = WshShell.SpecialFolders("AllUsersPrograms");//this is: "%AllUsersProfile%\Start Menu\Programs"

var WDir = WshShell.ExpandEnvironmentStrings("%WinDir%");//expanding my current directory of "Windows"

var Link2 = WshShell.CreateShortcut(LinkPlace + "\\Accessories\\System Tools\\System Configuration Utility.lnk");

Link2.TargetPath = (WDir + "\\pchealth\\helpctr\\binaries\\msconfig.exe");

Link2.WindowStyle = 1;

Link2.IconLocation = (WDir + "\\pchealth\\helpctr\\binaries\\msconfig.exe");

Link2.Description = "System Configuration Utility";

Link2.WorkingDirectory = (WDir + "\\pchealth\\helpctr\\binaries");

Link2.Save();

Fourth, the CDR (a user-defined variable) variable you used in your script is what I use when installing from CD.

You can see it in many of my several scripts spread around here.

Fifth, when you can't switch between the selections with TAB;

then the buttons on the interface (setup screen) have their TabStop property set to "no".

In this case, the selectability of a button is still possible if a button has ampersand (&) in its caption.

When a letter in the caption of a button has ampersand before it, it's called "keyboard accelerator".

For example, if you press Alt+I when &Ignore (seen as Ignore with underlined I)

is displayed as a button on some interface; the command "Ignore" will be executed. (see the pic)

ib01dm5.png

So, if the button you want to click has a keyboard accelerator, then (in my example) you should use:

WshShell.SendKeys ("i");//set answer to ignore

HTH

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...