On May 8, 12:02 pm, "jm.almeras" <nos...@xxxxxx> wrote:
> Your answer is interesting to me because i also wish to make it possible to
> apply the script to selected files. It works with a small number of files
> which i drop on the script (or its shortcut), but there is a limit : the
> maximum size of the command line (pity !) Here's an example:
In HKCR\*\shell\ place:
Cmd (REG_SZ): &Cmd window in this directory
Then make a subkey: In HKCR\*\shell\Cmd\ place command (REG_SZ):
cmd /K cd "%0\.." & title Context Menu Cmd Window & mode con lines=60
cols=100
or
cmd "c:\phplib\Context Cmd window.lnk"
If you do the second one (which is preferable for me) my
Context Cmd window.lnk shortcut has the following properties set:
under General: Context Cmd window
under Shortcut:
Target: %windir%\system32\cmd.exe
Shortcut key: None
Run: Normal window
under Options:
Cursor size: Small
Display options: Window
Edit options: QuickEdit mode, Insert mode
under Layout:
Screen buffer size: Width: 90, Height: 300
Window size: Width: 90, Height: 70
Window position: Let system position window
If you have a custom editor you like, you could do something like:
\HKCR\*\shell\Edit2: &Edit (with emacs)
\HKCR\*\shell\Edit2\command: C:\Program Files\emacs\bin\runemacs.exe -
geometry 155x59 "%1"
For a specific file type it's a bit more involved. Let's say .jpg
Go to
\HKCR\.jpg\(Default) and see the value listed there. It's jpegfile
Now make
\HKCR\jpegfile\shell\Resize: Res&ize
\HKCR\jpegfile\shellResize\command: c:\phpdir\php-win.exe "C:\Photo
\Util\Resize.php" "%1" %*
That %0 and %1 are the file that you are right clicking on.
The quotes (") are because of possible spaces in file names
%* means any remaining arguments
> I would be interested in knowing what change you make in the registry. But
> is this solution not equivalent to putting the script in the SendTo Folder
> and when selecting a file or several, selecting Send To the script in the
> contextual menu ? I've never worked with "SendTo" and I don't know the answer to that.
> Thank you
>
> Jean-Marie
>
> "Csaba Gabor" <dans...@xxxxxx> a écrit dans le message de news:
> 32a8e31d-e8f8-4be2-809f-69e170270...@xxxxxx
>
> > On May 6, 12:15 am, "jm.almeras" <nos...@xxxxxx> wrote:
> >> In a VBScript I wish to know if the script was called from a shortcut and
> >> if
> >> so what is the path of this shortcut. Is this possible ? >
> >> In case you wish to know, here is why : i have a script which renames
> >> files in a folder. Currently i do the renames in the folder where the
> >> script
> >> itself is situated.
> >> I would like this to work also with a shortcut to the script file : the
> >> rename should apply to the folder where the shortcut is situated, not the
> >> folder where the script file is situated. >
> > This is a slippery problem, but it does have a solution...
> > if you ask the question in the right way. I have a more
> > complex situation because I want to apply the .vbs
> > script only to the selected files of a given directory. >
> > There are two situations. The first, which I never use
> > anymore, is that I have a shortcut. The shortcut needs
> > to know what directory it was started in. But that's
> > not good enough. It actually needs to know what
> > Explorer window is active so for that I had to make
> > a mini .OCX file which uses the winAPI
> > GetForegroundWindowHandle() and then I run through
> > the .windows collection of the Shell.Application
> > object to see if there's a match on the .HWND.
> > Richard Meuller's suggestion probably suffices
> > for your situation. >
> > The other thing that I do (independent of the prior
> > paragraph) is to make a change in the registry
> > so that for all .jpg files, I get a context
> > menu item (ie. when I right click) that will
> > execute my script when it's selected. The
> > script gets passed the name of the file
> > that it was started on, from which it knows
> > the directory. >
> > Csaba Gabor from Vienna