Jump to content

Can't RUN Files from FileOpenDialog ?


Recommended Posts

Hello Folks!

Got a really simple one today :o

Want to run FileOpenDialog() and "automagically" launch any displayed file with its associated program (.txt, .doc, .whatever), just as the OS ordinarily should.

Here's the code which I've been working with, to no avail:

$open = FileOpenDialog("Open File . . .", "C:\", "All (*.*)")
Run($open)

Good enough to run any .exe; but all I get for anything that's not an executable is the following AutoIt error:

"%1 is not a valid Win32 application."

Any suggestions as to how this can be accomplished?

Thanks again --

[center][font="Courier"][quote]Which end do you put the cheesecake in?[/quote][/font][/center]

Link to comment
Share on other sites

Hello Folks!

Got a really simple one today :o

Want to run FileOpenDialog() and "automagically" launch any displayed file with its associated program (.txt, .doc, .whatever), just as the OS ordinarily should.

Here's the code which I've been working with, to no avail:

$open = FileOpenDialog("Open File . . .", "C:\", "All (*.*)")
Run($open)

Good enough to run any .exe; but all I get for anything that's not an executable is the following AutoIt error:

"%1 is not a valid Win32 application."

Any suggestions as to how this can be accomplished?

Thanks again --

Try

_RunDos("start " & $open)


Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

Link to comment
Share on other sites

Hello Folks!

Got a really simple one today :o

Want to run FileOpenDialog() and "automagically" launch any displayed file with its associated program (.txt, .doc, .whatever), just as the OS ordinarily should.

Here's the code which I've been working with, to no avail:

$open = FileOpenDialog("Open File . . .", "C:\", "All (*.*)")
Run($open)

Good enough to run any .exe; but all I get for anything that's not an executable is the following AutoIt error:

"%1 is not a valid Win32 application."

Any suggestions as to how this can be accomplished?

Thanks again --

This works on a .txt file anyway.

#include <Process.au3>

$open = FileOpenDialog("Open File . . .", "C:\", "All (*.*)")

_RunDOS($open)

Link to comment
Share on other sites

@BigDod:

Thanks for the post.

Looks like this'll call Start.exe . . .

Need this to work under BartPE -- Start.exe is a bomb in this environment.

If this is so, is there any other approach to the problem which .au3 would encompass without a call to Start???

Thanks again :o

[center][font="Courier"][quote]Which end do you put the cheesecake in?[/quote][/font][/center]

Link to comment
Share on other sites

@WFC:

Gave it a whirl -- no dice over here with EditPad Classic :o

(probably would work with notepad OK)

Any other ideas for the rest of it???

Thanks again.

Hmmmmm...

[center][font="Courier"][quote]Which end do you put the cheesecake in?[/quote][/font][/center]

Link to comment
Share on other sites

@JdeB:

Using

$open = FileOpenDialog("Open File . . .", "C:\", "All (*.*)")

MsgBox(4096,"","You chose " & $open)

Run($open)

shows that the $open variable contains the full path to the selected file in all instances.

However, the succeeding RUN gets us a "%1 is not a valid Win32 application" AutoIt error message every time any file that is not a .bat or .exe is called to open...

Strange :o ?

Thanks --

[center][font="Courier"][quote]Which end do you put the cheesecake in?[/quote][/font][/center]

Link to comment
Share on other sites

  • Developers

@JdeB:

Using

$open = FileOpenDialog("Open File . . .", "C:\", "All (*.*)")

MsgBox(4096,"","You chose " & $open)

Run($open)

shows that the $open variable contains the full path to the selected file in all instances.

However, the succeeding RUN gets us a "%1 is not a valid Win32 application" AutoIt error message every time any file that is not a .bat or .exe is called to open...

Strange :o ?

Thanks --

Why is that strange? since can you run another file then .exe , .bat and .com ?

If you are looking to open the file with the associated application without using start.exe then you have to put the logic into your program that it adds the application executable needed to open the file.

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

@JdeB:

"Why is that strange? since can you run another file then .exe , .bat and .com ?"

Common sense . . .

Can easily perform the desired "All (*.*)" launch functionality with .ahk (AutoHotkey) by simply calling a system verb along with the target:

Run, open C:\

A "hip tip" for anyone who needs this core functionality in a quick script :)

No problem now . . .

[center][font="Courier"][quote]Which end do you put the cheesecake in?[/quote][/font][/center]

Link to comment
Share on other sites

@JdeB:

"Why is that strange? since can you run another file then .exe , .bat and .com ?"

Common sense . . .

Can easily perform the desired "All (*.*)" launch functionality with .ahk (AutoHotkey) by simply calling a system verb along with the target:

Run, open C:\

A "hip tip" for anyone who needs this core functionality in a quick script :)

No problem now . . .

... And if you open a command prompt and type start c:\, you get the same results.
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...