March 17, 20242 yr Commercial Member 16 hours ago, ha5mvo said: I do just that. What happens in practice though, is that the correct image is turned to into bg.jpg (corresponding with the simbrief data), however it fails to load and is automatically deleted after about 10 seconds leaving the background as it was and no bg.jpg in the folder. For some reason, the tablet won't refresh with the new bg file. If you bring up the remote tablet on http://localhost:8083/ - you will indeed get the new background showing up but not in the VC The tablet doesn't refresh the background on its own. It is a HTML instrument, much like a web page, you have to somehow force a refresh (turn it off/on again? Reload the aircraft? ). I think that ptimale is running the script before the aircraft has even finished loading? (you can force AAO to load the aircraft config and the scripts while you are still on the world map, there is an option for that in the Application menu. But that option is strictly a last resort, it should only be used when the "normal" method of detecting the aircraft fails) Or you run the script as a global automated script, then it will be executed when AAO connects to the sim the first time. You just have to make sure that you've completed your SimBrief preparations before you start the sim. Edited March 17, 20242 yr by Lorby_SI LORBY-SI
March 17, 20242 yr Author (I still don't understand why you are deleting the bg.jpg file?) because during the next loading of another plane (ICAO) I have a file conflict it cannot delete the file example : plane loading with code ICAO = ARF, the script renames the file AFR.jpg to bg.jpg plane loading with ICAO code = AAL.jpg the file cannot be renamed to bg.jpg because it already exists in the img folder I will test your new script THANKS
March 17, 20242 yr Author I just tested your latest script it works fine the ideal would be to read the ICAO code in the livery, aircraft.cfg file Is it possible to rename the title of the post, it would be a little more meaningful like "fenix change the EFB wallpaper automatically ICAO" if a moderator goes through THANKS
March 17, 20242 yr Commercial Member 4 hours ago, ptimale said: the file cannot be renamed to bg.jpg because it already exists in the img folder The command in AAO is supposed to overwrite the target. LORBY-SI
March 17, 20242 yr Commercial Member 3 hours ago, ptimale said: the ideal would be to read the ICAO code in the livery, aircraft.cfg file That would only work for non-Marketplace aircraft. You could write a JScript program that reads (A:TITLE, String), then loads the Fenix's aircraft.cfg (you know where that is) and then parses the desired information. LORBY-SI
March 17, 20242 yr Commercial Member 4 hours ago, ptimale said: Is it possible to rename the title of the post, it would be a little more meaningful like "fenix change the EFB wallpaper automatically ICAO" Done. Edited March 17, 20242 yr by Lorby_SI LORBY-SI
March 17, 20242 yr Commercial Member 4 hours ago, ptimale said: the ideal would be to read the ICAO code in the livery, aircraft.cfg file (WSH:jscript|AaoEntry) function AaoEntry(){ var acTitle = (A:TITLE, String); var fso = new ActiveXObject("Scripting.FileSystemObject"); var acfg = "<pathtoyourcommunityfolder>\\fnx-aircraft-320\\SimObjects\\Airplanes\\FNX_320_CFM\\aircraft.cfg"; if (fso.FileExists(acfg)){ var tStream = fso.OpenTextFile(acfg, 1, false, 0); var text = tStream.ReadAll(); tStream .close(); var sPos = text.indexOf("Title=\"" + acTitle + "\""); if (sPos > 0){ sPos = text.indexOf("icao_airline=", sPos); if (sPos > 0){ var ePos = text.indexOf("\"", sPos + 15); if (ePos > 0){ var acIcao = text.substring(sPos + 14, ePos); var srcImgName = "C:\\ProgramData\\Fenix\\FenixSim A320\\efb\\img\\" + acIcao + ".jpg"; var trgImgName = "C:\\ProgramData\\Fenix\\FenixSim A320\\efb\\img\\bg.jpg"; fso.CopyFile(srcImgName, trgImgName, true); } } } } } Be mindful that the Fenix has more than one aircraft.cfg. AAO theoretically knows the path to each cfg and could write it into an LVar - but not in the version you have, this would have to be coded in the next version of AAO. The parser above is very dumb. It assumes that every aircraft.cfg of the Fenix will look the same (=identical upper/lower case, same amount of spaces and quotes.) It will be up to you to make sure that this is indeed the case. Edited March 17, 20242 yr by Lorby_SI LORBY-SI
March 17, 20242 yr Author I don't understand the script very well I'm not sure about the modification in the livery the ICAO code is on line 15 I'm trying with airfrance AFR the images all have the .png extension (WSH:jscript|AaoEntry) function AaoEntry(){ var acTitle = (A:TITLE, String); var fso = new ActiveXObject("Scripting.FileSystemObject"); var acfg = "H:\\Microsoft Flight Simulator\\Community\\fnx-aircraft-320\\aircraft.cfg"; if (fso.FileExists(acfg)){ var tStream = fso.OpenTextFile(acfg, 1, false, 0); var text = tStream.ReadAll(); tStream .close(); var sPos = text.indexOf("Title=\"" + acTitle + "\""); if (sPos > 0){ sPos = text.indexOf("icao_airline=", sPos); if (sPos > 0){ var ePos = text.indexOf("\"", sPos + 15); if (ePos > 0){ var acIcao = text.substring(sPos + 14, ePos); var srcImgName = "C:\\ProgramData\\Fenix\\FenixSim A320\\efb\\img\\" + acIcao + ".png"; var trgImgName = "C:\\ProgramData\\Fenix\\FenixSim A320\\efb\\img\\bg.png"; fso.CopyFile(srcImgName, trgImgName, true); } } } } }
March 17, 20242 yr Commercial Member 10 minutes ago, ptimale said: var acfg = "H:\\Microsoft Flight Simulator\\Community\\fnx-aircraft-320\\aircraft.cfg"; I'm sorry, but that can't be the correct file. It is in the completely wrong place. "The" aircraft.cfg is always where the SimObject is, for example here: \Community\fnx-aircraft-320\SimObjects\Airplanes\FNX_320_CFM\aircraft.cfg \Community\fnx-aircraft-320-AZAIBIKD\SimObjects\Airplanes\FNX320_AZAIBIKD\aircraft.cfg The Fenix can have a multitude of aircraft.cfgs, because the different "liveries" are actually different aircraft altogether. On my computer I have 8 different aircraft.cfg for the Fenix. Unless I change AAO to tell you the actual path to the current file, you would have to "fake" an aircraft.cfg of your own where you combine all the [FLTSIM.x] sections of all the other aircraft.cfg files. Edited March 17, 20242 yr by Lorby_SI LORBY-SI
March 17, 20242 yr Author I made a mistake here is the right test (WSH:jscript|AaoEntry) function AaoEntry(){ var acTitle = (A:TITLE, String); var fso = new ActiveXObject("Scripting.FileSystemObject"); var acfg = "H:\\Microsoft Flight Simulator\\Community\\fnx-aircraft-320-liveries\\SimObjects\\Airplanes\\FNX_320_CFM_AFRFGKXS\\aircraft.cfg"; if (fso.FileExists(acfg)){ var tStream = fso.OpenTextFile(acfg, 1, false, 0); var text = tStream.ReadAll(); tStream .close(); var sPos = text.indexOf("Title=\"" + acTitle + "\""); if (sPos > 0){ sPos = text.indexOf("icao_airline=", sPos); if (sPos > 0){ var ePos = text.indexOf("\"", sPos + 15); if (ePos > 0){ var acIcao = text.substring(sPos + 14, ePos); var srcImgName = "C:\\ProgramData\\Fenix\\FenixSim A320\\efb\\img\\" + acIcao + ".png"; var trgImgName = "C:\\ProgramData\\Fenix\\FenixSim A320\\efb\\img\\bg.png"; fso.CopyFile(srcImgName, trgImgName, true); } } } } }
March 17, 20242 yr Commercial Member 5 minutes ago, ptimale said: here is the right test Please take note of my text above. Your script will always only find this one livery - and none of the others. Because in this aircraft.cfg there is only the one. I only see two options: 1. You create an aircraft.cfg of your own in a different location, where you collect all the required information (the [FLTSIM:] sections) of all the aircraft.cfg that belong to the Fenix or 2. You send me an email with your proof of purchase to the support address (last page of the AAO manual). I can add an LVar that contains the path to the current aircraft configuration in MSFS, but I can only do that in a new AAO version. Be mindful that my current development version has already been compiled towards SU15 Edited March 17, 20242 yr by Lorby_SI LORBY-SI
March 17, 20242 yr Author THANKS I already wanted to test your script but I didn't understand how to read it thank you for your proposal to provide me with the following version I am not in SU15 And I'm going to waste your time.
March 17, 20242 yr Commercial Member 7 minutes ago, ptimale said: I didn't understand how to read it It is quite simple. It reads the contents of the aircraft.cfg into a single string variable. Then it tries to find the position where the model that you are currently flying is defined (Title="Value from the AVar"). If it can locate that, then it will try to find the airline tag. The problem here is, that the developer of the livery has probably written the "Title=" part differently from what the script expects, so it can't even find that. I am currently looking at an aircraft.cfg that I have for the Fenix, and that file doesn't even have the icao_airline property in it. So the whole exercise is probably pointless, the parser in the script would have to be a lot smarter - and the developers would have to be more dilligent. I guess the "atc_parking_codes" property is more what you need? [VERSION] major = 1 minor = 0 [VARIATION] base_container = "..\fnx320" [FLTSIM.0] title = "FenixA320_AZAIBIKD" model = "" panel = "" sound = "" texture = "AZAIBIKD" description = "Description placeholder" wip_indicator = 2 ui_manufacturer = "Airbus" ui_type = "A320" ui_variation = "Alitalia 'Classic'" ui_typerole = "Commercial Airliner" ui_createdby = "Fenix Simulations" ui_certified_ceiling = 39800 ui_max_range = 3500 ui_autonomy = 7 ui_fuel_burn_rate = 5300 atc_id = "I-BIKD" atc_airline = "Alitalia" atc_flight_number = "1123" atc_heavy = 0 atc_parking_types = "GATE,RAMP,CARGO" atc_parking_codes = "AZA" isUserSelectable = 1 isAirTraffic = 0 canBeUsedByAITraffic = 0 Edited March 17, 20242 yr by Lorby_SI LORBY-SI
March 17, 20242 yr Commercial Member (WSH:jscript|AaoEntry) function AaoEntry(){ var acTitle = (A:TITLE, String); var fso = new ActiveXObject("Scripting.FileSystemObject"); var acfg = "<pathtoyourcommunityfolder>\\fnx-aircraft-320\\SimObjects\\Airplanes\\FNX_320_CFM\\aircraft.cfg"; if (fso.FileExists(acfg)){ var tStream = fso.OpenTextFile(acfg, 1, false, 0); var text = tStream.ReadAll(); tStream .close(); var sPos = text.indexOf("\"" + acTitle + "\""); if (sPos > 0){ sPos = text.indexOf("atc_parking_codes", sPos); if (sPos > 0){ sPos = text.indexOf("\"", sPos) + 1; var ePos = text.indexOf("\"", sPos); if (ePos > 0){ var acIcao = text.substring(sPos + 1, ePos); var srcImgName = "C:\\ProgramData\\Fenix\\FenixSim A320\\efb\\img\\" + acIcao + ".jpg"; var trgImgName = "C:\\ProgramData\\Fenix\\FenixSim A320\\efb\\img\\bg.jpg"; fso.CopyFile(srcImgName, trgImgName, true); } } } } } LORBY-SI
Archived
This topic is now archived and is closed to further replies.