Jump to content

Search the Community

Showing results for tags 'margins'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • General
    • Announcements and Site News
    • Administration
  • AutoIt v3
    • AutoIt Help and Support
    • AutoIt Technical Discussion
    • AutoIt Example Scripts
  • Scripting and Development
    • Developer General Discussion
    • Language Specific Discussion
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • AutoIt Team
    • Beta
    • MVP
  • AutoIt
    • Automation
    • Databases and web connections
    • Data compression
    • Encryption and hash
    • Games
    • GUI Additions
    • Hardware
    • Information gathering
    • Internet protocol suite
    • Maths
    • Media
    • PDF
    • Security
    • Social Media and other Website API
    • Windows
  • Scripting and Development
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Member Title


Location


WWW


Interests

Found 1 result

  1. Because there is no GPO/GPP to set the printing margins to the minimum size in Internet Explorer, I was searching a way to achieve it with a script. Well, not easy... An easy way to set the margins to there minimum size is to set margin values to 0 from the Page setup window in Internet Explorer. When you re-open the Page setup window, the margins are set to there minimum sizes. It's because the minimum margins are based on the default printer's capabilities. When we set the margins values in the Page setup window, Internet Explorer checks if each value can me supported by the default printer, else it uses the minimum size from the printer capabilities. We could think that we have just to set the registry margins values to 0 but no, the Page setup window keeps 0 for each margin, so it doesn't work. Here is the code I made to define the margins, without using the Page setup from Internet Explorer : #Include <WinAPI.au3> #include <WinAPISys.au3> Global Const $PHYSICALOFFSETX = 112 Global Const $PHYSICALOFFSETY = 113 Global Const $LOGPIXELSX = 88 Global Const $LOGPIXELSY = 90 Global Const $PHYSICALWIDTH = 110 Global Const $PHYSICALHEIGHT = 111 Global Const $HORZRES = 8 Global Const $VERTRES = 10 Global $aRes = DllCall("GDI32.dll", "hwnd", "CreateDC", "str", "winspool", "str", _WinAPI_GetDefaultPrinter(), "long", 0, "long", 0) If @error Then Exit Global $hPrintDc = $aRes[0] Global $iLOGPIXELSX = _WinAPI_GetDeviceCaps($hPrintDc, $LOGPIXELSX) Global $iLOGPIXELSY = _WinAPI_GetDeviceCaps($hPrintDc, $LOGPIXELSY) Global $iPHYSICALWIDTH = _WinAPI_GetDeviceCaps($hPrintDc, $PHYSICALWIDTH) Global $iPHYSICALHEIGHT = _WinAPI_GetDeviceCaps($hPrintDc, $PHYSICALHEIGHT) Global $iHORZRES = _WinAPI_GetDeviceCaps($hPrintDc, $HORZRES) Global $iVERTRES = _WinAPI_GetDeviceCaps($hPrintDc, $VERTRES) Global $iPHYSICALOFFSETX = _WinAPI_GetDeviceCaps($hPrintDc, $PHYSICALOFFSETX) Global $iPHYSICALOFFSETY = _WinAPI_GetDeviceCaps($hPrintDc, $PHYSICALOFFSETY) Global $iMarginsLeft = $iPHYSICALOFFSETX / $iLOGPIXELSX Global $iMarginsTop = $iPHYSICALOFFSETY / $iLOGPIXELSY Global $iMarginsBottom = (($iPHYSICALHEIGHT - $iVERTRES) / $iLOGPIXELSY) - ($iPHYSICALOFFSETY / $iLOGPIXELSY) Global $iMarginsRight = (($iPHYSICALWIDTH - $iHORZRES) / $iLOGPIXELSX) - ($iPHYSICALOFFSETX / $iLOGPIXELSX) RegWrite("HKCU\Software\Microsoft\Internet Explorer\PageSetup", "margin_bottom", "REG_SZ", $iMarginsBottom) RegWrite("HKCU\Software\Microsoft\Internet Explorer\PageSetup", "margin_left", "REG_SZ", $iMarginsLeft) RegWrite("HKCU\Software\Microsoft\Internet Explorer\PageSetup", "margin_right", "REG_SZ", $iMarginsRight) RegWrite("HKCU\Software\Microsoft\Internet Explorer\PageSetup", "margin_top", "REG_SZ", $iMarginsTop) The code was adapted from here : http://www.swissdelphicenter.ch/en/printcode.php?id=1039 I hope it will be useful for someone
×
×
  • Create New...