strange problem importing rsc script

Hi all,

I have been designing a simple program that generates a script file to be imported in to a fully reset (i.e. no defaults) Mikrotik router.

However when I try to import the rsc file generated by the program I get this error:

expected command name (line 1 column 1)

I don’t know why, when I copy the text of the RSC file and paste it into the terminal window it’s fine, but if I try and import it I get the error.

Here are the first few lines of text in the rsc:

:log info "**** Starting auto-setup script ****"

:log info "Configuring log to file..."
/system logging
	action add target=disk name=ScriptLog disk-file-name=ScriptLog disk-file-count=1  
	add action=ScriptLog topics=script
	


:log info "Creating bridge interface..."
/interface bridge
add arp=proxy-arp name=bridge-LAN

It throws the error on the first Char!

Here is the output of an import verbose=yes command:

#line 1
▒▒▒:log info "**** Starting auto-setup script ****"
expected command name (line 1 column 1)

What are those characters before :log?

Any help gratefully appreciated.

tslytsly

They could be spaces, tabs or other nonvisible characters as “hardspace” or … you have edited and copied script as UTF-8 file and then strange chars come from UTF coding.

My advice: Copy scripts from Winbox to “stupid” NotePad and then look for nonstandard characters. Remove them and copy the script back .

Hmm, I think you’re right, when I paste that character into an online UTF decoder it shows as “medium shade”.
I’ll see if I can make my program output ascii.

thanks

tslytsly

That was it!
I never even considered the text encoding, it seems vb.net uses UTF-8 by default.
I just had to force it to write the script using ASCII.

Thanks BartoszP

tslytsly

Notepad++ will/should be your friend :slight_smile:

Actually I already use it for everything.
I even have a custom style for RouterOS so rsc files look like the terminal.. :sunglasses:

in this case Notepad++ didn’t show the medium shade characters.

As it silently have recognized as UTF so the script had been displayed/saved directly as UTF.
Sometimes notepad is the best tool …