Solved

Adobe Execute Problem

Posted on 2004-10-04
10
395 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
  • 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
Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Word Pro Conversion utility 13 35
Lotus Domino server 11 67
Lotus notes - Follow up notes mail missing 15 77
Compling Lotusscript <form name>: LotusScript Error - Syntax Error 14 91
  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…
Notes Document Link used by IBM Notes is a link file which aids in the sharing of links to documents in email and webpages. The posts describe the importance and steps to create a Lotus Notes NDL file in brief.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

821 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