Page 1 of 1

Program name

Posted: Sun Aug 27, 2017 8:38 pm
by r-tea
How to get the Program name?
For example, I write program which name is Daysleeper. An user can rename it to e.g. Daysleeper_1.0.
How to get the name at program's startup? I need to handle it within my code.

Re: Program name

Posted: Sun Aug 27, 2017 8:58 pm
by Bugala
Not sure if there is any other way to do it but to read the current directory contents and figure the name based out on what files you see there. But it could actually be good feature in some rare cases like yours to have way to access the name of the file that was started.

Re: Program name

Posted: Sun Aug 27, 2017 9:46 pm
by Tipsi
Hi r-tea

See the function GetProgramInfo()

Griessli
Tipsi

GetIconProperties() error handling

Posted: Mon Aug 28, 2017 7:21 am
by r-tea
Tipsi wrote:Hi r-tea

See the function GetProgramInfo()

Griessli
Tipsi
Thanks. This is one I need. I have searched through Hollywood's DOS functions only :)

I encountered another problem. Does the GetIconProperties() function return kind of error code if the given icon is missing? I don't want getting typical Hollywood Player message. I want to handle the error instead.

Re: Program name

Posted: Mon Aug 28, 2017 5:39 pm
by jPV
How about something like this:

Code: Select all

Local type, name$=GetProgramInfo()
If Exists(name$..".info")
    Local icontype, tooltypes, deftool$ = GetIconProperties(name$..".info")
    ; do your things here
Else
    ; maybe something here too
EndIf      

Re: Program name

Posted: Mon Aug 28, 2017 5:44 pm
by r-tea
What, if I don't need icontype and deftool$ at all? Do I have to pass unused variables anyway?

Re: Program name

Posted: Tue Aug 29, 2017 5:42 pm
by airsoftsoftwair
You have to pass icontype but not deftool$ in that case.