Jump to content

Adobe reader zoom in zoom out


myspacee
 Share

Recommended Posts

Hello to all,

for a pdf reader project i need to 'map' to a button

adobe reader shortcut for zoom in and out.

In accord with Adobe help site:

Zoom in -> Ctrl+equal sign

Zoom out -> Ctrl+hyphen

Can't replicate this with a button, try :

Send("{CTRLDOWN}")
Send("{NUMPAD1}")
Send("{CTRLup}")

Without luck, anyone can help please ?

m.

Link to comment
Share on other sites

Just had a quick play around with Send() and Adobe Reader...

Sleep(2000)
Send("^{NUMPAD0}");Fit whole page
Sleep(1000)
Send("^{NUMPAD1}");Actual size
Sleep(1000)
Send("^{NUMPAD2}");Fit width of page
Sleep(1000)
Send("^{NUMPAD3}");Fit visible
Sleep(1000)
Send("^{NUMPAD4}");Reflow (whatever that means!)
Sleep(1000)
Send("^{+}");Rotate clockwise 90degrees
Sleep(1000)
Send("^{+}");Rotate clockwise 90degrees
Sleep(1000)
Send("^{+}");Rotate clockwise 90degrees
Sleep(1000)
Send("^{+}");Rotate clockwise 90degrees
Sleep(1000)
Send("^+{-}");Rotate anti-clockwise 90degrees
Sleep(1000)
Send("^+{-}");Rotate anti-clockwise 90degrees
Sleep(1000)
Send("^+{-}");Rotate anti-clockwise 90degrees
Sleep(1000)
Send("^+{-}");Rotate anti-clockwise 90degrees
Sleep(1000)
Send("^{-}");Zoom out
Sleep(1000)
Send("^{-}");Zoom out further
Sleep(1000)
Send("^{=}");Zoom in
Sleep(1000)
Send("^{=}");Zoom in further
Instant Lockerz Invite - www.instantlockerzinvite.co.uk
Link to comment
Share on other sites

tahnk you all for reply,

but can't apply send function to my little project.

I list all pdf documents in folder, and show to user selected one in an IE obj:

#include <GUIConstants.au3>
#include <Misc.au3>

#include <GuiButton.au3>
#include <WindowsConstants.au3>

#include <String.au3>
#include <GuiListView.au3>
#include <array.au3>
#Include <Constants.au3>
#Include <GuiButton.au3>

#include <GUIComboBox.au3>
#include <GuiConstantsEx.au3>
#Include <File.au3>

#include <WinAPI.au3>
#include <GDIPlus.au3>
#include <String.au3>

;//////////////////////////////////
;//     set variabili
;//////////////////////////////////
dim $my_selection = "", $my_old_selection = $my_selection, $sText= "", $my_selection_index


;//////////////////////////////////
;//     GUI
;//////////////////////////////////
$hGUI = GUICreate("SDII", 952, 700, 0, 0)

$Group1 = GUICtrlCreateGroup("Viewer", 264, 8, 681, 689)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$zoom_in = GUICtrlCreateButton("+", 8, 552, 249, 65, 0)
GUICtrlSetFont(-1, 32, 400, 0, "MS Sans Serif")
$zoom_out = GUICtrlCreateButton("-", 8, 622, 249, 65, 0)
GUICtrlSetFont(-1, 32, 400, 0, "MS Sans Serif")
$Combo1 = GUICtrlCreateCombo("Combo1", 8, 401, 249, 21)
$Label1 = GUICtrlCreateLabel("Destinazione", 9, 364, 143, 33)
GUICtrlSetFont(-1, 18, 400, 0, "MS Sans Serif")
$INVIATI = GUICtrlCreateButton("Vedi già inviati", 8, 285, 249, 65, 0)
GUICtrlSetFont(-1, 16, 400, 0, "MS Sans Serif")

$Obj = ObjCreate("Shell.Explorer.1")
$browser = GUICtrlCreateObj($Obj, 275, 25, 665, 665)
GUICtrlSetResizing ( -1, $GUI_DOCKRIGHT )

$hCombo = GUICtrlCreateCombo("", 8, 20, 249, 273, BitOR($CBS_SIMPLE,$CBS_AUTOHSCROLL,$CBS_DISABLENOSCROLL,$WS_VSCROLL))

GUISetState(@SW_SHOW)


;//////////////////////////////////
;//     combo stuff
;//////////////////////////////////
;popolate combo
_GUICtrlComboBox_BeginUpdate($hCombo)
_GUICtrlComboBox_AddDir($hCombo, @ScriptDir & "\*.pdf")
_GUICtrlComboBox_EndUpdate($hCombo)

;select first element
_GUICtrlComboBox_SetCurSel($hCombo, $my_selection_index)
$my_selection = _GUICtrlComboBox_GetCurSel($hCombo)
_GUICtrlComboBox_GetLBText($hCombo, $my_selection, $sText)
$Obj.Navigate(@ScriptDir & '\' & $sText)

        
        
;//////////////////////////////////
;//     MAIN
;//////////////////////////////////
While 1
    $Msg = GUIGetMsg()
    Select

    Case $msg = $GUI_EVENT_CLOSE
        $question = MsgBox(4, "SDII", "Really quit ?")
        if $question = 6 then Exit ;if yes -> close program

    Case $msg = $zoom_in
        Send("^{=}");Zoom in

    Case $msg = $zoom_out
        Send("^{-}");Zoom out

    EndSelect

    
    ;obtain actual selection
    $my_selection = _GUICtrlComboBox_GetCurSel($hCombo)
    _GUICtrlComboBox_GetLBText($hCombo, $my_selection, $sText)


    ;if last selction is <> than old, user select another entry
    if $my_old_selection <> $my_selection Then

        $Obj.Navigate(@ScriptDir & '\' & $sText)
        GUISetState(@SW_SHOW)
        
        ;reset old & new position and wait for next selection
        $my_old_selection = $my_selection 
    EndIf
        
    sleep(10)

WEnd

I want to send adobe keyboard shortcut to $Obj = ObjCreate("Shell.Explorer.1")

becuse send work but only if user manually move focus on this object.

Any idea to send keyboard to an obj ?

m.

Edited by myspacee
Link to comment
Share on other sites

Hey, i tried getting your code to run, and it did, but i didnt know what to do once i had got a .pdf, either way, if you want to send it to a specific window then use;

ControlSend()

I can't really test it for you because, its not working properly for me, but in the helpfile search for "ControlSend" and also, "Controls" to see how to select a specific window.

Instant Lockerz Invite - www.instantlockerzinvite.co.uk
Link to comment
Share on other sites

thank you for try.

When run script, if you have some .pdf files in @ScriptDir,

you have list on the left. Click on .pdf load file on the right.

Now you see on botton-left symbol + and -

+ = zoom_in

- = zoom_out

When you press GUI buttons (+ and -) user can zoom in/out on pdf loaded. ($browser bj)

Post modified source with controlsend() attemp :

#include <GUIConstants.au3>
#include <Misc.au3>

#include <GuiButton.au3>
#include <WindowsConstants.au3>

#include <String.au3>
#include <GuiListView.au3>
#include <array.au3>
#Include <Constants.au3>
#Include <GuiButton.au3>

#include <GUIComboBox.au3>
#include <GuiConstantsEx.au3>
#Include <File.au3>

#include <WinAPI.au3>
#include <GDIPlus.au3>
#include <String.au3>
#include <ScreenCapture.au3>

#include <GUIConstantsEx.au3>
#include <ButtonConstants.au3>

;~ 13-02-10_19-56-18.DOMENICA 140210.pdf


;//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////  
;//     set variabili
;////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 

dim $my_selection = "", $my_old_selection = $my_selection, $sText= "", $my_selection_index

;//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////  
;//     Press Ecs key to exit
;//     Press ALT key to Makes JPG of the selection 
;//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////  
;//     set variabili
;//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////  
Const $DIB_RGB_COLORS = 0
Global $GUI, $CopyWin, $PixelArray, $CopyWin, $e, $d, $PixelsReady = 0, $Start = 0
Global $my_Width, $my_Height, $my_base, $my_altezza, $Ext = "png"
dim $apos[4]
Local $aMPos, $GuisInfo, $f_snapshot = 0
dim $my_ratio = 1, $f_resize = 0



;////////////////////////////////////////////////////////////////////
;//   READ INI per letture variabili utente
;////////////////////////////////////////////////////////////////////
If FileExists(@ScriptDir & "\visore.ini") Then
    
    $file = FileOpen(@ScriptDir & "\visore.ini", 0)

    ; Check if file opened for reading OK
    If $file = -1 Then
        MsgBox(0, "Error", "Unable to open file.")
        Exit
    EndIf

    $my_PDF_SOURCE = stringsplit(FileReadLine($file, 1), "=")
    $my_PDF_DONE = stringsplit(FileReadLine($file, 2), "=")
    $my_PDF_TEMP = stringsplit(FileReadLine($file, 3), "=")
    $my_ZOOM_DEFAULT = stringsplit(FileReadLine($file, 4), "=")
    $my_Delay = stringsplit(FileReadLine($file, 5), "=")
    $my_New_Day = stringsplit(FileReadLine($file, 6), "=")

    FileClose($file)

    $PDF_SOURCE = StringStripWS($my_PDF_SOURCE[2], 3)
    $PDF_DONE = StringStripWS($my_PDF_DONE[2], 3)
    $PDF_TEMP = StringStripWS($my_PDF_TEMP[2], 3)
    $ZOOM_DEFAULT = StringStripWS($my_ZOOM_DEFAULT[2], 3)
    $Delay = StringStripWS($my_Delay[2], 3)
    $New_Day = StringStripWS($my_New_Day[2], 3)



    If StringRight($PDF_SOURCE, 1) <> "\" Then $PDF_SOURCE  &= "\"
    If StringRight($PDF_DONE, 1) <> "\" Then $PDF_DONE  &= "\"
    If StringRight($PDF_TEMP, 1) <> "\" Then $PDF_TEMP  &= "\"


EndIf




;~ $hGUI_child = GUICreate("Send", 953, 200, 100, 267)
;~  GUISetState(@SW_HIDE)
;//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////  
;//     GUI
;////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 
#Region ### START Koda GUI section ### Form=C:\Program Files\Koda 1.7.01\Forms\QuickFTP\FNTConvert.kxf
$hGUI = GUICreate("Dispatcher", 953, 701, 100, 100)


;~ $Group1 = GUICtrlCreateGroup("Viewer", 264, 8, 681, 689)
;~ GUICtrlCreateGroup("", -99, -99, 1, 1)


$zoom_in = GUICtrlCreateButton("+", 8, 500, 49, 49, 0)
GUICtrlSetFont(-1, 32, 400, 0, "MS Sans Serif")

$file_opener = GUICtrlCreateButton("APRI", 108, 500, 49, 49, $BS_ICON)
GUICtrlSetImage(-1, "shell32.dll", 22)

$zoom_out = GUICtrlCreateButton("-", 208, 500, 49, 49, 0)
GUICtrlSetFont(-1, 32, 400, 0, "MS Sans Serif")



$INVIA = GUICtrlCreateButton("INVIA", 8, 552, 249, 65, 0)
GUICtrlSetFont(-1, 16, 400, 0, "MS Sans Serif")
$ESCI = GUICtrlCreateButton("ESCI", 8, 622, 249, 65, 0)
GUICtrlSetFont(-1, 16, 400, 0, "MS Sans Serif")
$Combo1 = GUICtrlCreateCombo("Combo1", 8, 401, 249, 21)
$Label1 = GUICtrlCreateLabel("Destinazione", 9, 364, 143, 33)
GUICtrlSetFont(-1, 18, 400, 0, "MS Sans Serif")
$INVIATI = GUICtrlCreateButton("Vedi già inviati", 8, 285, 249, 65, 0)
GUICtrlSetFont(-1, 16, 400, 0, "MS Sans Serif")


$Obj = ObjCreate("Shell.Explorer.1")
$browser = GUICtrlCreateObj($Obj, 275, 25, 665, 665)
GUICtrlSetResizing ( -1, $GUI_DOCKRIGHT )


$hCombo = GUICtrlCreateCombo("", 8, 20, 249, 273, BitOR($CBS_SIMPLE,$CBS_AUTOHSCROLL,$CBS_DISABLENOSCROLL,$WS_VSCROLL))

GUISetState(@SW_SHOW, $hGUI)



            #Region ### START Koda GUI section ### Form=
            $hGUI_child = GUICreate("Inserisci ICU", 593, 205, 228, 337)
            $Label1 = GUICtrlCreateLabel("Origine                                       :", 16,  8, 160, 17)
            $Label2 = GUICtrlCreateLabel("Tipologia                                     :", 16, 33, 161, 17)
            $Label3 = GUICtrlCreateLabel("Destinazione                                  :", 16, 57, 161, 17)
            $Label4 = GUICtrlCreateLabel("Avviso                                        :", 16, 81, 159, 17)
            $Label5 = GUICtrlCreateLabel("Inserire il nome di impaginazione di 5 caratteri [W finale automatica]", 16, 105, 319, 17)
            $ICU = GUICtrlCreateInput("ICU", 348, 101, 233, 21)
            $Btn_send = GUICtrlCreateButton("Continua", 16, 148, 233, 33, 0)
            GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
            $Btn_cancel = GUICtrlCreateButton("Annulla ...", 348, 148, 233, 33, 0)
            GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")

            GUISetState(@SW_HIDE, $hGUI_child)


#EndRegion ### END Koda GUI section ###



    
;popolate combo
_GUICtrlComboBox_BeginUpdate($hCombo)
_GUICtrlComboBox_AddDir($hCombo, @ScriptDir & "\*.pdf")
_GUICtrlComboBox_EndUpdate($hCombo)


;select first element
_GUICtrlComboBox_SetCurSel($hCombo, $my_selection_index)
$my_selection = _GUICtrlComboBox_GetCurSel($hCombo)
_GUICtrlComboBox_GetLBText($hCombo, $my_selection, $sText)
$Obj.Navigate(@ScriptDir & '\' & $sText)

        
        

While 1
    $Msg = GUIGetMsg()
    Select
            
        Case $msg = $GUI_EVENT_CLOSE
            $question = MsgBox(4, "Dispatcher", "Really quit ?")
            if $question = 6 then Exit ;if yes -> close program

        Case $Msg = $zoom_in

            Send("{CTRLDOWN}")
            Send("{NUMPAD1}")
            Send("{CTRLup}")
        Case $Msg = $file_opener
    

        Case $Msg = $zoom_out
            ;ControlSend ( "title", "text", controlID, "string" [, flag] )
            ControlSend($hGUI, "Dispatcher", $browser, "^{NUMPAD1}", 1)
            
            
            
        Case $Msg = $INVIA
            #Region ### START Koda GUI section ### Form=
            $hGUI_child = GUICreate("Inserisci ICU", 593, 205, 228, 337)
            $Label1 = GUICtrlCreateLabel("Origine                                       :", 16,  8, 160, 17)
            $Label2 = GUICtrlCreateLabel("Tipologia                                     :", 16, 33, 161, 17)
            $Label3 = GUICtrlCreateLabel("Destinazione                                  :", 16, 57, 161, 17)
            $Label4 = GUICtrlCreateLabel("Avviso                                        :", 16, 81, 159, 17)
            $Label5 = GUICtrlCreateLabel("Inserire il nome di impaginazione di 5 caratteri [W finale automatica]", 16, 105, 319, 17)
            $ICU = GUICtrlCreateInput("ICU", 348, 101, 233, 21)
            $Btn_send = GUICtrlCreateButton("Continua", 16, 148, 233, 33, 0)
            GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
            $Btn_cancel = GUICtrlCreateButton("Annulla ...", 348, 148, 233, 33, 0)
            GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")

;~          GUISetState(@SW_HIDE, $hGUI_child)
            GUISetState(@SW_show, $hGUI_child)


        Case $Msg = $Btn_cancel

            GUIDelete($hGUI_child)







    EndSelect
;~     EndSwitch
    
    
    $my_selection = _GUICtrlComboBox_GetCurSel($hCombo)
    _GUICtrlComboBox_GetLBText($hCombo, $my_selection, $sText)


    if $my_old_selection <> $my_selection Then

;~      GUISetState(@SW_HIDE)
        $Obj.Navigate(@ScriptDir & '\' & $sText)
        GUISetState(@SW_SHOW, $hGUI)

        $my_old_selection = $my_selection 
    EndIf
        
    sleep(10)
    
WEnd

Thank you for try,

m.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...