Page 1 of 1
Script on toolbar button to launch file into Excel problem
Posted: 17 Sep 2009 11:23
by petersboulton
Hi,
I like the new custom toolbar buttons and want to make one that launches the currently selected file in the list view into Excel. This is my 'solution':
Code: Select all
::run '"C:\Program Files\Microsoft Office\Office12\EXCEL.EXE" <curitem>';
However, when I run it Excel does launch, but displays the message "'<curitem>.xlsx' could not be found. Check the spelling of the file name, and verify that the file location is correct."
This tells me that XY must be passing through the literal text "curitem" rather than the path of the current item in its command line to Excel! However, I'm a script newbie, so possibly I'm misunderstanding something along the line and am hoping for some enlightenment! Thanks.
Pete
Re: Script on toolbar button to launch file into Excel problem
Posted: 17 Sep 2009 11:31
by zer0
What if you used this script:
Code: Select all
OpenWith "C:\Program Files\Microsoft Office\Office12\EXCEL.EXE";
It defaults to currently selected item and supports the full power of OpenWith UDC.
Re: Script on toolbar button to launch file into Excel problem
Posted: 17 Sep 2009 11:35
by Stefan
This quoting tricked me always too, but it seams i go faster now
Code: Select all
::run "C:\Program Files\Microsoft Office\OFFICE11\EXCEL.EXE" "<curitem>";
Re: Script on toolbar button to launch file into Excel problem
Posted: 17 Sep 2009 11:55
by petersboulton
Stefan wrote:This quoting tricked me always too, but it seams i go faster now
Code: Select all
::run "C:\Program Files\Microsoft Office\OFFICE11\EXCEL.EXE" "<curitem>";
Thanks Stefan, but your modification gives me a scripting error message box:
"The system cannot find the file specified.
run "C:\Program Files\Microsoft Office\OFFICE11\EXCEL.EXE" "G:\TEMP\prodsNew.tab"
zerO's proposal, (OpenWith "C:\Program Files\Microsoft Office\Office12\EXCEL.EXE";) works, many thanks!
However, is the problem with ::run "C:\Program Files\Microsoft Office\OFFICE11\EXCEL.EXE" "<curitem>"; a bug?
Pete
Re: Script on toolbar button to launch file into Excel problem
Posted: 17 Sep 2009 12:02
by zer0
petersboulton wrote:Stefan wrote:This quoting tricked me always too, but it seams i go faster now
Code: Select all
::run "C:\Program Files\Microsoft Office\OFFICE11\EXCEL.EXE" "<curitem>";
Thanks Stefan, but your modification gives me a scripting error message box:
"The system cannot find the file specified.
run "C:\Program Files\Microsoft Office\OFFICE11\EXCEL.EXE" "G:\TEMP\prodsNew.tab"
zerO's proposal, (OpenWith "C:\Program Files\Microsoft Office\Office12\EXCEL.EXE";) works, many thanks!
However, is the problem with ::run "C:\Program Files\Microsoft Office\OFFICE11\EXCEL.EXE" "<curitem>"; a bug?
Pete
You're welcome, I'm glad you're up and running with your TB
I believe the reason why Stefan's script doesn't work is because he used Office11 in the address of Excel's location, which suggests that he's on Office 2003. Your original script has Office12 so you're using Office 2007, correct?
Re: Script on toolbar button to launch file into Excel problem
Posted: 17 Sep 2009 12:05
by jacky
petersboulton wrote:However, is the problem with ::run "C:\Program Files\Microsoft Office\OFFICE11\EXCEL.EXE" "<curitem>"; a bug?
Probably not, as I believe it should be more like this:
Code: Select all
::run """C:\Program Files\Microsoft Office\OFFICE11\EXCEL.EXE"" ""<curitem>""";
And FYI, your first try didn't work because you single-quoted the argument, and variables aren't resolved in single-quoted strings. So, indeed, XY was sending along a literal <curitem> as parameter to Excel.
Re: Script on toolbar button to launch file into Excel problem
Posted: 17 Sep 2009 12:20
by petersboulton
OP here. Sorry, I did not notice the 'Office11' bit. I am Office12 (2007) so I can understand why I got the error message!

Sorry about that!
Jacky's script works fine, thanks and I'm sorry I mentioned the B(ug) word. I should know better!
The user defined buttons are another great new feature!
Thanks to all for your help. Appreciated.
Pete