Showing results for 
Search instead for 
Do you mean 
Reply
Solved! Go to solution

Calling shortcut keys in api

Hi.

 

Is it possible to call a shortcut key in an api code ?

If so can someone please send an example>

 

17 REPLIES

Re: Calling shortcut keys in api

Dear RedP,

 

 

You should use command SendKeys. Short example how to call F9 button to press:

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

    SendKeys "{F9}"
End Sub

 

Here you can find table how to use more complex keys - using Alt, Shift, Control, etc:

http://www.developerfusion.com/article/57/sendkeys-command/

 

Yarko

 

 

 

Re: Calling shortcut keys in api

Hi

Thanks @yarko

 

Could maybe assist me with my next question ???

 

I want to save a jpeg thorugh an api but i would like the jpeg to save according to the page setup after the page setup has been called through the shorcut key. How can i incorporate the jpeg to save acoording to what has been defined in the page setup ??

Re: Calling shortcut keys in api

Dear RedP,

 

 

Can you tell me what options you need from page setup ? picture dimensions? And explain what you are trying to do with jpeg. Then I will try to help.

 

Because when we call function using a shortcut it's really hard to track when user finished his interaction. 

I assume there is a simpler way to complete your task than calling shortcut.

 

Yarko

Re: Calling shortcut keys in api

[ Edited ]

@yarko

 

So basically I want to save  the graphics window to a jpeg, but I want to save the picture using  a custom height and width and adding a border around the specified height and width. Really struggling to get this to work. As well as how do I get the path of where the jpeg file is saved to show in the graphics window??? You helped me with the code on how to save to jpeg using API.

Re: Calling shortcut keys in api

Dear RedP,

 

 

You can easily set size using the following line:

'Width = 1600 pixels, Height = 800

App.feWindowSetSize(0,0,0, 1600, 800)

 

And later call screenshot functions.

 

With border I don't know how to apply. I will check later if it's possible.

 

Yarko

Re: Calling shortcut keys in api

@ Yarko

 

I have tried running the code that you have given me and it comes up with the message unexpected text where you define width and height.

Re: Calling shortcut keys in api

Dera RedP,

 

 

It can be due to version of Femap you use. I'm sure that in version 11.2 this function is available. And in version 11.0 it was not included yet. When exactly it was added I'm not sure.

 

 

Yarko

Re: Calling shortcut keys in api

@yarko

 

I managed to get it to work using WindowSizeRect as I am using version 11.0.

To get a border around the plot to save to the jpeg. I have tried to formulate a code but doesnt seem to be working well I dont know if you could add some input to it.

 

If App.fePgSetup_PrintBorder = True Then

Print_Border = App.feWindowSetRect :.color = feView.color(FCL_BLACK)

 

Re: Calling shortcut keys in api

[ Edited ]

Dear RedP,

 

 

I've checked Api manual and didn't find anything about border color for Femap Window. 

In View Options I found BorderMode property but it is integer number and don't have a clue how to use it. 

 

Maybe somebody from Femap developers can give some suggestions.

 

Yarko