This works well so far but I need to pass the --profile argument more generic. So is there a way to read the installed CoDeSys profile from the used computer in a batch script?
If not...is it possible to do some hack? I saw a folder called "Profiles" in the Codesys installation folder. Maybe I could scan the file names there to get the latest installed profile.
Greetings
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I think the best way to get the profile name is to match the executable name, which you can get from , and the plug-in name 'ScriptEngine.plugin' with the leading comma and extract what is between them.
BR
Martin
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
okay I may not have expressed myself very well, sorry. I need to read the profile before I start CoDeSys and execute my python script. I need to read it in my batch file (outside of the CoDeSys IDE), where I start CoDeSys, so that I can do something like:
What I did now is to scan the Profiles folder (Default path: C:\Program Files (x86)\3S CODESYS\CODESYS\Profiles) and list all file names with a *profile extension. Afterwards I can choose the profile I want and store it in a variable. The batch script code looks like follows(you should be able to execute it, if CoDeSys is installed in the specified directory):
@echooffcdC:\ProgramFiles(x86)\3SCODESYS\CODESYS\ProfilesechoListallinstalledCoDeSysprofiles:
setlocalenableextensionsenabledelayedexpansionset/acount=0for%%fin(*.profile)do (
  set/acount+=1
  echo!count!: %%~nf)endlocalremChooseprofileecho(SET/pPROFILE_NUMB=Choosetheprofileyouwanttousebyenteringanumber:
remGetprofilesetlocalenableextensionsenabledelayedexpansionset/acount=0for%%fin(*.profile)do (
  set/acount+=1
  if!count!==%PROFILE_NUMB%(
   SETCODESYSPROFILE=%%~nf
   gotocommonExit
  ))endlocal:commonExitecho%CODESYSPROFILE%pauseexit
Can you give me a short feedback on this solution? I guess it is not guaranteed, that it will work in the future. Iam also grateful for further suggestions on how to solve this.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello,
I am trying to start CoDeSys with a batch file like this and execute a python script afterwards:
This works well so far but I need to pass the --profile argument more generic. So is there a way to read the installed CoDeSys profile from the used computer in a batch script?
If not...is it possible to do some hack? I saw a folder called "Profiles" in the Codesys installation folder. Maybe I could scan the file names there to get the latest installed profile.
Greetings
Hi P_Groebner.
You can find the profile name inside the content of .
Here some example code:
Output from CODESYS V3.5 SP11:
--- sys.version 2.7.7 (CODESYS.exe CODESYS V3.5 SP11, ScriptEngine.plugin 3.5.11.0)
I think the best way to get the profile name is to match the executable name, which you can get from , and the plug-in name 'ScriptEngine.plugin' with the leading comma and extract what is between them.
BR
Martin
Hi M.Keller and thank you for your answer.
okay I may not have expressed myself very well, sorry. I need to read the profile before I start CoDeSys and execute my python script. I need to read it in my batch file (outside of the CoDeSys IDE), where I start CoDeSys, so that I can do something like:
What I did now is to scan the Profiles folder (Default path: C:\Program Files (x86)\3S CODESYS\CODESYS\Profiles) and list all file names with a *profile extension. Afterwards I can choose the profile I want and store it in a variable. The batch script code looks like follows(you should be able to execute it, if CoDeSys is installed in the specified directory):
Can you give me a short feedback on this solution? I guess it is not guaranteed, that it will work in the future. Iam also grateful for further suggestions on how to solve this.