Solved

Adobe Execute Problem

Posted on 2004-10-04
10
397 Views
Last Modified: 2013-12-18
Hi

I need the code which would pick up the correct version of Adobe that the user has installed and then execute accordingly, at present all that i can do is hard code.

Any ideas, the following code is from the button.


@Command( [Execute]; "C:\\Program Files\\Adobe\\Acrobat 5.0
\\Reader\\AcroRd32.exe"; "r:\\SPARE PARTS\\PROTECTION PRODUCTS.pdf" )


Thanks
0
Comment
Question by:DavidAbbott
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 4
10 Comments
 
LVL 24

Expert Comment

by:HemanthaKumar
ID: 12218622
Use this command to find the exe that is assocuiated with recent version of acrobat

@regQueryValue("HKEY_CLASSES_ROOT"; "AcroExch.Document\\shell\\open";"command")

This will return the exe file path

~Hemanth
0
 

Author Comment

by:DavidAbbott
ID: 12224641
Thanks for the reply would the code be something like this?

@Command( [Execute]; @regQueryValue("HKEY_CLASSES_ROOT"; "AcroExch.Document\\shell\\open";"command")
; "r:\\SPARE PARTS\\PROTECTION PRODUCTS.pdf" )
0
 
LVL 24

Expert Comment

by:HemanthaKumar
ID: 12226744
yes.. but before that check the registry value is not null !!

eg;
pdfExec := @regQueryValue("HKEY_CLASSES_ROOT"; "AcroExch.Document\\shell\\open";"command");
@if( pdfExec = ""; @Prompt([ok];"Error";"No executable found to launch the file !"); @Command( [Execute]; pdfExec ; "r:\\SPARE PARTS\\PROTECTION PRODUCTS.pdf" ) )
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 31

Expert Comment

by:qwaletee
ID: 12228546
Not quite.  The registry query will return something like:
"C:\Program Files\Adobe\Acrobat 6.0\Reader" "%1"

So, you need to pull off the first string as the executable name: "C:\Program Files\Adobe\Acrobat 6.0\Reader"
And, you should dorp the quotes: C:\Program Files\Adobe\Acrobat\Reader

What might work better for you is querying HKCR Software\Adobe\Acrobat\Exe
...which is Ibelieve what Adobe recommends!
0
 

Author Comment

by:DavidAbbott
ID: 12246306
Ok, thanks for the help, but am even more confused now
0
 
LVL 24

Expert Comment

by:HemanthaKumar
ID: 12250663
why ?

You have to choose appropriate key that is it
0
 

Author Comment

by:DavidAbbott
ID: 12251001
the error message keeps being returned!
0
 
LVL 24

Expert Comment

by:HemanthaKumar
ID: 12251553
What is the error msg ?
0
 

Author Comment

by:DavidAbbott
ID: 12251580
"No executable found to launch the file !"
0
 
LVL 24

Accepted Solution

by:
HemanthaKumar earned 500 total points
ID: 12252023
Looks like that function can read only name value pair... and cannot read (Default) entries...

Only option left out is win32 API call..

Copy this into a ScripLibrary and use shell to execute your attachment

'OPTIONS SECTION
Option Public
Option Declare
Public Const HKEY_CLASSES_ROOT = &H80000000
Public Const HKEY_CURRENT_USER = &H80000001
Public Const HKEY_LOCAL_MACHINE = &H80000002
Public Const ERROR_SUCCESS = 0&


' DECLARATIONS SECTION
Declare Function RegOpenKey Lib "advapi32" Alias "RegOpenKeyA" (Byval hKey As Long, Byval lpSubKey As String, phkResult As Long) As Long
Declare Function RegCloseKey Lib "advapi32" (Byval hKey As Long) As Long
Declare Function RegQueryValueEx Lib "advapi32.dll" Alias "RegQueryValueExA" _
(Byval hKey As Long, Byval lpValueName As String, Byval lpReserved As Long, lpType As Long, Byval lpData As String, lpcbData As Long) As Long


Function GetRegistryValue(hkey,SubKey As String,ValueName As String)
      Dim phkResult As Long, lResult As Long
      
      Dim tmppath$,filename$,path$
      Dim buflen As Long
      Dim valuetype As Long
      Dim key$
      
      lResult=RegOpenKey(hKey, SubKey, phkResult)
      If lResult<>ERROR_SUCCESS Then
            Messagebox "Error opening registry..."
            Exit Function
      End If
      tmppath$ = String(256, " ")
      buflen = Len(tmppath$)
      valuetype=1
      lResult = RegQueryValueEx(phkResult, ValueName, 0, valuetype, tmppath$, buflen)
      If lResult<>ERROR_SUCCESS Then
            Messagebox "Error getting value..."
            RegCloseKey phkResult
            Exit Function
      End If
      RegCloseKey phkResult
      GetRegistryValue=Left$(tmppath$, buflen-1)
End Function



USING THIS LIBRARY
=============

Include this into your form or agent..

second, use this to extract key value and execute file
      FilePath = "r:\\SPARE PARTS\\PROTECTION PRODUCTS.pdf"
      adobePath = GetRegistryValue(HKEY_CLASSES_ROOT, "Software\Adobe\Acrobat\Exe", "")
      If adobePath <> "" Then
            tast% = Shell(adobePath + " " + FilePath )
      End If
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I thought it will be a good idea to make a post as it will help in case someone else faces these issues. I trust this gives an idea how each entry in Notes.ini can mean a lot for the Domino Server to be functioning properly. This article discusses t…
  In today’s Arena we can’t imagine our lives without Internet as we are highly used to of it. If we consider our life style just for only 2 min we found that face to face communication is swapped by e-communication.  Every Where from Works place to…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

626 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question