Indigo Rose Software

Professional Software Development Tools

 
Results 1 to 7 of 7
  1. #1
    Join Date
    Apr 2006
    Posts
    181

    Thumbs up how can i use this code in ams6

    These functions let you programatically change a users Internet Explorer printing options found under IE's File | page setup menu. Specifically it changes the header, footer, and margins. This is especially useful if you are using the Web.Print action in an AMS project to print a report or other formatted document.

    The CHANGEIESETTINGS accepts 6 arguments to manipulate the Header, Footer and 4 page margins.

    The RESTOREIESETTINGS restores the original user specified settings.


    Place this code into your Global Functions section


    Code:
    --***************************
    --  CHANGE FOOTER, HEADER, & MARGINS
    --***************************
    --Changes the Header, footer, & Margin info used when printing from IE
    function CHANGEIESETTINGS(Header, Footer, MarginTop, MarginBottom, MarginLeft, MarginRight)
    
    --Get Current Registry Key Values if they exist
    IEHeader = Registry.GetValue(HKEY_CURRENT_USER, "Software\\Microsoft\\Internet Explorer\\PageSetup", "header", true);
    IEFooter = Registry.GetValue(HKEY_CURRENT_USER, "Software\\Microsoft\\Internet Explorer\\PageSetup", "footer", true);
    IEMarginTop = Registry.GetValue(HKEY_CURRENT_USER, "Software\\Microsoft\\Internet Explorer\\PageSetup", "margin_top", true);
    IEMarginBottom = Registry.GetValue(HKEY_CURRENT_USER, "Software\\Microsoft\\Internet Explorer\\PageSetup", "margin_bottom", true);
    IEMarginLeft = Registry.GetValue(HKEY_CURRENT_USER, "Software\\Microsoft\\Internet Explorer\\PageSetup", "margin_left", true);
    IEMarginRight = Registry.GetValue(HKEY_CURRENT_USER, "Software\\Microsoft\\Internet Explorer\\PageSetup", "margin_right", true);
    
    --Set Values based on arguments of function
    Registry.SetValue(HKEY_CURRENT_USER, "Software\\Microsoft\\Internet Explorer\\PageSetup", "header", Header, REG_SZ);
    Registry.SetValue(HKEY_CURRENT_USER, "Software\\Microsoft\\Internet Explorer\\PageSetup", "footer", Footer, REG_SZ);
    Registry.SetValue(HKEY_CURRENT_USER, "Software\\Microsoft\\Internet Explorer\\PageSetup", "margin_top", MarginTop, REG_SZ);
    Registry.SetValue(HKEY_CURRENT_USER, "Software\\Microsoft\\Internet Explorer\\PageSetup", "margin_bottom", MarginBottom, REG_SZ);
    Registry.SetValue(HKEY_CURRENT_USER, "Software\\Microsoft\\Internet Explorer\\PageSetup", "margin_left", MarginLeft, REG_SZ);
    Registry.SetValue(HKEY_CURRENT_USER, "Software\\Microsoft\\Internet Explorer\\PageSetup", "margin_right", MarginRight, REG_SZ);
    end
    
    
    --***************************
    --Restore Header, Footer, & Margins
    --***************************
    function RESTOREIESETTINGS()
    
    --Restore User Header, footer, Margin values
    Registry.SetValue(HKEY_CURRENT_USER, "Software\\Microsoft\\Internet Explorer\\PageSetup", "header", IEHeader, REG_SZ);
    Registry.SetValue(HKEY_CURRENT_USER, "Software\\Microsoft\\Internet Explorer\\PageSetup", "footer", IEFooter, REG_SZ);
    Registry.SetValue(HKEY_CURRENT_USER, "Software\\Microsoft\\Internet Explorer\\PageSetup", "margin_top", IEMarginTop, REG_SZ);
    Registry.SetValue(HKEY_CURRENT_USER, "Software\\Microsoft\\Internet Explorer\\PageSetup", "margin_bottom", IEMarginBottom, REG_SZ);
    Registry.SetValue(HKEY_CURRENT_USER, "Software\\Microsoft\\Internet Explorer\\PageSetup", "margin_left", IEMarginLeft, REG_SZ);
    Registry.SetValue(HKEY_CURRENT_USER, "Software\\Microsoft\\Internet Explorer\\PageSetup", "margin_right", IEMarginRight, REG_SZ);
    endHere's an example funtion call to change the headers and set margins to .5 inches
    Code:
    -- Change header & footer to "My Custom Header/footer"  Change margins to .5 inch
    CHANGEIESETTINGS("My Custom Header", "My Custom Footer", "0.50", "0.50", "0.50", "0.50")Here's the function call to restore the original header, footer, & margins
    Code:
    --Restore User values for Header, Footer, & Margins
    RESTOREIESETTINGS()

  2. #2
    Join Date
    Jul 2002
    Location
    USA
    Posts
    3,959
    Here's a function KPSmith put together some time ago to take care of this for you.

    http://www.indigorose.com/forums/showthread.php?t=7587

  3. #3
    Join Date
    Apr 2006
    Posts
    181

    Huh?

    can u please help me WORM ???

    i dont know how to use the code in a project...

  4. #4
    Join Date
    Jul 2002
    Location
    USA
    Posts
    3,959
    KP gave examples on how to use the functions. They are at the bottom of the post. Give it a try.

  5. #5
    Join Date
    Apr 2006
    Posts
    181
    i dont know where to put the codes WORM

    can u please give me an exmple ???

  6. #6
    Join Date
    Jul 2002
    Location
    USA
    Posts
    3,959
    Put the two functions in your global functions area. Then call the function to set your custum header just before you print, after you print, restore the originals.

  7. #7
    Join Date
    Apr 2006
    Posts
    181
    thanks WORM i got it

Similar Threads

  1. Article: Using Authenticode Code Signing Certificates
    By Ted Sullivan in forum Setup Factory 8.0 Examples
    Replies: 4
    Last Post: 10-31-2007, 09:03 AM
  2. can ams6 can work whit ascii code?
    By lnd in forum AutoPlay Media Studio 6.0
    Replies: 0
    Last Post: 09-24-2006, 01:20 AM
  3. can ams6 can arrange - bring to front whit a code
    By lnd in forum AutoPlay Media Studio 6.0
    Replies: 1
    Last Post: 05-30-2006, 11:03 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts