Sign in to follow this  
Followers 0
Marcus

Can't RUN Files from FileOpenDialog ?

10 posts in this topic

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]

Share this post


Link to post
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)


Get Beta versions Here Get latest SciTE editor Here AutoIt 1-2-3 by Valuater - A great starting point.

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

Share this post


Link to post
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)

Share this post


Link to post
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]

Share this post


Link to post
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]

Share this post


Link to post
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]

Share this post


Link to post
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 --

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.


Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
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]

Share this post


Link to post
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.

Share this post


Link to post
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
Sign in to follow this  
Followers 0