• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 732
  • Last Modified:

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

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
R-U-Bn
Asked:
R-U-Bn
2 Solutions
 
EDDYKTCommented:
>>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
 
Richie_SimonettiIT OperationsCommented:
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
 
suttCommented:
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
 
R-U-BnAuthor Commented:
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
 
R-U-BnAuthor Commented:
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

Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now