?
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
Medium Priority
?
728 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 26

Assisted Solution

by:EDDYKT
EDDYKT earned 40 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 120 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
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 utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses
Course of the Month12 days, 19 hours left to enroll

777 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