how to check what system my script is running on

Find quick help here to get you started with Hollywood
Post Reply
peceha
Posts: 111
Joined: Tue Dec 13, 2016 9:39 am
Location: Poland

how to check what system my script is running on

Post by peceha » Tue Mar 14, 2017 12:36 am

Hi
is there some straightforward way of checking if script is running on, let's say, classic amiga or windows?

At the moment I'm using something like:

Code: Select all

sysInfo=GetSystemInfo()
If Not HaveItem(sysInfo,"username")
 ; I assume it is amiga in that case
endif
Is there more elegant way of doing this?
I'm asking this question since whenever I run my program on classic amiga I have to uncomment ExitOnError(False) and set slightly different values for some variables (for speed reason).

User avatar
airsoftsoftwair
Posts: 2572
Joined: Fri Feb 12, 2010 3:33 pm
Location: Germany
Contact:

Re: how to check what system my script is running on

Post by airsoftsoftwair » Wed Mar 15, 2017 1:25 am

GetVersion() is your friend.

peceha
Posts: 111
Joined: Tue Dec 13, 2016 9:39 am
Location: Poland

Re: how to check what system my script is running on

Post by peceha » Wed Mar 15, 2017 11:15 am

Thanks, I somehow overlooked that one.

peceha
Posts: 111
Joined: Tue Dec 13, 2016 9:39 am
Location: Poland

Re: how to check what system my script is running on

Post by peceha » Thu May 25, 2017 9:23 pm

Code: Select all

gv=GetVersion()
If gv.platform="AmigaOS3"
	TextOut(#CENTER,#CENTER,gv.platform)
	@DISPLAY 1,{
		width=320,
		height=256,
		mode="fullScreen",
		fixed=True,
		HidePointer=True
	}
Else
	@DISPLAY 1,{
		width=464,
		height=256,
		mode="FullScreenScale",
		fixed=True,
		HidePointer=True
	}
EndIf
When I run this on real Amiga the text AmigaOS3 gets displayed and... DISPLAY 1 gets all the data AFTER "else" ie: 464x256 and fullScreenScale
When I comment out "Else" part (with all the DISPLAY data) then it runs correctly.

Could anybody check this on Amiga if it is behaving same way as mine ?

User avatar
airsoftsoftwair
Posts: 2572
Joined: Fri Feb 12, 2010 3:33 pm
Location: Germany
Contact:

Re: how to check what system my script is running on

Post by airsoftsoftwair » Thu May 25, 2017 11:22 pm

You are mixing up two things here: Preprocessor commands are evaluated before the script is started so your code cannot work properly. Read this.

peceha
Posts: 111
Joined: Tue Dec 13, 2016 9:39 am
Location: Poland

Re: how to check what system my script is running on

Post by peceha » Fri May 26, 2017 12:15 pm

Thank You.

zylesea
Posts: 169
Joined: Tue Feb 16, 2010 1:50 am
Location: Westfalen/Germany
Contact:

Re: how to check what system my script is running on

Post by zylesea » Tue Dec 12, 2017 12:50 am

airsoftsoftwair wrote:GetVersion() is your friend.
I would like a small change in the was getversion works: Currently it seems to extract the OS from the embedded Hollywood player target, I'd like if it would get the information from the OS itself somehow. It's affecting Amiga et al.: if you run a 68k compiled Hollywood program on MorphOS (I think on OS4 it's the same) getversion returns AmigaOS3, but not MorphOS - which the actual host is.

User avatar
airsoftsoftwair
Posts: 2572
Joined: Fri Feb 12, 2010 3:33 pm
Location: Germany
Contact:

Re: how to check what system my script is running on

Post by airsoftsoftwair » Sat Dec 16, 2017 12:05 am

I think this can easily be implemented in script code. Just check for SYS:System/GrimReaper for OS4, SYS:MorphOS/Ambient for MorphOS etc. and you have it :-)

zylesea
Posts: 169
Joined: Tue Feb 16, 2010 1:50 am
Location: Westfalen/Germany
Contact:

Re: how to check what system my script is running on

Post by zylesea » Mon Dec 18, 2017 9:27 pm

airsoftsoftwair wrote:I think this can easily be implemented in script code. Just check for SYS:System/GrimReaper for OS4, SYS:MorphOS/Ambient for MorphOS etc. and you have it :-)
That's an easy and good solution. Good hint.

Post Reply