Exporting to PDF

4 posts / 0 new
Last post
carloscr
Offline
Joined: 10/02/2017 - 07:48
Exporting to PDF

Hi,
I try to automatize with IDEA script the extraction to PDF. I put into script the following source:
                db.FilenameForPublishing = "XX.pdf"
db.PublishToPDF
But when I run the script, IDEA show me a dialog to confirm the customize of data "Not all columns will fit the report, follow? Accept or deny"
My doubt is it possible to automatize throw script the answer of this dialog.
Thanks so much,
Charles.

Brian Element's picture
Brian Element
Offline
Joined: 07/11/2012 - 19:57

Hello Charles and welcome to the site.

It looks like you are right.  I tried adding the line IgnoreWarning(True) but that didn't change anything.  Doesn't look like there is a way around that pop-up.

Brian

Luciana Milva S...
Offline
Joined: 08/24/2020 - 22:07

Hello, I'm having the same problem. Did anyone could find a solution to the dialog box?
Thanks
Luciana 

scotchy33
Offline
Joined: 09/05/2012 - 15:51

Hi Everyone,
You could try running a macro in Word or Excel to find certain windows and perform an action when they appear.  The attached Word macro is a never ending loop and is set to run on open.
Scott
Option Explicit
 
Private Declare PtrSafe Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
 
'Sends the specified message to a window or windows. The SendMessage function calls the window procedure
'for the specified window and does not return until the window procedure has processed the message.
Public Declare PtrSafe Function SendMessage Lib "user32" Alias "SendMessageA" _
(ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
 
'Retrieves a handle to the top-level window whose class name and window name match the specified strings.
'This function does not search child windows. This function does not perform a case-sensitive search.
Public Declare PtrSafe Function FindWindow Lib "user32" Alias "FindWindowA" _
(ByVal lpClassName As String, ByVal lpWindowName As String) As Long
 
'Retrieves a handle to a window whose class name and window name match the specified strings.
'The function searches child windows, beginning with the one following the specified child window.
'This function does not perform a case-sensitive search.
Public Declare PtrSafe Function FindWindowEx Lib "user32" Alias "FindWindowExA" _
(ByVal hwnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, _
ByVal lpsz2 As String) As Long
 
Public Declare PtrSafe Function SetFocusAPI Lib "user32" Alias "SetFocus" _
(ByVal hWnd3 As Long) As Long
 
Public Const BM_CLICK = &HF5&
 
 
Public Sub popupclose()
    
    Dim i As Long, hwnd As Long, hwnd1 As Long, childHWND As Long, childHWND1 As Long, childHWND2 As Long
 
    
tryagain:
    
 
    hwnd = 0
    childHWND = 0
    
 
            hwnd = FindWindow("#32770", "CaseWare IDEA")
            hwnd = hwnd + FindWindow("#32770", "CaseWare IDEA ")
            
            If hwnd <> 0 Then
            
                childHWND = FindWindowEx(hwnd, ByVal 0&, "Button", "&Yes")
                
                If childHWND <> 0 Then
                
                childHWND1 = FindWindowEx(hwnd, ByVal 0&, "Static", "Not all columns will fit on the report." & Chr(13) & Chr(10) & "Try and reduce the font size to fit?")
                                
                    If childHWND1 <> 0 Then
                        
                        'Sometimes need multiple clicks to work
                        SendMessage childHWND, BM_CLICK, 0, 0
                        SendMessage childHWND, BM_CLICK, 0, 0
                        SendMessage childHWND, BM_CLICK, 0, 0
 
                        childHWND = 0
                        childHWND1 = 0
                        hwnd = 0
                        
                        GoTo tryagain
                        
                    Else
                    childHWND = 0
                        
                    End If
                End If
            End If
            
   GoTo tryagain
 
    
End Sub