Jump to content

Windows Picture Viewer As Exe


Recommended Posts

Hi,

I'm looking to use AutoIt to create an .exe which will open Windows XP Picture viewer with a graphics file.

Eg, pictureview.exe graphic.tif

pictureview.exe graphic.bmp

The problem I'm having is the command within Windows XP to launch Picture Viewer with an argument is

rundll32.exe C:\WINDOWS\system32\shimgvw.dll,ImageView_Fullscreen %1

I can get AutoIt to launch a blank Picture Viewer using

Run ( 'rundll32.exe C:\WINDOWS\system32\shimgvw.dll,ImageView_Fullscreen' )

I can't figure out how to pass the argument %1 through to AutoIt so that the graphic file specified after the .exe opens.

When I use

Run ( 'rundll32.exe C:\WINDOWS\system32\shimgvw.dll,ImageView_Fullscreen %1' )

nothing happens. No Picture Viewer at all.

Anyone got any ideas ? I'm hoping that it can actually be done with AutoIt but I'm not sure if the way Windows use the Picture Viewer allows it.

Help.....

Link to comment
Share on other sites

Try something like:

If $CmdLine[0] = 0 Then Exit;because no command-line params
Run ( 'rundll32.exe C:\WINDOWS\system32\shimgvw.dll,ImageView_Fullscreen ' & $CmdLine[1] )

From the help file:

The special array $CmdLine is initialized with the command line parameters passed in to your AutoIt script.  Note the scriptname is not classed as a parameter; get this information with @ScriptName instead.  A parameter that contains spaces must be surrounded by "double quotes".  Compiled scripts accept command line parameters in the same way.

$CmdLine[0]is number of parameters

$CmdLine[1] is param 1 (after the script name)

$CmdLine[2] is param 2 etc

Hope that helps!
Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!
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
 Share

  • Recently Browsing   0 members

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