Jump to content
Sign in to follow this  
ShadowElf

so.... no way for print preview?

Recommended Posts

ShadowElf

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

Share this post


Link to post
Share on other sites
PsaltyDS

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

Share this post


Link to post
Share on other sites
ShadowElf

IE.au3 V2.4-0 Error from function _IEPropertyGet, $_IEStatus_InvalidDataType


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

Share this post


Link to post
Share on other sites
PsaltyDS

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

Share this post


Link to post
Share on other sites
PsaltyDS

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

Share this post


Link to post
Share on other sites
ShadowElf

Thx PsaltyDS


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

Share this post


Link to post
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
Sign in to follow this  

×