Jump to content

so.... no way for print preview?


Recommended Posts

I have read entire forum about print preview in IE.

there is no way to open print preview??!! I want to add a button to start print preview

Func debl()
Global $Formdebloc
    if $Formdebloc Then
        GUIDelete($Formdebloc)
    EndIf
Local $IE, $GUIActiveX
$IE = ObjCreate("Shell.Explorer.2")
$Formdebloc = GUICreate("Deblocare pos", 364, 403, 208, 136)
$GUIActiveX = GUICtrlCreateObj( $IE, 24, 24, 321, 273)
GUICtrlSetData(-1, "Edit1")

GUICtrlCreateButton("Inchide", 88, 336, 177, 41)
GUICtrlSetOnEvent(-1, "outdebloc")
$IE.navigate("http://localhost/pos/debloc.php")
Do
   Sleep(100)
Until NOT $IE.Busy
$IE.refresh
$IE=0
;~ _IEAction($IE, "print")
GUISetState(@SW_SHOW)
sleep(1000)
ControlSend($IE, "", "", "!f"); don't work
ControlSend($IE, "", "", "v"); don't work
;~ $IE.execWB('7',2) ;don't work
_IEAction($IE, "print")don't work
EndFunc

I like IT: php, mysql, codeingiter, css, jquery and AUTOIT

Link to comment
Share on other sites

Don't target the document or application objects with your ControlSend(), that has to target the IE window:

$hIE = _IEPropertyGet($IE, "hwnd")
ControlSend($hIE, "", "", "!f")
ControlSend($hIE, "", "", "v")

:mellow:

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

This works fine:

#include <IE.au3>

$oIE = _IECreate("http://www.autoitscript.com")
$hIE = _IEPropertyGet($oIE, "hwnd")
ControlSend($hIE, "", "", "!f") ; Alt-f
Sleep(100)
ControlSend($hIE, "", "", "v") ; v (Print Preview)

An ActiveX instance of IE doesn't have all the toolbar functions available, including print preview.

:mellow:

Edited by PsaltyDS
Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

Ah, found the execWB for it:

#include <GuiConstantsEx.au3>
#include <IE.au3>

$oIE = _IECreateEmbedded()
$hGUI = GUICreate("Test", 600, 600)
$idObj = GUICtrlCreateObj($oIE, 10, 10, 580, 530)
$idButton = GUICtrlCreateButton("PrintPreview", 250, 550, 100, 30)
_IENavigate($oIE, "http://www.autoitscript.com")
GUISetState()

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
        Case $idButton
            $oIE.execWB(7, 2)
    EndSwitch
WEnd

For reference:

execWB method

OLECMDID values

OLECMDEXECOPT values

:mellow:

Edited by PsaltyDS
Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
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...