Jump to content

running a script as an "open with" program


Recommended Posts

hi all;

for the 1st time i'm trying to trigger a script (or .exe) with an argument of a selected file. an example: select one in explorer, r-click and then "open with... myscript.exe" or "send to... myscript.exe". this is just to process the selected file using a script.

so far i've been launching the script separately and i have no idea if what i'm planning to do is feasible. i've tried using $CmdLine, but with no luck. Anyone who could give me a hint?

thanks!

cell

Link to comment
Share on other sites

Hi and welcome to the forums ;)

You were on the right track there.

This sample shows how to use $CmdLine

If $CmdLine[0]>0 Then
    MsgBox(0,"File parameter",$CmdLine[1])
; Do processing here =)
EndIf

:D

Edited by monoceres

Broken link? PM me and I'll send you the file!

Link to comment
Share on other sites

hi all;

for the 1st time i'm trying to trigger a script (or .exe) with an argument of a selected file. an example: select one in explorer, r-click and then "open with... myscript.exe" or "send to... myscript.exe". this is just to process the selected file using a script.

so far i've been launching the script separately and i have no idea if what i'm planning to do is feasible. i've tried using $CmdLine, but with no luck. Anyone who could give me a hint?

thanks!

cell

If you want to be able to right click on a file in explorer and have a menu item which lets you run your own compiled script you can do it like this.

$KeyName = "celluitExtra";whatever you want the keyname to be. (it has no effect on the operation but must not already exist)
$ContextMenuName = "Run My Special Program";set the menu item name here
$ProgramToRun = @SystemDir & "\mspaint.exe";put your porogram name here
RegWrite("HKEY_CLASSES_ROOT\*\shell\" & $KeyName & "\command", '', 'REG_SZ', '"' & $ProgramToRun & '" "%1"');'"' & @ScriptFullPath & '" "%1"')
RegWrite("HKEY_CLASSES_ROOT\*\shell\" & $KeyName, '', 'REG_SZ', $ContextMenuName)
MsgBox(0, "Done", $ContextMenuName & " has been added to explorer's context menu")

Then the parameter passed to your exe will be the full path to the file, and it can be read as monoceres showed you.

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
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...