Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.
Keywords: adobe acrobat exchange
The program illustrates a number of ideas and some good programming practice for those new to WinBatch:
I like to use INI files to hold program options for three reasons:
I use a switch/case construction to direct the processing after a button has been clicked and loop round to the start to re-display the dialog after the appropriate actions have been taken after a button click. Where the target application requires text input, this is requested by the WinBatch script as an AskLine() statement and then passed to the target application since it is difficult to give the target window the focus while the script is running. There is no case condition for the Exit button, since WinBatch will always terminate when a button with a value of 0 is pressed (unless, of course, you have a :cancel label in your script which would be useful if you had some tidying up to do before actually exiting the script).
A Mk2 version of this will allow the target application, window names, button labels and keystrokes to be defined externally in the INI file so it becomes more general-purpose. Also, the Options... dialog will be greatly extended to allow the INI file to populated easily.
I hope this script proves useful to somebody.
David R Stout
;-------------------------------------------------------------------------------------- ; Acrobat Macros by David R Stout, August 1998 ;-------------------------------------------------------------------------------------- revision = "1.1" CurrentDir = DirHome() IniFile = "%CurrentDir%AcroKeys.ini" AcroDialogX = IniReadPvt("Options","Xpos","1",IniFile) AcroDialogY = IniReadPvt("Options","Ypos","1",IniFile) FontStyle = IniReadPvt("Options","FontStyle","1",IniFile) TargetWin = "Acrobat Exchange" LinkWin = "Create Link" if WinExist(TargetWin) == @False then Message("AcroKeys Error","Cannot find Acrobat Exchange window. Program terminating now") Exit end if IntControl(35,0,0,0,0) gosub ScaleDialogBox :start Button1 = Dialog("AcroDialog") switch Button1 case 1 ; Open SendKeysTo(TargetWin,'^o') break case 2 ; Magnification Set SendKeysTo(TargetWin,'!da!ag!mffff~~') break case 3 ; Text Outline SendMenusTo(TargetWin,"Tools TouchUp Text") break case 4 ; Text Colour SendKeysChild(TargetWin,'','!ex') break case 5 ; Hyperlink Outline SendKeysTo(TargetWin,'!tl') break case 6 ; Hyperlink Assign if WinExist(LinkWin) then URL = AskLine('Hyperlink Assign','Enter name of PDF file to link to','.pdf') SendKeysTo(LinkWin,'!yi!tw!u') SendKeysTo(LinkWin,URL) SendKeysTo(LinkWin,'~~') else Message('Error','Create HyperLink Outline first !') end if break case 7 ; Save and Close SendKeysTo(TargetWin,'^s^w') break case 8 ; Options FontStyle = FontStyle + 1 Button2 = Dialog("Options") FontStyle = FontStyle - 1 IniWritePvt("Options","FontStyle", FontStyle, IniFile) gosub ScaleDialogBox break end switch goto start exit ;-------------------------------------------------------------------------------------- :ScaleDialogBox if FontStyle == 0 then AcroDialogWidth = 73 AcroDialogHeight = 131 ButtonSize = 66 OptionsWidth = 103 Offset = 16 else AcroDialogWidth = 53 AcroDialogHeight = 132 ButtonSize = 46 OptionsWidth = 83 Offset = 7 end if gosub AcroDialog gosub OptionsDialog IntControl(52,FontStyle,0,0,0) return ;-------------------------------------------------------------------------------------- :AcroDialog AcroDialogFormat=`WWWDLGED,5.0` AcroDialogCaption=`Acrobat Keys %revision%` AcroDialogNumControls=9 AcroDialog01=`2,2,%ButtonSize%,DEFAULT,PUSHBUTTON,DEFAULT,"Open PDF &File",1` AcroDialog02=`2,16,%ButtonSize%,DEFAULT,PUSHBUTTON,DEFAULT,"&Magnification Set",2` AcroDialog03=`2,30,%ButtonSize%,DEFAULT,PUSHBUTTON,DEFAULT,"&Text Outline",3` AcroDialog04=`2,44,%ButtonSize%,DEFAULT,PUSHBUTTON,DEFAULT,"Text &Colour",4` AcroDialog05=`2,58,%ButtonSize%,DEFAULT,PUSHBUTTON,DEFAULT,"&Hyperlink Outline",5` AcroDialog06=`2,72,%ButtonSize%,DEFAULT,PUSHBUTTON,DEFAULT,"Hyperlink &Assign",6` AcroDialog07=`2,86,%ButtonSize%,DEFAULT,PUSHBUTTON,DEFAULT,"&Save and Close",7` AcroDialog08=`2,100,%ButtonSize%,DEFAULT,PUSHBUTTON,DEFAULT,"&Options...",8` AcroDialog09=`2,114,%ButtonSize%,DEFAULT,PUSHBUTTON,DEFAULT,"E&xit",0` return ;-------------------------------------------------------------------------------------- :OptionsDialog OptionsFormat=`WWWDLGED,5.0` OptionsCaption=`Options` OptionsX=-1 OptionsY=-1 OptionsHeight=64 OptionsNumControls=4 Options01=`%Offset%,44,64,DEFAULT,PUSHBUTTON,DEFAULT,"&OK",1` Options02=`4,4,100,DEFAULT,STATICTEXT,DEFAULT,"Font Style"` Options03=`8,16,100,DEFAULT,RADIOBUTTON,FontStyle,"&Proportional Font (small)",2` Options04=`8,28,100,DEFAULT,RADIOBUTTON,FontStyle,"&System Font (large)",1` return ;--------------------------------------------------------------------------------------
Article ID: W13767
Filename: Automation of Adobe Acrobat Exchange.txt
File Created: 2001:01:08:12:16:36
Last Updated: 2001:01:08:12:16:36