Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Other Programming > VBScript
|
VBScript For questions and discussions related to VBScript.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VBScript section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old February 10th, 2005, 07:29 PM
Registered User
 
Join Date: Feb 2005
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Executing VBscript with a right click context menu

Hi all,

I am new to forums so I am not sure if this is the right place to ask this question.

I have recently created a VB script that takes image files and reduces their size. The script handles multiple files handed to it and works fine.
The problem lies when I run the script from a right click context menu in windows. Currently if i right click a jpg file and click on my script it works fine for one digital image file but as soon as i select multiple digital images instead of passing the files to the script all at once it passes the each digital image one at a time opening multiple instances of my script. The main feature of the script is that it handles batch conversions.

Currently i am using wscript.exe "c:\myProgram.vbs" %1 in registry. Is there any way i can modify registry to pass my script multiple files at a time as one argument.

Thank you in advance

KT
Reply With Quote
  #2 (permalink)  
Old February 14th, 2005, 09:03 AM
Friend of Wrox
 
Join Date: Mar 2004
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

Wouldn't you set up the script to accept multiple files in a command line argument variable inside the script? I am not sure how right clicking and collecting a bunch of files would be passed as a "command line" argument.

Why would the registry be an issue? I am intermediate, and did not know the registry would come into play (accept to add the script to the right click menu.) What keys are you using to do this?


mmcdonal
Reply With Quote
  #3 (permalink)  
Old February 14th, 2005, 03:25 PM
Registered User
 
Join Date: Feb 2005
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi mmcdonal,

Thank you for your response. The script already accepts multiple files in command line argument variable inside the script. Currently if you drag and drop multiple files the script handles them nicely. If you add the script into your sendto ie right click sendto it also handles multiple files as well. Just not by adding the script to a right click context menu in windows.

In registry you can pass an argument to a file by inserting %1 for example wscript.exe "c:\myProgram.vbs" %1. This means that if you highlight a file and right click the file is passed to the script as an argument. If you select multiple files and right click the files do not get passed as one argument ie a list of file names but rather a list of multiple files. This causes the script to open multiple times and only handling a file at a time.

I have also tried adding multiple arguments such as %1 %2 %3 but this does not work and it only goes up to 9 which is useless for big batch job conversions.

I didn't think this would be an issue but this has caused more problems than i thought.

Reply With Quote
  #4 (permalink)  
Old December 6th, 2006, 04:39 PM
Registered User
 
Join Date: Dec 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I'm currently having the exact same issue. I can't find anything ANYwhere to do this for VB. Have you found a solution?

If you can pick it up, take it with you.  You never know when you might need it.
Reply With Quote





Similar Threads
Thread Thread Starter Forum Replies Last Post
CH 15 Context Menu - Element Menu Items Razzy The Pug BOOK: Ivor Horton's Beginning Visual C++ 2005 2 November 9th, 2008 03:53 PM
Need help in context menu Hannibal General .NET 0 January 3rd, 2007 12:24 AM
right click menu hidden by drop-drown menu Andraw HTML Code Clinic 0 March 18th, 2005 03:28 PM
Context Menu JMorrell Beginning VB 6 2 February 18th, 2005 09:33 AM
context menu mookashi Pro VB 6 0 March 16th, 2004 06:48 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.