Jump to content


Photo

Macro in FSUIPC

Macro

  • Please log in to reply
7 replies to this topic

#1 tomtomfly

tomtomfly

    Newbie

  • new Members
  • Pip
  • 4 posts
  • LocationGermany

Posted 19 March 2012 - 06:50 PM

Dear Peter,

first of all: Thanks for the probably most valuable "Add-on" to FSX ever! FSUIPC helps to cure many, many smaller and bigger issues and enables a world of opportunities.
Great work! I think without FSUIPC there were significantly less enthusiastic simmers. I hope Microsoft is aware of that!

Now a question I am unable to solve.

I am trying to create a Marco file. But the name/macro does not show up in the list of controls when I try to assign this to a button.
I tried to create a Mouse Macro successfully and the macro could be selected in the controls section. Then I altered the commands in the macro file. This worked pretty well for the first lines of commands ( I need more then 10).
Then I edited the file again and changes the name. The macro is not visible any longer and despite reading through the documentation for many times now I cannot find the error.

FSUIPC.ini:

[MacroFiles]
1=TomFenst

Macro file:

TomFenst.MCRO

[Macros]
1=Seiten
1.01=K83,16
1.02=K78,8
1.03=K39,8
1.04=K40,8
1.05=K40,8
1.06=K13,8
1.07=K83,16
1.08=K78,8
1.09=K39,8
1.10=K40,8
1.11=K40,8
1.12=K40,8
1.13=K13,8

What am I doing wrong?

Best regards,
Tom
  • 0

#2 Pete Dowson

Pete Dowson

    Advanced Member

  • Moderators
  • 26,406 posts
  • LocationNear Stoke-on-Trent, UK

Posted 19 March 2012 - 08:44 PM

I am trying to create a Marco file. But the name/macro does not show up in the list of controls when I try to assign this to a button.


Remove the unnecessary leading zero in the lines: It just wants straight sequence numbers:

[Macros]
1=Seiten
1.1=K83,16
1.2=K78,8
1.3=K39,8
1.4=K40,8
1.5=K40,8
1.6=K13,8
1.7=K83,16
1.8=K78,8
1.9=K39,8
1.10=K40,8
1.11=K40,8
1.12=K40,8
1.13=K13,8

I might vchange it is a future update -- no one's done that before!

Pete
  • 0

#3 tomtomfly

tomtomfly

    Newbie

  • new Members
  • Pip
  • 4 posts
  • LocationGermany

Posted 20 March 2012 - 01:50 PM

I will try again later today as advised, but this is actually how I did in the first trial - numbering from 1 to 13 with no leading zero.
Unfortunatelly the macro (the modified mouse macro as described above) did not run through all the 13 lines, but apparently stopped at number nine, that's why I tried with the leading zero.

I actually had three macro files (one with leading zeros and one without and the third one with two subroutines [one from 1-6 and the other from 1-7 (lines 7-13] as above ) referenced in the FSUIPC.ini,
[MacroFiles]
1=Tom
2=Tom1
3=Tom2

but again only the one I created FSX-internally as "Mouse Macro" did appear in the list, but the others did not, neither did the "second part" I added in the Macro file with lines 1-7 , only the one MouseMacro and name I created in FSX.


As said before, I will ty again later today and post my results.
Thank you for the moment.

Edited by tomtomfly, 20 March 2012 - 02:06 PM.

  • 0

#4 Pete Dowson

Pete Dowson

    Advanced Member

  • Moderators
  • 26,406 posts
  • LocationNear Stoke-on-Trent, UK

Posted 20 March 2012 - 02:10 PM

I will try again later today as advised, but this is actually how I did in the first trial - numering from 1 to 13 with no leading zero.
Unfortunatelly the macro (the modified mouse macro as described above) did not run through all the 13 lines, but apparently stopped at number nine, that's why I tried with the leading zero.


Well, I tried your exact macro here, with the same names and numbers, and it sent all 13 keypresses okay. I've actually modified FSUIPC ready for the next version to accept 01 to 09 as well, and that works too. How are you telling where it finished? Are you logging Keys and Buttons?

I don't know what the sequence is supposed to do (I've not examined the actual keystrokes), but if you are trying to invoke an FS menu and then operate within it you will probably have to use a Lua plug-in instead of a macro, as when the FS menu takes over any keypresses not already in the keyboard buffer will not be seen by the dialogue. FSUIPC is effectively frozen until the menu dialogue exits. Lua plug-ins don't have that problem because they run simultaneously. There are some examples of menu-operating plug-ins in the set supplied and installed with FSUIPC.

Perhaps also you ought to tell me what version of FSUIPC you are using, as it might be different to mine? The currently supported versions are 3.999 and 4.81.

Regards
Pete
  • 0

#5 tomtomfly

tomtomfly

    Newbie

  • new Members
  • Pip
  • 4 posts
  • LocationGermany

Posted 20 March 2012 - 05:26 PM

OK - getting closer....
(I am using 4.81)

I did as you said with the same result: Entry is not visible in the controls list.
So far I thought that it would not be relevant what the actual commands in the macro file are supposed to do, but when reading your last post, I suspected it might be....
Therefore I created another file with command lines from you example in the user guide and this is visible. Then I modified my file with just copying your example lines into this one and now this one is visible too.
Do the macros only appear if the content is executable and faultless?

What it is supposed to do:
I have created two additional cockpit views (my 34 degree cockpit window view to the left and to the right). The macro was supposed to open these two windows by pulling up the menu "view" - "New View" - "Cockpit" - "my 1st window" and then the same with my second window, each with the respective (German) keystrokes.

This did work with window number 1, but I failed when adding window nr. 2.
I only assumed (this is what I tried to express saying "apparently") that it did stop at Nr. 9 as it was opening number 1 es expected and then did some more, but did not open nr 2 as expected

So I understand that Nr. 1 only worked because it was in the keyboard buffer and therefore also the entry was visible in the command list?

Edited by tomtomfly, 20 March 2012 - 05:39 PM.

  • 0

#6 Pete Dowson

Pete Dowson

    Advanced Member

  • Moderators
  • 26,406 posts
  • LocationNear Stoke-on-Trent, UK

Posted 20 March 2012 - 05:36 PM

Do the macros only appear if the content is executable and faultless?


Well, they are processed into tables for efficient execution internally, so if they are invalid thay won't be tabulated and won't appear. But the file you posted earlier worked fine, as I said.

I have created two additional cockpit views (my 34 degree cockpit window view to the left and to the right). The macro was supposed to open these two windows by pulling up the menu "view" - "New View" - "Cockpit" - "my 1st window" and then the same with my second window, each with the respective (German) keystrokes


You will be lucky to get away with all that in a macro, because some of the keystrokes won't be seen in the menu. The best method for such things is to use Lua. The ipc library in Lua contains the "ipc.keypressplus" function which is explicitly designed for this sort of thing. See the two examples, "Fuel737.lua" and "Payload737.lua" in the Lua plugin examples provided in your FSUIPC Documents folder.

Regards
Pete
  • 0

#7 tomtomfly

tomtomfly

    Newbie

  • new Members
  • Pip
  • 4 posts
  • LocationGermany

Posted 20 March 2012 - 06:26 PM

Thank you very much for your help and especially for the enormously speedy responses!!!!!

As I said, I could not manage to get this visible, so I will take your recommendation and go with Lua
Not the solution I was hoping for, but the way how to get there and saving me the time do do more trials and headache.
Then I will start digging into that Lua-thing, which I did not understand so far (im not an IT professional, just learning by doing)

Thanks again!!!
  • 0

#8 Pete Dowson

Pete Dowson

    Advanced Member

  • Moderators
  • 26,406 posts
  • LocationNear Stoke-on-Trent, UK

Posted 20 March 2012 - 06:32 PM

As I said, I could not manage to get this visible


There's something very wrong if it isn't visible. Certainly your original posted here, with the line numbers corrected, was visible. I don't think you've shown me anything else.

Don't forget, if you change files whilst FS is running you MUST press the "reload" button in the relevant FSUIPC options screen to get it to re-scan your changes.

so I will take your recommendation and go with Lua

Not the solution I was hoping for


Why is that? If you want to manipuiate FS options via menus it is by far the best and easiest way to do it! The Lua file, once in the modules folder, is assignable just like any macro. What is your fear?

Then I will start digging into that Lua-thing, which I did not understand so far (im not an IT professional, just learning by doing)


There's hardly any "digging" involved! What is so worrying? Look at the examples i told you about. Try them out - though maybe they need adjusting for a German menu. They are much less obscure than macros, I assure you!

Regards
Pete
  • 0





Also tagged with one or more of these keywords: Macro

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users


About simFlight - simflight.com - simflight.de - simflight.fr - simflight.nl - simflight.pt - simflight.es - simflight.it - simflight.jp - simrussia.com - simMarket