Jump to content

How to open a file with a specific extension from folder


h3xl3y
 Share

Recommended Posts

Hi

I am trying to open a file that can have different extension (.cue,.img) and name from a folder with a program

I can extract it to a folder but can't open it after

But i can open the file in that program if i don't extract it (if it is launched uncompressed)

The bad thing is that i have to keep my files compressed for space reasons

Searched everywhere but always find some different code that could work so i don't even know now which method is best

So far i have this

$app = "program.exe"
$app1 = "splash.exe"
$windows = "program window"
$Source = $CmdLine [1]
$Dest = "D:\Temp\"

If $CmdLine[0] == 1 Then
   RunWait('"'&@ScriptDir & '\7z.exe"' & ' x "' & $Source & '" ' & "-y -o" & '"' & $Dest & '"', "", @SW_HIDE)
   _MouseTrap(@DesktopWidth, @DesktopHeight, @DesktopWidth, @DesktopHeight)
   Run( $app1 )
   Do
     Sleep(1)
   Until _IsPressed( "20" )    
   ProcessClose( $app1 )
   Run('"' & $app & '" "' & $CmdLine[1] & '"')
   WinWait ( $windows )
   WinActivate ( $windows )
   While ProcessExists( $app )
       Sleep(500)
   WEnd
   Exit 0
EndIf

If someone know how to do it please help

Thanks

Edited by h3xl3y
Link to comment
Share on other sites

ShellExecute?

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

ShellExecute?

I tried to look at this but it seems that is used more to run a program

and what i try to do is open the extracted file with other application like opening a .cue file with Daemon Tools

sorry that if i was not clear enough in my previous post

Edited by h3xl3y
Link to comment
Share on other sites

Look again, it's used to open a file/program/URL etc. with the program that associated with that file type. So, if it's an html file or URL it will open with the default browser, if it's a .txt file it will be opened by the program associated with text files, and so on.

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

How would you normally start the program with the file to be opened? Write the Run command the same way.

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

Tis is the line i used before, and works for uncompressed files of course without the unzip line

Run('"' & $app & '" -nogui -loadbin "' & $CmdLine[1] & '"')

But with the unzip part from the first post doesn't work anymore

I changed 

$CmdLine[1]

 with $file

$file = "D:\Temp\*.cue"

and other variations, but no luck

Link to comment
Share on other sites

Not sure but this might help; Needed this to open files with reader instead of acrobat:

Local $tllpdf = (@ScriptDir & "\TLL.pdf")
ShellExecute('AcroRd32.exe', $tllpdf, "", "", @SW_MINIMIZE)

Bill

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