Application name

How I will get the application name value on desktop, web and console applications ?

Enter the information in the BUILD SETTINGS section at the bottom of the left side panel

From http://forums.realsoftware.com/viewtopic.php?f=21&t=36393

Hi everyone so i was wondering how can i find the application name when there is no built in property to the RealBasic language reference that i know of. So i come up with a way using the NthField function. This works great for Debug built or when you build you project. I hope this helps anyone that want’s to get there Applications name

’ Add this method to your App

Function DisplayName() As String #If DebugBuild Then Return NthField( NthField( App.ExecutableFile.Name , ".exe" , 1 ) , "Debug" , 2 ) #Else Return NthField( App.ExecutableFile.Name , ".exe" , 1 ) #EndIf End Function

'Call it like

MainWindow.Title = App.DisplayName

Or easier.:

My bad… I thought the OP was about SETTING the name

Or try

app.ExecutableFile.name

Thanks for your replies.

Comes from quoting other people’s answers without checking. NthField is case sensitive, and you need a dot before debug so what works for me is

[code]Function DisplayName() As String
#if TargetMacOS then

#If DebugBuild Then
  Return NthField( NthField( App.ExecutableFile.Name , ".app" , 1 ) , ".debug" , 1 )
#Else
  Return NthField( App.ExecutableFile.Name , ".app" , 1 )
#EndIf

#elseif TargetWin32

#If DebugBuild Then
  Return NthField( NthField( App.ExecutableFile.Name , ".exe" , 1 ) , ".debug" , 1 )
#Else
  Return NthField( App.ExecutableFile.Name , ".exe" , 1 )
#EndIf

#elseif TargetLinux

#endif
End Function
[/code]