Is this posible to do on Pine script 5, and how can I do it?
rule =
{
condition: randomCondition(),
action: randomAction()
}
I was trying to find the solution on pine script documentation but couldn't find the solution
Related
Specifically, I want to use the onSelectionChange(e) event to show a sidebar depending on what's in the selected cell. The problem is: the project I am working on is a standalone script. So I want to know if there is a way to use the onOpen event (for example) and check if the script is being run from a spreadsheet and somehow 'inject' the trigger.
I was trying something pretty much like in the documentation, but I never got it to fire, I guess because it was a standalone script.
const onSelectionChange = (e) => {
Logger.log(`onSelectionChange triggered: ${e.toString()}`);
const { range } = e;
if (range.getNumRows() === 1 && range.getNumColumns() === 1) {
range.setBackground('green');
}
};
So the actual solution for me was to create a new document with clasp. Using the command:
npx clasp create --type sheets --title "foo" --rootDir ./dist
and then uploading the script to this new project.
I need to execute workflow from command line that is already created using UI.
Already I have tried to invoke workflow by creating workflow instance.
the code shown below which is i was tried
XmlTextReader reader = new XmlTextReader("Workflow1.xml");
Console.WriteLine("Waiting for Workflow completion..");
WorkflowRuntime runtime = new WorkflowRuntime();
WorkflowInstance instance = runtime.CreateWorkflow(reader);
instance.Start();
but it shows the error message "xml tag is not framed well".
I have fully copied the workflow xaml content and pasted in Workflow1.xml file.
is there any other possibilities to achieve this.
Thanks in Advance.
It looks like you are using Windows Workflow 4, but you are trying to use the Windows Workflow 3 runtime to execute the workflow. I've got a white paper [1] on WF 4 that might be useful, but here's a snippet from that article that might be helpful. It uses the workflowInvoker class to execute the workflow. You can also use WorkflowApplication if you have long running workflows that need bookmarking capabilities.
Activity mathWF;
using (Stream mathXaml = File.OpenRead("Math.xaml"))
{
mathWF = ActivityXamlServices.Load(mathXaml);
}
var outputs = WorkflowInvoker.Invoke(mathWF,
new Dictionary<string, object> {
{ "operand1", 5 },
{ "operand2", 10 },
{ "operation", "add" } });
Assert.AreEqual<int>(15, (int)outputs["result"], "Incorrect result returned");
Developer's Introduction to Windows Workflow
I am trying to add a cron job in moodle block.
I am following this tutorial on moodle 3.0 https://docs.moodle.org/dev/Blocks#Responding_to_Cron
When I run /admin/cron.php, my cron job does not execute.
Am I missing anything here?
The old way uses cron like this:
/blocks/yourblockname/block_yourblockname.php
class block_yourblockname extends block_base {
...
public function cron() {
// Your code.
}
and in /blocks/yourblockname/version.php
$plugin->cron = xxxx; // Cron interval in seconds. 0 means no cron.
The new way is to use scheduled tasks - https://docs.moodle.org/dev/Task_API
UPDATE: As mentioned by #Developer
If you change the cron value or add a new task then you will also need to increment the version number
$plugin->version = xxxx;
I am new to Sahi and I am just trying to take a screenshot on script errors.
I have tried to used their demo and the script the website provides for the task, but the onScriptFailure doesn't seem to trigger. I added the alert box and changed the log in name to trigger a failure. Sorry if i'm missing something obvious.
function onScriptError($e){
_focusWindow();
_takeScreenShot();
_alert("test me");
}
onScriptFailure = onScriptError;
_navigateTo("http://sahi.co.in/demo/training/");
_setValue(_textbox("user"), "test");
_setValue(_password("password"), "secret");
_click(_submit("TriggerError"));
I was using Sahi Pro. I actually got the answer from their support department. This is what he had me do:
var onScriptError = function ($e) {
_focusWindow();
_takeScreenShot();
_alert("test me");
}
onScriptFailure = onScriptError;
_navigateTo("http://sahi.co.in/demo/training/");
_setValue(_textbox("user"), "test");
_setValue(_password("password"), "secret");
_click(_submit("TriggerError"));
HI You can use the GlobalInclude.sah file which has the code for the error handling.
you can edit this file to make the script behave according to your needs
Hello I'm trying to control FastHenry2 via Windows automation with Matlab.
I'm new to that topic. If I understood everything right I have to open it:
ax=actxserver('FastHenry2.Document');
and than run the function I want with the handle?
ax.Run('coils1.inp')
but that doesn't work. Matlab can't find Run and uses run instead, which is some build in Function not related at all with the problem. Also all other Function this UI should support don't work either. For Example FastHenry2.IsRunning or FastHenry2.GetInductance. So I guess I do something wrong with the whole UI handling. FastHenry provides an example script using VBS which I attached bellow and since it works fine FastHenry should be installed right on computer. I'm thankful for every hint I can get.
so long
eactor
The following VBS example works fine
Dim FastHenry2
pathPos = InstrRev(Wscript.ScriptFullName, Wscript.ScriptName)
path = left(Wscript.ScriptFullName, pathPos-1)
Set FastHenry2 = CreateObject("FastHenry2.Document")
couldRun = FastHenry2.Run("""" + path + "coils1.inp""")
Do While FastHenry2.IsRunning = True
Wscript.Sleep 500
Loop
inductance = FastHenry2.GetInductance()
WScript.Echo "Coils1 mutual inductance is " + CStr(inductance(0, 0, 1))
FastHenry2.Quit
Set FastHenry2 = Nothing
You might need to use an alternate syntax. Instead of
FastHenry2.Run('coils1.inp')
try this.
invoke(FastHenry2, 'Run', 'coils2.inp')
I've had to do this for some methods on the Excel.Application ActiveX control. I'm not clear why the first syntax doesn't work in some cases.