Change Tag parameter settings for multiple Tags in Basic

The script example shown hereunder allows to change the tag parameter settings of multiple tags. This could be useful for example to change by scripting the SMS destination parameter for the alarm notification of all the eWON Tags.

Explanation

We uses the «Setsys Tag,"load",-i» command to load the Tags using there index. So this script will loop through the first 300 Tags.

The «Setsys Tag,"load",-i» command will generate an error if the index doesn't exist.That's why the «Onerror» function is used to terminate the For Next Loop.

The «P$ = Getsys Tag,"PageId"» and the test «If Val(P$) = 2 Then» allows to change only the settings of the tags belonging to page n°2 (called «System» by default). 

SMSDestination:
	REM N$ = "0622527877"
	D$ = N$ + ",ucp,0567112200,pass"
	Onerror "goto EndCount"
	For i%=0 To 300
		Setsys Tag,"load",-i%
		P$ = Getsys Tag,"PageId"
		REM Only change SMS number of Tags belonging to Page nr 2
		If Val(P$) = 2 Then
		Setsys Tag,"STO",D$ : REM SMS To field of Tag_1
		Setsys TAG,"save"
		Endif
	Next i%
	EndCount:
	Onerror ""
	CFGSAVE : REM Writes configuration to flash
	LogEvent "SMS Number changed to: " + D$,100
END