Sign in to follow this  
Followers 0
cellulit

running a script as an "open with" program

4 posts in this topic

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

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

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!

Share this post


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

Share this post


Link to post
Share on other sites

Thanks everybody for your help! Much appreciated! ;)

I'll give it a try and see what happens...

Thanks!!!

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