Change app name with IDE script

How can I change the application name via an IDE script? I’ve got the following:

if ConstantValue(“App.kMaxVersion”) = “server” then
PropertyValue(“App.MacOSXAppName”) = “Mail Archiver X Pro”
PropertyValue(“App.MacOSXAppName”) = “Mail Archiver X”
end if

print PropertyValue(“App.MacOSXAppName”)

The print does “Mail Archiver X Pro”. But the app name is only changed for the debug version and not for the built one. Does anyone have a better idea?

Changed the IDE script from “Both” to “Release” and it works.