Jump to content

ShellExecute with empty param


MyEarth
 Share

Recommended Posts

I want to pass parameter like variable to a ShellExecute, not so easy seems. Since the everything is optional except the filename i have think to make something like $verb = "" and the other but not work, check this out:

ShellExecute("notepad.exe", "C:\Text.txt", Default, Default, Default)
ShellExecute("notepad.exe", "C:\Text.txt", "", "", "")
;~ ShellExecute("notepad.exe", "C:\Text.txt")

Obv need a file in C:\Text.txt or whatever you like. The first two not work, the last yes but i want to variable to optional *if* user with the GUi what to add it. I need to make many ShellExecute based on optional parameter for do this? Autoit 3.3.8.1

Thanks

Edited by MyEarth
Link to comment
Share on other sites

Link to comment
Share on other sites

default flag for showflag is @SW_SHOWNORMAL if you put anything (I mean not set default keyword o anything). If you put default keyword AutoIt does not care about it and pass -1. then internally ends as 2^16-1 unsigned short int.

 

Saludos

Link to comment
Share on other sites

There is something i don't understand, the showflag cannot be empty, right? But if i don't write how the function understand i don't have pass a parameter if it don't have a default value?

The only parameter needed for ShellExecute is the filename parameter, everything else is optional to have it run. In your example you only need 2 parameters, the program to run (Notepad.exe) and the file to open (C:\test.txt). If you're not going to change the optional parameters, you do not need to include them in the function line.

The only time you need to set the optional parameters to the default values is if you're changing an optional parameter that comes after one of the other optional ones, then you must include them even if set to default.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

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...