Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Vista Forums > General Discussion

Vista - drag & drop "open with.." additional params

Reply
 
Old 09-14-2008   #1 (permalink)


Vista Home Premium 64 bit SP1
 
 

drag & drop "open with.." additional params

Anyone know if it is possible to create a shortcut drag & drop target so that when I drag a program and drop it on the shortcut, then select "open with" the shortcut that is dropped on can insert the name of the dropped program into the command line params? IOW, say I want a shortcut that opens a program at x y 100 100 no matter what I drop on it. My program knows how to do the positioning but it needs to read the name of the dropped program as well as the rest of the params in its shortcut. I've tried MyProg.exe "%1" x y in the target line but when I drop anything on it and do Open With I get "%1" not found. Is there a magic bullet?

My System SpecsSystem Spec
Old 09-14-2008   #2 (permalink)


Windows 7 RC x64 Vista HP x86
 
 

Hi MilesAhead,

I think that to do this you will need to create your shortcut to some form of script file ( VBScript, Powershell etc. that can then call your program and pass the parameters as needed.

I can't help with the script but it should be achievable for someone who knows more than I do, You may want to try posting directly to one of the MS script newsgroups.

sorry can't be of more help but hopefully maty point you in the right direction

may seem silly but have you tried %1, %2, %3 etc.

Last edited by dmex; 09-14-2008 at 11:02 PM..
My System SpecsSystem Spec
Old 09-14-2008   #3 (permalink)


Vista Home Premium 64 bit SP1
 
 

Re: drag & drop "open with.." additional params

Quote  Quote: Originally Posted by barman58 View Post
may seem silly but have you tried %1, %2, %3 etc.
Thanks for the reply.

I could just do a .cmd file to call my program:

@echo off
Myprog.exe "%1" param2 param3 param4

I was just hoping I could do it on the shortcut Target line.
One would think there'd be a way to insert a symbolic substitution
but this is Windows we're talkin' about so...

Last edited by MilesAhead; 09-14-2008 at 06:18 PM.. Reason: man I don't understand where all these typos come from
My System SpecsSystem Spec
Old 09-14-2008   #4 (permalink)


Windows 7 RC x64 Vista HP x86
 
 

Re: drag & drop "open with.." additional params

It's the ghost in the machine or is it The gremlins
My System SpecsSystem Spec
Old 09-14-2008   #5 (permalink)


Vista Home Premium x64 SP1
 
 

Re: drag & drop "open with.." additional params

Quote  Quote: Originally Posted by MilesAhead View Post
I've tried MyProg.exe "%1" x y in the target line but when I drop anything on it and do Open With I get "%1" not found. Is there a magic bullet?
When you drop a file onto a shortcut, the path of the dropped file is automatically added to the command line.

For example I just did an experiment here...
Normally the command to print from metapad is:
c:\pathto\metapad.exe /p d:\pathto\myfile.txt

So I made a desktop shortcut with the command:
c:\pathto\metapad.exe /p
(notice there is no %1)
Then I dropped a textfile onto that shortcut and it printed it.

I think in your case, when you included %1 in your shortcut's command line, the name of the dropped file ends up being included twice in what actually gets executed. So try it without the "%1", only with the other parameters or command line switches your program wants.
My System SpecsSystem Spec
Old 09-15-2008   #6 (permalink)


Vista Home Premium 64 bit SP1
 
 

Re: drag & drop "open with.." additional params

So you're saying the param gets stuck on the end of the line?
See I don't understand why it can't be positioned with a placeholder.
Oh well, it's just an idea. Instead of drag & drop it would prolly be
easier to use a DosKey macro. Then I can use $1 $2 to position the
params within the constant params. You'd think positional substitution
would've been thought necessary by now but I guess it's make yet
another wrapper for the wrapper.
My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
No "accounts" name in the "Tool" drop down menu. Vista mail
Drop down window upon right click of desk top "Open" will not open Vista General
How to turn off "rich drag and drop"? Vista file management
Explorer restarts after "drag & Drop" Vista General
Access denied trying to "md"? Drag & Drop is now drag, drop, OK, OK ???? Vista installation & setup


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46