FireFox Posted December 25, 2008 Share Posted December 25, 2008 (edited) Hi, Ive previously created contextmenuitem on context menu of windows. When I right click to a file I select my contextmenuitem wich run my script, but how can I know the full path of selected file ? Edit : I want also if possible to have progress when deleting a file Thanks for anyhelp, Merry xmas ; FireFox Edited December 25, 2008 by FireFox Link to comment Share on other sites More sharing options...
komalo Posted December 25, 2008 Share Posted December 25, 2008 you can know the file with $CmdLine array which is created when you pass a parameter ( the file in your case ) for more read "Command Line Parameters" in the help file ( Search For "$CmdLine[0]") [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 More sharing options...
FireFox Posted December 25, 2008 Author Share Posted December 25, 2008 @komalo Thanks for reply but the only thing about $CmdLine[0] in the helpfile is : CODE When you start AutoIt you will be asked to open a script file. A script file is a simple text file containing AutoIt keywords and functions that tell AutoIt what you want it to do. Script files are created in a simple text editor such as notepad.exe or a much better alternative. Although AutoIt v3 scripts are just plain-text files they are usually given the file extension .au3 to help tell the difference between a script and a text file. If you used the full installer to install AutoIt you can execute an AutoIt script simply by double-clicking it. There are also various options to open, edit, or compile a script if you right-click on the .au3 file. Here is an example script. Notice that ; is used for comments (much like REM in DOS batch files): ; This is my first script MsgBox(0, "My First Script!", "Hello World!") More complicated scripts may use functions, which are usually placed at the end of a script. Here is a similar script using functions: ; This is my second script (with functions) MsgBox(0, "My second script!", "Hello from the main script!") TestFunc() Func TestFunc() MsgBox(0, "My Second Script!", "Hello from the functions!") EndFunc 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. AutoIt specific command Line Switches Form1: AutoIt3.exe [/ErrorStdOut] [/AutoIt3ExecuteScript] file [params ...] Execute an AutoIt3 Script File /ErrorStdOut Allows to redirect fatal error to StdOut which can be captured by an application as Scite editor. This switch can be used with a compiled script. To execute a standard AutoIt Script File 'myscript.au3', use the command: 'AutoIt3.exe myscript.au3' Form2: Compiled.exe [/ErrorStdOut] [params ...] Execute an compiled AutoIt3 Script File produced with Aut2Exe. Form3: Compiled.exe [/ErrorStdOut] [/AutoIt3ExecuteScript file] [params ...] Execute another script file from a compiled AutoIt3 Script File. Then you don't need to fileinstall another copy of AutoIT3.exe in your compiled file. Form4: AutoIt3.exe [/ErrorStdOut] /AutoIt3ExecuteLine "command line" Execute one line of code. To execute a single line of code, use the command: Run(@AutoItExe & ' /AutoIt3ExecuteLine "MsgBox(0, ''Hello World!'', ''Hi!'')"') The tray icon will not be displayed when using /AutoIt3ExecuteLine NOTE: Correct usage of single- and double- quotation marks is important, even double single. And I dont know what to do if its this Link to comment Share on other sites More sharing options...
MrCreatoR Posted December 25, 2008 Share Posted December 25, 2008 the only thing about $CmdLine[0] in the helpfile isIt's not enough? Use it like this: If $CmdLine[0] > 0 Then ConsoleWrite("First command line (file path): " & $CmdLine[1] & @CRLF) Spoiler Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1 AutoIt Russian Community My Work... Spoiler Projects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize ProgramUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF Examples: ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating ) * === My topics === * ================================================== ================================================== AutoIt is simple, subtle, elegant. © AutoIt Team Link to comment Share on other sites More sharing options...
FireFox Posted December 25, 2008 Author Share Posted December 25, 2008 @MrCreatoR Thanks, I hadnt understand what was the function Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now