Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
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
?
730 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

Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
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…
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…
Suggested Courses

609 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