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
712 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
Comment Utility
>>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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
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…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

743 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now