[VBS] handling multiple files in context menu
Page 1 of 113 Replies - 1165 Views - Last Post: 03 April 2012 - 09:31 AM
#1
[VBS] handling multiple files in context menu
Posted 17 March 2012 - 06:58 AM
I wrote a script that added an item to right-click context menu, and sent all selected folders as arguments
The problem is that the OS creates a new instance of the script on each selected folder.
For example: if I marked 3 folders, there will be 3 instances of the script, each has one argument with a folder's path, and I need 1 instance of the script with 3 arguments
How can I solve this?
P.S
I have no code to show you, because it is in work : )
I only have to complete this part
Thanks!
Replies To: [VBS] handling multiple files in context menu
#2
Re: [VBS] handling multiple files in context menu
Posted 17 March 2012 - 10:37 AM
We don't do that here. We will help you with your code.
#3
Re: [VBS] handling multiple files in context menu
Posted 17 March 2012 - 09:55 PM
You can see other threads I've opened
The mission is actually select folders-->right click-->choose custom item I added to the context menu-->show screen with the number of the selected folders and their size
My code (which again..is not on my computer at home and can't be moved to it because it's a different network) has all the components, except it's running multiple times instead of one..that's the only part I need : )
#4
Re: [VBS] handling multiple files in context menu
Posted 17 March 2012 - 10:33 PM
Imagine, the engine in your car is making a horrible noise; you can't drive it to the mechanic so you take a cab. You then tell the mechanic about the noise and ask him how can you/him/her solve this. IMPOSSIBLE!!!
We have to see the code in order to tell you what is wrong with it.
#5
Re: [VBS] handling multiple files in context menu
Posted 18 March 2012 - 11:31 AM
GunnerInc, on 17 March 2012 - 10:33 PM, said:
Imagine, the engine in your car is making a horrible noise; you can't drive it to the mechanic so you take a cab. You then tell the mechanic about the noise and ask him how can you/him/her solve this. IMPOSSIBLE!!!
We have to see the code in order to tell you what is wrong with it.
As I said..my work has a different network..it is not connected to the "regular" one
However I wrote a simple example at home
Lets say I want to mark folders with the mouse, right click on them, select my command from the context menu and a message with the number of the marked folders pop up
So this is my script:
WScript.Echo "Num Folders Selected: " & WScript.Arguments.Count
I added the right keys in the registry: HKEY_CLASSES_ROOT\Directory\shell\Folders Counter\command
The default value: wscript.exe "SomePath\vbsTest.vbs" "%1"
The result:

Instead of one popup with "3" in it
I don't know what should I do to accomplish this..
I read that %2 %3 etc won't help
#6
Re: [VBS] handling multiple files in context menu
Posted 18 March 2012 - 11:35 AM
Increment a counter, then call the MessageBox after the loop is complete.
#7
Re: [VBS] handling multiple files in context menu
Posted 18 March 2012 - 12:33 PM
tlhIn`toq, on 18 March 2012 - 11:35 AM, said:
Increment a counter, then call the MessageBox after the loop is complete.
It is not a loop
My code has only 1 line, which is the line I wrote earlier : )
It opens 3 message boxes because I marked 3 folders-->right click on them-->chose my command
It actually opens 3 instances of wscript.exe for each folder, and I want 1 instance with 3 parameters or maybe to ask if my script (which have to be another name in the task manager, instead of wscript.exe) is already running, and if it does so send the folder to it (the running one) instead of open new instance of the script : )
Thanks
This post has been edited by FoodGood: 18 March 2012 - 12:34 PM
#8
Re: [VBS] handling multiple files in context menu
Posted 18 March 2012 - 12:50 PM
Quote
Ok... That makes sense. Simplistic script with 3 instances in play. Each instance creates a MessageBox.
So there's no controller of any kind? No service running... no application in the background minimized to a task tray?
I think that's the direction you're going to need to go. You need some sort of parent controller that all these child script instances report to. Instead of each one creating a MessageBox they need to notify the controller (service?) that they're done. Then the controller can do whatever it needs to do: Write a log entry, open a MessageBox, open a tasktray notify balloon ...
#9
Re: [VBS] handling multiple files in context menu
Posted 18 March 2012 - 02:13 PM
#10
Re: [VBS] handling multiple files in context menu
Posted 18 March 2012 - 09:51 PM
tlhIn`toq, on 18 March 2012 - 12:50 PM, said:
Quote
Ok... That makes sense. Simplistic script with 3 instances in play. Each instance creates a MessageBox.
So there's no controller of any kind? No service running... no application in the background minimized to a task tray?
I think that's the direction you're going to need to go. You need some sort of parent controller that all these child script instances report to. Instead of each one creating a MessageBox they need to notify the controller (service?) that they're done. Then the controller can do whatever it needs to do: Write a log entry, open a MessageBox, open a tasktray notify balloon ...
As far as I know, wscript.exe is the running process in background
If I write a parent controller, the problem is how can I make it run only one..don't forget that the right-click menu item is the trigger
GunnerInc, on 18 March 2012 - 02:13 PM, said:
That's what I want to know..The explorer thing
I didn't find it anywhere
#11
Re: [VBS] handling multiple files in context menu
Posted 19 March 2012 - 03:59 PM
Attached image(s)
#12
Re: [VBS] handling multiple files in context menu
Posted 02 April 2012 - 10:58 PM
GunnerInc, on 19 March 2012 - 03:59 PM, said:
Hi
Sorry about the delay
I have already knew this solution
This is not the one I'm looking for
I know there is a solution, but I can't find it..I think it is a registry solution
#13
Re: [VBS] handling multiple files in context menu
Posted 03 April 2012 - 07:59 AM
We aren't mind readers. We don't know which of 15 ways you already know but found unacceptable.
<unsubscribing from this thread>
#14
Re: [VBS] handling multiple files in context menu
Posted 03 April 2012 - 09:31 AM
tlhIn`toq, on 03 April 2012 - 07:59 AM, said:
We aren't mind readers. We don't know which of 15 ways you already know but found unacceptable.
<unsubscribing from this thread>
Don't blame the messenger
The reason I'm still asking for a solution, is because the "sent to" solution is not fitting the problem..It is a work-around
|
|

New Topic/Question
Reply




MultiQuote







|