本文整理汇总了C#中System.Script.runScript方法的典型用法代码示例。如果您正苦于以下问题:C# Script.runScript方法的具体用法?C# Script.runScript怎么用?C# Script.runScript使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Script
的用法示例。
在下文中一共展示了Script.runScript方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: run_selected_script
void run_selected_script()
{
script = new Script(checkBoxRedirectOutput.Checked);
script.runScript(selectedscript);
scriptrunning = false;
}
示例2: ScriptStart
void ScriptStart()
{
string myscript = @"
# cs.???? = currentstate, any variable on the status tab in the planner can be used.
# Script = options are
# Script.Sleep(ms)
# Script.ChangeParam(name,value)
# Script.GetParam(name)
# Script.ChangeMode(mode) - same as displayed in mode setup screen 'AUTO'
# Script.WaitFor(string,timeout)
# Script.SendRC(channel,pwm,sendnow)
#
print 'Start Script'
for chan in range(1,9):
Script.SendRC(chan,1500,False)
Script.SendRC(3,Script.GetParam('RC3_MIN'),True)
Script.Sleep(5000)
while cs.lat == 0:
print 'Waiting for GPS'
Script.Sleep(1000)
print 'Got GPS'
jo = 10 * 13
print jo
Script.SendRC(3,1000,False)
Script.SendRC(4,2000,True)
cs.messages.Clear()
Script.WaitFor('ARMING MOTORS',30000)
Script.SendRC(4,1500,True)
print 'Motors Armed!'
Script.SendRC(3,1700,True)
while cs.alt < 50:
Script.Sleep(50)
Script.SendRC(5,2000,True) # acro
Script.SendRC(1,2000,False) # roll
Script.SendRC(3,1370,True) # throttle
while cs.roll > -45: # top hald 0 - 180
Script.Sleep(5)
while cs.roll < -45: # -180 - -45
Script.Sleep(5)
Script.SendRC(5,1500,False) # stabalise
Script.SendRC(1,1500,True) # level roll
Script.Sleep(2000) # 2 sec to stabalise
Script.SendRC(3,1300,True) # throttle back to land
thro = 1350 # will decend
while cs.alt > 0.1:
Script.Sleep(300)
Script.SendRC(3,1000,False)
Script.SendRC(4,1000,True)
Script.WaitFor('DISARMING MOTORS',30000)
Script.SendRC(4,1500,True)
print 'Roll complete'
";
CustomMessageBox.Show("This is Very ALPHA");
Form scriptedit = new Form();
scriptedit.Size = new System.Drawing.Size(500,500);
TextBox tb = new TextBox();
tb.Dock = DockStyle.Fill;
tb.ScrollBars = ScrollBars.Both;
tb.Multiline = true;
tb.Location = new Point(0,0);
tb.Size = new System.Drawing.Size(scriptedit.Size.Width-30,scriptedit.Size.Height-30);
scriptedit.Controls.Add(tb);
tb.Text = myscript;
scriptedit.ShowDialog();
if (DialogResult.Yes == CustomMessageBox.Show("Run Script", "Run this script?", MessageBoxButtons.YesNo))
{
Script scr = new Script();
scr.runScript(tb.Text);
}
}
示例3: updateCameraLensIris
private void updateCameraLensIris()
{
//auto close camera lens for Canon S110
//check to see if 20 meters has been reached
if (MainV2.comPort.MAV.cs.alt > 20)
{
Reached50M = true;
CameraClosed = false; //assume the camera is open anytime above 50m..
//...fixes the issue of the camera not closing on any flight after the first because the program already thinks it is closed.
}
//close camera lens based on parameters
if (MainV2.comPort.MAV.cs.connected && MainV2.comPort.MAV.cs.alt < 10
&& CameraClosed == false && Reached50M == true
&& playingLog == false)
{
CameraClosed = true;
Script script = new Script();
script.runScript("ShutCamtrig.py");
//CustomMessageBox.Show("Camera lens closed because of low altitude!!!");
}
}
示例4: BUT_CloseLens_Click
private void BUT_CloseLens_Click(object sender, EventArgs e)
{
if (!MainV2.comPort.MAV.cs.connected)
{
CustomMessageBox.Show("Please connect first");
}
else
{
if (File.Exists("ShutCamtrig.py"))
{
//string closeLens = File.ReadAllText("ShutCamtrig.py");
Script script = new Script();
//MessageBox.Show(closeLens); //--test code
script.runScript("ShutCamtrig.py");
}
else
CustomMessageBox.Show("ERROR in BUT_CloseLens function (ShutCamtrig.py file was not found)");
}
}
示例5: ScriptStart
void ScriptStart()
{
string myscript = @"
print 'Start Script'
for chan in range(1,9):
Script.SendRC(chan,1500,False)
Script.SendRC(3,Script.GetParam('RC3_MIN'),True)
Script.Sleep(5000)
while cs.lat == 0:
print 'Waiting for GPS'
Script.Sleep(1000)
print 'Got GPS'
jo = 10 * 13
print jo
Script.SendRC(3,1000,False)
Script.SendRC(4,2000,True)
cs.messages.Clear()
Script.WaitFor('ARMING MOTORS',30000)
Script.SendRC(4,1500,True)
print 'Motors Armed!'
Script.SendRC(3,1700,True)
while cs.alt < 50:
Script.Sleep(50)
Script.SendRC(5,2000,True) # acro
Script.SendRC(1,2000,False) # roll
Script.SendRC(3,1370,True) # throttle
while cs.roll > -45: # top hald 0 - 180
Script.Sleep(5)
while cs.roll < -45: # -180 - -45
Script.Sleep(5)
Script.SendRC(5,1500,False) # stabalise
Script.SendRC(1,1500,True) # level roll
Script.Sleep(2000) # 2 sec to stabalise
Script.SendRC(3,1300,True) # throttle back to land
thro = 1350 # will decend
while cs.alt > 0.1:
Script.Sleep(300)
Script.SendRC(3,1000,False)
Script.SendRC(4,1000,True)
Script.WaitFor('DISARMING MOTORS',30000)
Script.SendRC(4,1500,True)
print 'Roll complete'
";
MessageBox.Show("This is Very ALPHA");
Form scriptedit = new Form();
scriptedit.Size = new System.Drawing.Size(500,500);
TextBox tb = new TextBox();
tb.Dock = DockStyle.Fill;
tb.ScrollBars = ScrollBars.Both;
tb.Multiline = true;
tb.Location = new Point(0,0);
tb.Size = new System.Drawing.Size(scriptedit.Size.Width-30,scriptedit.Size.Height-30);
scriptedit.Controls.Add(tb);
tb.Text = myscript;
scriptedit.ShowDialog();
if (DialogResult.Yes == MessageBox.Show("Run Script", "Run this script?", MessageBoxButtons.YesNo))
{
Script scr = new Script();
scr.runScript(tb.Text);
}
}