Cancel
Showing results for 
Search instead for 
Did you mean: 

DialogAutoSkip and DialogAutoSkipMsg global integer properties don't work in API

Legend
Legend

Hello,

 

I would like to run a command from API without writing to the Message Window and with automatic answering. I tried to use the DialogAutoSkip and DialogAutoSkipMsg global integer properties, but without success.

I created a small API to test:

 

Sub Main
    Dim App As femap.model
    Set App = feFemap()
    Dim nPrevDialogAutoSkip As Long
    Dim nPrevDialogAutoSkipMsg As Long
    Dim bPrevRepeat As Boolean

    nPrevDialogAutoSkip=App.DialogAutoSkip
    nPrevDialogAutoSkipMsg=App.DialogAutoSkipMsg
    bPrevRepeat=App.Pref_RepeatCreate

    App.Pref_RepeatCreate = False

    'DialogAutoSkip=0 No/Cancel button, doesn't work
    'DialogAutoSkip=1 Yes/OK button, works only on Geometry / Point...
    'App.DialogAutoSkip=0 'No/Cancel button
    App.DialogAutoSkip=1   'Yes/OK button

    'DialogAutoSkipMsg=1 First button, doesn't work
    'DialogAutoSkipMsg=2 Second button, doesn't work
    'DialogAutoSkipMsg=3 Third button, doesn't work
    'DialogAutoSkipMsg=-1 First button without message, doesn't work
    'DialogAutoSkipMsg=-2 Second button without message, doesn't work
    'DialogAutoSkipMsg=-3 Third button without message, doesn't work
    'App.DialogAutoSkipMsg=1 'First button
    'App.DialogAutoSkipMsg=2   'Second button
    'App.DialogAutoSkipMsg=3   'Third button

    App.feFileProgramRun(False, True,False,"{EP}") 'Geometry / Point...
    While App.feFileProgramRunning
    Wend

    App.feFileProgramRun(False, True,False,"{FR}") 'Printer Setup
    While App.feFileProgramRunning
    Wend

    App.DialogAutoSkip=nPrevDialogAutoSkip
    App.DialogAutoSkipMsg=nPrevDialogAutoSkipMsg
    App.Pref_RepeatCreate=bPrevRepeat
End Sub

Because in Femap API there aren't any command to set active printer and its properties (and I couldn't add .NET classes as Reference, which can modify printer settings, for example System.Drawing.Printing.PrinterSettings), I wanted to use these commands to run hidden the File / Printer Setup... command.

 

At last I could only use the following code, but I couldn't disable writing to the Message Window the "Printer Setup" text:

SendKeys "{Enter}", True
App.feRunCommand(1008, True)	'Printer Setup

Is there any other way to disable writing to the Message Window?

 I use Femap v11.4.0

 

Best regards

 

Peter Kaderasz

8 REPLIES

Re: DialogAutoSkip and DialogAutoSkipMsg global integer properties don't work in API

Siemens Phenom Siemens Phenom
Siemens Phenom
Try the below. Without using ...EndListing() you will capture messages.

Sub Main
Dim App As femap.model
Set App = feFemap()

App.feAppMessageStartListing()
SendKeys "{Enter}", True
App.feRunCommand(1008, True) 'Printer Setup


End Sub

Re: DialogAutoSkip and DialogAutoSkipMsg global integer properties don't work in API

Legend
Legend

Hello RCatania,

 

Thank you for your reply, I will try it. I think I must use feAppMessageEndListing() after Printer Setup command too, because I have my own messages to Message Window.

 

Best regards

 

Peter Kaderasz

Re: DialogAutoSkip and DialogAutoSkipMsg global integer properties don't work in API

Legend
Legend

Hello RCatania,

 

I tried to use feAppMessageStartListing() and feAppMessageEndListing(), but it wasn't good for me. I can't disable writing to the Messages Window with this metods, Femap wrote always the commands to the Messages Window (only with other font style, and all text writed after feAppMessageEndListing() command). Unfortunately there isn't in List_Destination Global Integer Property value as Destination=NONE.

At last when I use these commands, Femap always send an unwanted New Line character to the Messages Window after every feAppMessageEndListing() method.

 

Best regards

 

Peter Kaderasz

Re: DialogAutoSkip and DialogAutoSkipMsg global integer properties don't work in API

Siemens Phenom Siemens Phenom
Siemens Phenom

How about the API below?  It uses some tricks with "SendKeys" to leave the messages window looking exactly as it was before the script was run.

 

The HTML Clipboard

Sub Main
    Dim App As femap.model
    Set App = feFemap()

    App.feAppManagePanes("Messages",1)

    App.feRunCommand(829,True) 'Copy (CNTRL+C)

    App.feAppManagePanes("Messages",0)
    SendKeys "{Enter}", True

    App.feRunCommand(1008, True) 'Printer Setup

    SendKeys "%T" 'Tools
    SendKeys "O" 'Other Windows
    SendKeys "{Enter}",True 'Messages Pane
    SendKeys "^V" 'Paste

    'Remove "Play (F5)"
    SendKeys "{BackSpace}"
    SendKeys "{BackSpace}"
    SendKeys "{BackSpace}"
    SendKeys "{BackSpace}"
    SendKeys "{BackSpace}"
    SendKeys "{BackSpace}"
    SendKeys "{BackSpace}"
    SendKeys "{BackSpace}"
    SendKeys "{BackSpace}"
    SendKeys "{BackSpace}"

End Sub

Re: DialogAutoSkip and DialogAutoSkipMsg global integer properties don't work in API

Legend
Legend

Hello RCatana,

 

Thank you for your tips. With its help I made an other simplier code:

Sub Main
    Dim App As femap.model
    Set App = feFemap()

    App.feAppManagePanes("Messages",1)

    SendKeys "^{END}", True  '[CTRL+END]
    'Remove "Play (F5)" and a New Line character
    SendKeys "{BackSpace 10}"
    Wait 0.01

    SendKeys "{Enter}", True
    App.feRunCommand(1008, True) 'Printer Setup

    App.feAppManagePanes("Messages",1)

    SendKeys "^{END}", True  '[CTRL+END]
    'Remove "Printer Setup" and a New Line character
    SendKeys "{BackSpace 14}"

    Wait 0.01
    'App.feAppManagePanes("Messages",1) 'With this line Message Window will hide (and will be cleared) if I don't use the previous "Wait" command

End Sub

Is the commandID=829 the right mouse button Copy command on the Messages Window?

 

Best regards

 

Peter Kaderasz

Re: DialogAutoSkip and DialogAutoSkipMsg global integer properties don't work in API

Legend
Legend

Hello,

 

I made a small correction in your code, a SendKeys command was missing:

Sub Main
    Dim App As femap.model
    Set App = feFemap()

    App.feAppManagePanes("Messages",1)

    App.feRunCommand(829,True) '(CTRL+C)

    App.feAppManagePanes("Messages",0)
    SendKeys "{Enter}", True

    App.feRunCommand(1008, True) 'Printer Setup

    SendKeys "%T" 'Tools
    SendKeys "{Enter}",True
    SendKeys "O" 'Other Windows
    SendKeys "{Enter}",True 'Messages Pane

    SendKeys "^V", True  'Paste

    'Remove "Play (F5)" and two New Line character
    SendKeys "{BackSpace 11}"

    Wait 0.01
    'App.feAppManagePanes("Messages",1) 'With this line Message Window will hide (and will be cleared) if I don't use "Wait" command
End Sub

Best regards

 

Peter Kaderasz

Re: DialogAutoSkip and DialogAutoSkipMsg global integer properties don't work in API

Siemens Phenom Siemens Phenom
Siemens Phenom

Nice, your method is even more efficient.  The command 829 is the keyboard short cut to copy the entire contents of the messages window.

Re: DialogAutoSkip and DialogAutoSkipMsg global integer properties don't work in API

Legend
Legend

Hello,

 

here is a code to remove last line in the Messages Window:

 

Sub Main
    Dim App As femap.model
    Set App = feFemap()

    ...

    App.feAppManagePanes("Messages",1)
    SendKeys "^{END}", True  '[CTRL+END]
    SendKeys "+{HOME}", True  '[SHIFT+HOME]
    SendKeys "+{LEFT}", True  '[SHIFT+LEFTARROW]
    SendKeys "{DEL}", True  '[DEL]
    Wait 0.01
End Sub

Best regards

 

Peter Kaderasz