Hello
I wrote a simple api code that give some information about my router
dns name\ip address\content of file
when I run it with visual express using F5 I get the commnad screen and everything is working
my quesuon is -
how do I make this code a bat file so I can run this from every computer?
and if in the bat file I would see the full answer
!done ssid=test
!re…
!done…
Since you’re using Visual (Studio) Express, an executable is automatically generated when running the program (F5). Look in your project folder and then somewhere bin\Debug.
C# specific questions are not really aimed at this forum.. However, as explained in another post, there is a NuGet package tik4net which is much easier to use and eliminates 90% of your code.
Also, if you have code specific questions, you should post the relevant code
I still didn’t take a look at tik4net NuGet package - I’m a newbe at all this and I wanted to start from the easiest way.
would you say this package much more “user friendly” command way?
so to see I understand it correct
when I enter “true” after a command it’s like pressing “Enter”? or the “true” is like end of command? and I need to put it in the last command of send.mikrotik of the same command?
I have print and got ID=*5 - is there any way to print the info without knowing the ID ?
let say I replace wlan card -wouldn’t it change the ID?
something like [find where nambers=0]?
Effectively this sends a “null” character to the MT (connection.WriteByte(0)).
(Well, it seems that it will always send a null character regardless of the endsentence value, but I don’t think anyone will explicitly use endsentence = false in this function overload)
I don’t understand the question.
The command “print” is exactly the command you should make to get info without knowing the ID.
You can then use the acquired ID to make modifications in subsequent commands, if necessary.
But (as author of tik4net library) I have to recomend it
using tik4net;
// ...
// create and open connection first
using(var connection = ConnectionFactory.OpenConnection(TikConnectionType.Api, HOST, USER, PASS))
{
// update the wlan intrerface with ADO.NET like API
var updateCommand = connection.CreateCommandAndParameters("/interface/wireless/set",
"ssid", "test_ssid",
".id", "wlan1");
updateCommand.ExecuteNonQuery();
}
I’m sorry for the late response…
I had everything working - but then my computer stop working
and all my files + explaining + my own code gone
(I didn’t have any backup - I’m an IDIOT!)
I just need a reminder about setting new value
I’m still using the basic API in C# (I just needed it to work and after it I will try the tik4net library)
I got stuck here :