Jump to content

[Q] A file open with AutoIT?


blackman12
 Share

Recommended Posts

Hi guys, ı have got a problem.My problem is:

for example i have got a rar file.And this file open with autoit exe file and this rar file unextract c:\ when i clicked this file.I accomplish everything but i can't open file with autoit.Because my script didnt know this file's full path...For example:

7z.exe e $filename -o"$filename"

Link to comment
Share on other sites

Hi guys, ı have got a problem.My problem is:

for example i have got a rar file.And this file open with autoit exe file and this rar file unextract c:\ when i clicked this file.I accomplish everything but i can't open file with autoit.Because my script didnt know this file's full path...For example:

7z.exe e $filename -o"$filename"

Sorry I do not know enough english if you can give more details I would be grateful because I don't understand very much from your description. :)

When the words fail... music speaks.

Link to comment
Share on other sites

Sorry for my bad english >_<

For example universal extractor.If you right-click a file and select unextract here, universal extractor can find file fullpath and unextract it.I wanna make this.

Look in the help file at FileOpenDialog().

If you want to include variables in the commandline for 7zip, you'll have to read the help file example for Operators and Strings, so you can assemble a string properly:

Global $sFile = FileOpenDialog("Pick-A-File", "", "RAR Archives(*.rar)", 1)
Global $sDir = FileSelectFolder("Pic-A-Folder", "", 7)
Global $sExtCmd = '7z.exe e "' & $sFile & '" -o "' & $sDir & '"'
$iRET = RunWait($sExtCmd)
MsgBox(64, "Results", "7-zip extraction returned: " & $iRET)

:)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

Thx but i know it.I want this:

I doubleclicked rar file and autoit script extract this rar file in c:\

7z.exe e "' & $sFile & '" -o "' c:\ '"'

You could change the file association for the .rar file type to run a batch file or AutoIt script that did that.

:)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

  • 1 month later...

you want to get the file path when you open

any file with your program or with command line , right ?

look in help file ( Command Line Parameters )

Command Line Parameters

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

...

$CmdLine[$CmdLine[0]] is one way to get the last parameter...

So if your script is run like this:

AutoIt3.exe myscript.au3 param1 "this is another param"

$CmdLine[0] equals... 2

$CmdLine[1] equals... param1

$CmdLine[2] equals... this is another param

@ScriptName equals... myscript.au3

In addition to $CmdLine there is a variable called $CmdLineRaw that contains the entire command line unsplit, so for the above example:

$CmdLineRaw equals... myscript.au3 param1 "this is another param"

If the script was compiled it would have been run like this:

myscript.exe param1 "this is another param"

$CmdLineRaw equals... param1 "this is another param"

Note that $CmdLineRaw just return the parameters.

Note : only 63 parameters can be return by $CmdLine[...], but $CmdLineRaw will always returns the entire command line.

Edited by komalo
[font="Palatino Linotype"][size="3"]AutoIt Script Examples :[/size][/font][font="Palatino Linotype"][size="3"]_CaptureBehindWindowGlass CMD for Windows Vista/Seven[/size][/font][left][/left][font="Palatino Linotype"][size="3"]Non AutoIt Script programs : Border Skin - Aero Glass On XP[/size][/font]
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...