Page 1 of 1 1
Topic Options
#200303 - 2010-10-19 05:23 PM AddProgramItem Problem with "Program Files(x86)" Folder
swissjay Offline
Just in Town

Registered: 2010-10-19
Posts: 2
Loc: Switzerland
Hello Everyone

I try to create Shortcuts for the New Office Version on a Windows 2008 R2 Server. This Windows is an 64-Bit Release, therefore all 32-Bit Application incl. MS Office are installed under C:\Program Files (x86). e.g. Office path: C:\Program Files (x86)\Microsoft Office\Office14

I try to create a Shortcut for Access with the following code:

AddProgramGroup ("Microsoft Office 2010")
AddProgramItem ("C:\Program Files (x86)\Microsoft Office\Office14\MSACCESS.EXE", "Microsoft Access 2010", "", "", "C:\Program Files (x86)\Microsoft Office\Office14", 0, 0)

This isnt working at all. For 64-Bit Application installed under C:\Program Files all work well...

Have you an idea how to solve it?

Cheers

Jerome


Edited by swissjay (2010-10-19 05:27 PM)

Top
#200307 - 2010-10-19 07:18 PM Re: AddProgramItem Problem with "Program Files(x86)" Folder [Re: swissjay]
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4672
Loc: The Netherlands
I'm not using any 64 bit stuff yet but you might want to have a look at
 Code:
SetOption( "Wow64FileRedirection", "ON")

All SetOption options and what they do are listed on page 98 and 99 of the 4.61 manual.
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#200313 - 2010-10-20 11:12 AM Re: AddProgramItem Problem with "Program Files(x86)" Folder [Re: Mart]
swissjay Offline
Just in Town

Registered: 2010-10-19
Posts: 2
Loc: Switzerland
I found a Workaraund: Using DOS-names 8.3 Format works.

C:\Program Files(x86) = C:\Progra~2

User dir /x command to see 8.3 Format names

e.g.

AddProgramGroup ("Microsoft Office 2010")
AddProgramItem ("C:\Progra~2\Microsoft Office\Office14\MSACCESS.EXE", "Microsoft Access 2010", "", "", "C:\Progra~2\Microsoft Office\Office14", 0, 0)

Thanks for reading.

Cheers


Edited by swissjay (2010-10-20 11:14 AM)

Top
#200314 - 2010-10-20 01:14 PM Re: AddProgramItem Problem with "Program Files(x86)" Folder [Re: swissjay]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4396
Loc: New Jersey
Here's some kix code to automatically determine the path:
 Code:
    ; 32b Program Files path
    ; Determine the 8.3 name of the appropriate 32-bit (x86) Program Files path
    ; Get the full path
    $_Rc = IIf(InStr('%PROCESSOR_ARCHITECTURE% %PROCESSOR_ARCHITEW6432%', 'AMD64'), '%ProgramFiles(x86)%', '%ProgramFiles%')
    ; now get the 8.3 name
    $_Value = Left($_Rc, 3)
    $_Rc = WshPipe('%COMSPEC% /c dir ' + $_Value + ' /X | %WINDIR%\System32\Find.exe /i "' + SubStr($_Rc, 4) + '"')
    $_Value = $_Value + Trim(SubStr($_Rc[0][0], 40, 12))
This relies on our modified version of WSHPipe, downloadable from our Kix library on our web site. This does the detection and assures that it is properly translated to the 8.3 name.

Glenn
_________________________
Actually I am a Rocket Scientist! \:D

Top
#200315 - 2010-10-20 01:49 PM Re: AddProgramItem Problem with "Program Files(x86)" Folder [Re: swissjay]
BradV Offline
Seasoned Scripter
****

Registered: 2006-08-16
Posts: 686
Loc: Maryland, USA
Somehow I think it might work if you used single quotes instead of double quotes. Try:

 Code:
AddProgramItem ('C:\Program Files (x86)\Microsoft Office\Office14\MSACCESS.EXE', "Microsoft Access 2010", "", "", 'C:\Program Files (x86)\Microsoft Office\Office14', 0, 0)


or

 Code:
$Loc = "C:\Program Files " + Chr(40) + "x86" + Chr(41) + "\Microsoft Office\Office14"
AddProgramItem ($Loc + "\MSACCESS.EXE", "Microsoft Access 2010", "", "", $Loc, 0 0)

Top
#200318 - 2010-10-20 05:43 PM Re: AddProgramItem Problem with "Program Files(x86)" Folder [Re: BradV]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4396
Loc: New Jersey
The problem with the OP's code is that it hard codes a location, and that path is valid only on x64 systems. Wrapping it in quotes will make the code work, but only for a specific system configuration.

The code I posted uses the environment vars to determine the OS architecture and 32-bit PF path. This method will work on any system regardless of where the program files folder is, and will work on all architectures.

The resulting value will be the 8.3 folder name of the 32-bit program files path.

Glenn
_________________________
Actually I am a Rocket Scientist! \:D

Top
#200326 - 2010-10-21 03:12 PM Re: AddProgramItem Problem with "Program Files(x86)" Folder [Re: Glenn Barnas]
Allen Administrator Online   shocked
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4545
Loc: USA
I don't use AddProgramItem, so I haven't done any tests... but just based on this thread, wouldn't this qualify as a bug?
Top
#210654 - 2015-09-01 09:12 AM Re: AddProgramItem Problem with "Program Files(x86)" Folder [Re: Allen]
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11623
Loc: CA
Normally would not dig up and post to a topic this old but since I have code that pretty much already tells you where it's installed I'll post for those that happen along her in a Google search somehow.

Using the registry location for AppPath will tell you where the application is installed.

HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths

Read it and use in var as needed.

Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
1 registered (Allen) and 466 anonymous users online.
Newest Members
gespanntleuchten, DaveatAdvanced, Paulo_Alves, UsTaaa, xxJJxx
17864 Registered Users

Generated in 0.072 seconds in which 0.032 seconds were spent on a total of 13 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org