Solved

How to detect the SHIFT key modifier when the script is accessed from a file'²s right-mouse-click menu "send to" ?

Posted on 2003-11-12
6
723 Views
Last Modified: 2008-03-17
I have made a script "todir.vbs" and I placed it in my "Send To" folder.  When I right-mouse-click the mouse on a file in Windows XP and then choose in the Send To submenu "todir.vbs" I can copy a file to a certain predefined directory.  I did this through "fso.CopyFile Src, Destination, false" (or true).

Now, how can I detect or make it behave so that if I hold the SHIFT-key while right-mouse-clicking it doesn't copy , but move the file to the predefined directory. Just like SHIFT key behaves in other behaviors like drag&drop etc in Windows.

And how can I make the extension ".vbs" dissapear in the submenu ?

Thanks !!
0
Comment
Question by:R-U-Bn
6 Comments
 
LVL 26

Assisted Solution

by:EDDYKT
EDDYKT earned 20 total points
ID: 9731034
>>And how can I make the extension ".vbs" dissapear in the submenu ?


Bring up the property and you should be able to change the name
0
 
LVL 16

Accepted Solution

by:
Richie_Simonetti earned 60 total points
ID: 9731255
If it is a shortcut, you could change the name but if it is the real vbs file....
To avoid problems, store the vbs file in some place of the path (maybe c:\windows)
and create a short cut in the Send to folder pointing to it, then you can change the name.
0
 

Expert Comment

by:sutt
ID: 9776123
i have no experience in vbs-programming so perhaps this works - but you need to be able
 - to use api
 - and you need to put this almost into the first line to get it as fast as possible...

----------------
Declare Function GetKeyState Lib "user32" (ByVal nVirtKey As Long) As Integer
Public Const VK_SHIFT = &H10
----------------

if you call getkeystate(vk_shift) you will get the state of that key.
i tested it in vb and i had 0 if not pressend and -127 if pressed - i guess checking for not-equal-0 should work fine...

----------------------------------

or use this workaround:

create 2 links in your sendto folder like
todir (move)
todir (copy)

give them parameters like /m and /c and check those in your code and then copy or move


0
 
LVL 2

Author Comment

by:R-U-Bn
ID: 9782576
Ok..Naming is solved, thx Richie.

Sutt, First option is too depending (api), alsoit might miss the shift key since it is time dependant too.  Second is also not perfect (it doesnt' use SHIFT), but interesting.

You see, I have had a vbs script that did this without this code nor with 2 shortcuts.  I just can't remember how (I think it depends on the funtion used inside the script or so and that a SHIFT-SendTo results in a different behavior somehow.  and it's that somehow that I can't find :-) I was thinking about what a SHIFT-SendTo changes (maybe some parameters are given to the script to tell the script whether this was accessed with a shift or a parameter that tels wether it has been dragging etc..)

0
 
LVL 2

Author Comment

by:R-U-Bn
ID: 10460666
THough only half answers, I accepted it as 'the ' answer.

I guess it has to do with laziness of going through an adminstrator thread each time my answer doesn't get answered in full.

Sorry
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question