Announcement

Collapse
No announcement yet.

Write PDF ReVisted

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

  • Write PDF ReVisted

    Using Win XP – PBCC 5.01 – CuteWriter

    The below works just fine, well almost

    FUNCTION PBMAIN
    XPRINT ATTACH "CutePDF Writer","MyFile.pdf"
    XPRINT "Hello"
    XPRINT CLOSE
    END FUNCTION

    The Desktop is displayed with a ‘Save As’ window, click ‘Save’ and ‘MyFile.Pdf’ is written.
    I want to skip the Desktop-Save As-Click
    Just write ‘MyFile.Pdf’

    Push/suggest/hint/.. me to solve this problem.
    Thanks for your assistance just like you always have in the past
    Jack

  • #2
    Hi Jack,

    I know of a way that would surely work, but maybe not the most elegant...

    You could write a loop which wait for the save window to appear and automatically click save... I've done something similar with a pop-up window that pooped up too frequently to my liking...

    Let me know if you would like the code.

    Kind regards
    JADT

    Comment


    • #3
      I have no solution right now, so I'm ready to try yours. Thanks for your taking time to look at my problem.

      Jack

      Comment


      • #4
        PDF output

        Jack,

        I have been using a nice freeware program TXT2PDF.EXE that work very well.
        It will make a PDF from a TXT file without any step in between.
        You simply write your text to a file on your hard disk and call that program with a SHELL command.
        Just Google that name to find it
        Old QB45 Programmer

        Comment


        • #5
          Hope it helps...

          Code:
          #COMPILE EXE
          #DIM ALL
          #INCLUDE "Win32API.inc"
          FUNCTION WindowsProc(BYVAL hWnd AS DWORD, BYVAL lParam AS LONG) AS LONG
           LOCAL lLen AS LONG
           LOCAL sWindowName AS STRING
           LOCAL lBuffSize AS LONG
           LOCAL lPos AS LONG
           LOCAL phWnd AS DWORD PTR
            lBuffSize = 255
            sWindowName = STRING$(lBuffSize, $NUL)
            lLen = GetWindowText(hWnd, BYVAL STRPTR(sWindowName), lBuffSize)
            sWindowName = LEFT$(sWindowName, lLen)
            REGEXPR "Application Name Reg Expresssion" IN sWindowName TO lPos
            IF lPos > 0 THEN
              EnumChildWindows hWnd, CODEPTR(ChildWindowsProc), 0
              FUNCTION = %FALSE
            ELSE
              FUNCTION = %TRUE
            END IF
          END FUNCTION
          FUNCTION ChildWindowsProc(BYVAL hWnd AS DWORD, BYVAL lParam AS LONG) AS LONG
           LOCAL lLen AS LONG
           LOCAL sWindowName AS STRING
           LOCAL lBuffSize AS LONG
           LOCAL lPos AS LONG
           LOCAL sName AS STRING
            lBuffSize = 255
            sWindowName = STRING$(lBuffSize, $NUL)
            lLen = GetWindowText(hWnd, BYVAL STRPTR(sWindowName), lBuffSize)
            sWindowName = LEFT$(sWindowName, lLen)
            IF UCASE$(sWindowName) = "OK" THEN
              SendMessage hWnd, %WM_LBUTTONDOWN, 0, 0
              SLEEP 10
              SendMessage hWnd, %WM_LBUTTONUP, 0, 0
              FUNCTION = %FALSE
            ELSE
              FUNCTION = %TRUE
            END IF
          END FUNCTION
          FUNCTION PBMAIN () AS LONG
           LOCAL sCommand AS STRING
            DO
              EnumWindows CODEPTR(WindowsProc), 0
              SLEEP 250
            LOOP
          END FUNCTION
          Kind regards
          JADT

          Comment

          Working...
          X