Hello,
is it possible to get the name of the .fcfx and store it in a variable to be able to use it in the firmware ?
if the file name is for example: R IDF 5.3 Test12.fcfx
the name will be "R IDF 5.3 Test12"
Thx
Flowcode document name
-
Xbiotec
- Posts: 222
- http://meble-kuchenne.info.pl
- Joined: Thu Sep 23, 2021 3:44 pm
- Location: France
- Has thanked: 36 times
- Been thanked: 26 times
-
Steve-Matrix
- Matrix Staff
- Posts: 1662
- Joined: Sat Dec 05, 2020 10:32 am
- Has thanked: 233 times
- Been thanked: 393 times
Re: Flowcode document name
Hopefully the attached project shows you how to do it. I used a combination of the "AddConst" event to manipulate the value (and size) of a constant and the "Expand.PathName" to retrieve the name of the file.
If you compile the project, the "MYFILENAME" Flowcode constant should be set to the name of the actual Flowcode project file.
If you compile the project, the "MYFILENAME" Flowcode constant should be set to the name of the actual Flowcode project file.
- Attachments
-
- put filename into firmware.fcfx
- (9.83 KiB) Downloaded 8 times
-
Steve-Matrix
- Matrix Staff
- Posts: 1662
- Joined: Sat Dec 05, 2020 10:32 am
- Has thanked: 233 times
- Been thanked: 393 times
Re: Flowcode document name
Here are the steps that I did to create it in that attached project:
- Create a global constant
- Double-click the Compile::Ev_AddConst event in Project Explorer
- Double-click <Add new>
- Click "OK"
- Click "OK and Edit Macro"
- Add code as per my example to the Ev_AddConst macro
-
Xbiotec
- Posts: 222
- Joined: Thu Sep 23, 2021 3:44 pm
- Location: France
- Has thanked: 36 times
- Been thanked: 26 times
Re: Flowcode document name
1- Create a global constant
what should be the name of the constant ?
Which kind of constant, String or other ?
6- Add code as per my example to the Ev_AddConst macro
If add by copy past the code, the local variables do not exist, so need to create one by one isn't ?
what should be the name of the constant ?
Which kind of constant, String or other ?
6- Add code as per my example to the Ev_AddConst macro
If add by copy past the code, the local variables do not exist, so need to create one by one isn't ?
Seb
-
Steve-Matrix
- Matrix Staff
- Posts: 1662
- Joined: Sat Dec 05, 2020 10:32 am
- Has thanked: 233 times
- Been thanked: 393 times
Re: Flowcode document name
The constant is a string and should be called "MYFILENAME".
Yes, you will need to create the variables. The alternative is to export the macro from my project and import it into your project. This will retain the local variables, but you will need to manually link this to the AddConst event (double click the event and select the imported macro).
This all involves advanced use of Flowcode and many of these features (events and inbuilt functions) are typically only used when creating components.
We might add this feature to an existing Flowcode component (e.g. the "Auto Version Identifier" component), which will make it a lot easier to add to existing projects.
Attached is a very basic component that I've just created to allow this. The fcfx file is the source code and the fcpx file is the exported component. You should make this exported component available using the "Look for components in..." entry of Global Options. See here:
https://www.flowcode.co.uk/wiki/index.p ... #Locations
Yes, you will need to create the variables. The alternative is to export the macro from my project and import it into your project. This will retain the local variables, but you will need to manually link this to the AddConst event (double click the event and select the imported macro).
This all involves advanced use of Flowcode and many of these features (events and inbuilt functions) are typically only used when creating components.
We might add this feature to an existing Flowcode component (e.g. the "Auto Version Identifier" component), which will make it a lot easier to add to existing projects.
Attached is a very basic component that I've just created to allow this. The fcfx file is the source code and the fcpx file is the exported component. You should make this exported component available using the "Look for components in..." entry of Global Options. See here:
https://www.flowcode.co.uk/wiki/index.p ... #Locations
- Attachments
-
- AddFilenameToCode.fcpx
- (2.36 KiB) Downloaded 4 times
-
- FileInfo.fcfx
- (13.56 KiB) Downloaded 5 times
-
stefan.erni
- Valued Contributor
- Posts: 1133
- Joined: Wed Dec 02, 2020 10:53 am
- Has thanked: 215 times
- Been thanked: 237 times
Re: Flowcode document name
Hi Seb, Hi Steve
Good idea and useful.
I have added the components to my program and am sending the filename to the iPhone via BLE.
It works very well. printscreen Iphone:
Good idea and useful.
I have added the components to my program and am sending the filename to the iPhone via BLE.
It works very well. printscreen Iphone: