Announcement

Collapse
No announcement yet.

Question about closing currently open windows...

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Question about closing currently open windows...

    Hey there,

    I have been trying to figure out the "Window-Close" function, but haven't been able to ***** it in the help files. I just want a button that upon being clicked, prints a PDF document. Is there a way to print the document without opening it at all? Or if it does have to be open, is there a way to cleanly open it and close it immediately? So far, I've got the document printing.


    Thanks in advance!
    "White-colla-AMS-gangsta."

  • #2
    Re: Question about closing currently open windows...


    Try File Open Print :


    <IR_ACTIONS_LIST>
    <Action name="Open">
    <Type>7</Type>
    <Function>0</Function>
    <DTIndentLevel>0</DTIndentLevel>
    <Enabled>1</Enabled>
    <ErrorHandling>
    <UserNotificationMode>2</UserNotificationMode>
    <CustomErrorMessage/>
    <OnErrorAction>0</OnErrorAction>
    <JumpToLabel/>
    </ErrorHandling>
    <FileName>%SrcDir%\Document.txt</FileName>
    <Verb>print</Verb>
    <WorkingDir/>
    <RunMode>0</RunMode>
    </Action>
    </IR_ACTIONS_LIST>

    Comment


    • #3
      Re: Question about closing currently open windows...

      Hey there,

      Thanks for the suggestion. I've already got that one working, but I want it to print and then close so that it seems transparent, or for it to print the file without opening it. At this point the Print File option opens the document, prints it, then leaves it open. There's got to be a fix for that, right?

      Thanks!
      "White-colla-AMS-gangsta."

      Comment


      • #4
        Re: Question about closing currently open windows...

        Hi - you could use a Window.Close to do that. You need to find the integer value that represents the handle of the Acrobat Window, the send it a close message:

        File.Open [print, "pdf file to print"]
        Application.Sleep "7"
        %hWnd%=Window.Find "Acrobat Reader"
        Window.Close ["%hWnd%",SendCloseMessage]


        You'll prob need to put App.Close in there otherwise it's gonna want to close it before it's opened and will generate an error - 7 seconds should be good.
        Also, consider the fact that the user may be using the full version of Acrobat as opposed to the Reader. Therefore, you may want to include Close Actions for that too and set em all with no error messages upon error, so you don't get pop-ups about not finding the Window.

        FYC:
        <font color=green>
        <IR_ACTIONS_LIST>
        <Action name="Sleep">
        <Type>51</Type>
        <Function>0</Function>
        <DTIndentLevel>0</DTIndentLevel>
        <Enabled>1</Enabled>
        <ErrorHandling>
        <UserNotificationMode>2</UserNotificationMode>
        <CustomErrorMessage/>
        <OnErrorAction>0</OnErrorAction>
        <JumpToLabel/>
        </ErrorHandling>
        <Seconds>7</Seconds>
        </Action>
        <Action name="Find">
        <Type>127</Type>
        <Function>0</Function>
        <DTIndentLevel>0</DTIndentLevel>
        <Enabled>1</Enabled>
        <ErrorHandling>
        <UserNotificationMode>2</UserNotificationMode>
        <CustomErrorMessage/>
        <OnErrorAction>0</OnErrorAction>
        <JumpToLabel/>
        </ErrorHandling>
        <FindText>Acrobat reader</FindText>
        <Variable>%hWnd%</Variable>
        </Action>
        <Action name="Close">
        <Type>130</Type>
        <Function>0</Function>
        <DTIndentLevel>0</DTIndentLevel>
        <Enabled>1</Enabled>
        <ErrorHandling>
        <UserNotificationMode>2</UserNotificationMode>
        <CustomErrorMessage/>
        <OnErrorAction>0</OnErrorAction>
        <JumpToLabel/>
        </ErrorHandling>
        <hWnd>%hWnd%</hWnd>
        <IfRunning>0</IfRunning>
        <ProgramDescription>AutoPlay Media Studio 4.0</ProgramDescription>
        </Action>
        </IR_ACTIONS_LIST>
        </font color=green>


        You could try a google search or email Adobe and ask em if there's a command line arg for printing without opening Acrobat.
        -
        = Derek
        ["All glory comes from daring to begin" - fortune cookie]

        Comment

        Working...
        X