Page 1 of 1

Customize Right Mouse Click?

Posted: 27 Oct 2008 23:37
by Techworks
Can I customise the right mouse click so it gives me custom menu options for specific file associations?

With Win Explorer, under Tools-folder options, File Types tab, under MDB extensions, Advanced button I have added the following commands:

"C:\Program Files\Office97Pro\Office\MSACCESS.EXE" "%1" /COMPACT
"C:\Program Files\Office97Pro\Office\MSACCESS.EXE" "%1" /DECOMPILE

These give me right mouse click menu options to compact and decompile MS access files with the file selected is an mdb.

Problem is its very messy setting these up on new machines that have multiple versions of Office installed (Office 97, XP and 2007) as these commands are specific to each version, and Explorer only remembers the last version of Office it was opened with.

So I have to open access 97, then go into Explorer Tool folder options and add the commands with full path for the version. Then close access and re open in next version and do same. Each menu command is saved against the relevant file extension for the relevant version of Office.

These right click menus show up in XYPlorer, but I was wondering if there was a simpler way to do this using XYPlorer customization and keep it away from Win Exp.

I could create a UDF? and add it to the User menu? but could I make it specific to the file extension

can you add a UDF to a right click ??

Thanks in Advance

Grant

Re: Customize Right Mouse Click?

Posted: 27 Oct 2008 23:41
by admin
Hi & welcome!

POM is your friend. Read this:
http://www.xyplorer.com/tour/index.php?page=pom

enjoy,
Don

Re: Customize Right Mouse Click?

Posted: 28 Oct 2008 23:28
by Techworks
unfortunately POM doesnt work with the Access comact command

If I add this line to hte POM

|"Compact MDB" mdb>"C:\Program Files\Office97Pro\Office\MSACCESS.EXE" "%1" /COMPACT

I get an Access error message "couldnt find file %1.mdb"

I've tried using the following script:

openwith "C:\Program Files\Office97Pro\Office\MSACCESS.EXE" "%1" /COMPACT

but get a script debug window with "Overflow" error. If I click Continue it opens the folder

I think its because the /compact command needs the %1 switch to pass the filename so that the Access internal comact command it invoked when the mdb is opened.

Hmm...

Re: Customize Right Mouse Click?

Posted: 28 Oct 2008 23:33
by Muroph
try <curitem> instead of %1.
not sure if it'll work, tho.

Re: Customize Right Mouse Click?

Posted: 29 Oct 2008 00:59
by serendipity
What does this do?

Code: Select all

   openwith """C:\Program Files\Office97Pro\Office\MSACCESS.EXE"" /COMPACT"

Re: Customize Right Mouse Click?

Posted: 31 Oct 2008 01:45
by Techworks
this command compacts the currently selected file (.mdb) by using the right mouse click in windows explorer without having to open it and use the menu Tools database utilities-compact

Dito for the decompile, although there is no menu command for this, its an undocumented command line switch that decomplies all the vb code and often fixes "rough" code

Cheers

Grant

Re: Customize Right Mouse Click?

Posted: 31 Oct 2008 02:21
by serendipity
Techworks wrote:this command compacts the currently selected file (.mdb) by using the right mouse click in windows explorer without having to open it and use the menu Tools database utilities-compact

Dito for the decompile, although there is no menu command for this, its an undocumented command line switch that decomplies all the vb code and often fixes "rough" code

Cheers

Grant
Oh yes, i understood what you were saying. I meant did you try openwith command without "%1". Which is:

Code: Select all

openwith """C:\Program Files\Office97Pro\Office\MSACCESS.EXE"" /COMPACT"
What happens if you use that?

Re: Customize Right Mouse Click?

Posted: 31 Oct 2008 03:54
by Techworks
ok ,curritem. doent work, so I have tried building up the command line with the exe , file name and switch using variables but now I'm having problems with the script only running multiple commands if they are all on a single line.

I'm assuming you can separate commands on consecutive lines using the ";" but its not working

Here are my two options

"hard coded string"
run '"C:\Program Files\Office97Pro\Office\MSACCESS.EXE" "S:\TechWorks\DB\Techworks\App\Copy of TWApp081017.mdb" /compact'

"single line"
$strEXE = quote("C:\Program Files\Office97Pro\Office\MSACCESS.EXE");$strFile = quote(<curitem>)." ";$strSwitch = " /compact";$strAll = $strEXE.$strFile.$strSwitch;open $strAll

"multiple lines"
$strEXE = quote("C:\Program Files\Office97Pro\Office\MSACCESS.EXE");
$strFile = quote(<curitem>)." ";
$strSwitch = " /compact";
$strAll = $strEXE.$strFile.$strSwitch;
open $strAll

The first one works perfectly
The second now works as well, yahoo
The third one doesnt. It just lists the lines and doesnt actually step through them consecutively.

What am I doing wrong? Surely the scripting supports carriage returns between commands????

Cheer

Grant

Re: Customize Right Mouse Click?

Posted: 31 Oct 2008 04:19
by serendipity
Techworks wrote:ok ,curritem. doent work, so I have tried building up the command line with the exe , file name and switch using variables but now I'm having problems with the script only running multiple commands if they are all on a single line.

I'm assuming you can separate commands on consecutive lines using the ";" but its not working

Here are my two options

"hard coded string"
run '"C:\Program Files\Office97Pro\Office\MSACCESS.EXE" "S:\TechWorks\DB\Techworks\App\Copy of TWApp081017.mdb" /compact'

"single line"
$strEXE = quote("C:\Program Files\Office97Pro\Office\MSACCESS.EXE");$strFile = quote(<curitem>)." ";$strSwitch = " /compact";$strAll = $strEXE.$strFile.$strSwitch;open $strAll

"multiple lines"
$strEXE = quote("C:\Program Files\Office97Pro\Office\MSACCESS.EXE");
$strFile = quote(<curitem>)." ";
$strSwitch = " /compact";
$strAll = $strEXE.$strFile.$strSwitch;
open $strAll

The first one works perfectly
The second now works as well, yahoo
The third one doesnt. It just lists the lines and doesnt actually step through them consecutively.

What am I doing wrong? Surely the scripting supports carriage returns between commands????

Cheer

Grant
There has to be atleast one space character before every command, like this:

Code: Select all

"multiple lines"
   $strEXE = quote("C:\Program Files\Office97Pro\Office\MSACCESS.EXE");
   $strFile = quote(<curitem>)." ";
   $strSwitch = " /compact";
   $strAll = $strEXE.$strFile.$strSwitch;
   open $strAll

Re: Customize Right Mouse Click?

Posted: 31 Oct 2008 04:23
by Muroph
this should give the same "open" command as the previous script (without all the variables)

Code: Select all

open """C:\Program Files\Office97Pro\Office\MSACCESS.EXE"" ""<curitem>"" /compact";

Re: Customize Right Mouse Click?

Posted: 06 Nov 2008 10:26
by Techworks
Ha, that now works, but I did try it oringinally, but obvoisly I had the "" wrong

Thanks

Grant