Torque

Forums

Forums

Guest  

Show or hide header
Welcome Guest, posting in this forum require registration.




Torque » Torque OBD ECU Scanner » Torque Discussion / Ideas » Scripting support

Pages: [1]
Author Topic: Scripting support
piemmm
Administrator
Posts: 6332
Post Scripting support
on: January 2, 2022 (GMT)

Hi!

It’s time to look into scripting!

Could those that are interested/requested this feature give me ideas of the things they would like the scripts to be able to do? (A use-case would be ideal!)

Capp777
Member
Posts: 2926
Post Re: Scripting support
on: January 3, 2022 (GMT)

Hi Piemmm,

I remember suggesting a .txt batch file
type capability where a text file contains
the OBD commands, a message box for user
instructions, pause or wait then more
commands.

The message box function provides specific
instructions to the user such as running
a test push this button/pedal, turn steering
wheel, etc.

Clear as mud right?

KOEO/KOER for instance.

Drive cycle instructions, etc.

— Sample .txt file —

Msgbox(“Cold Start below 120°F”, OK, CANCEL)

Msgbox(“Warm-up at idle”, OK, CANCEL)

Wait(8, m)

Beep()

Msgbox(“Accelerate to 55 mph at 1/2 throttle”, OK, CANCEL)

Msgbox(“Steady cruise at 55 mph for 3 minutes”, OK, CANCEL)

Wait(3, m)

Beep()

Msgbox(“Coast down to 20 mph without brake or clutch”, OK, CANCEL)

Next instruction, etc.

— — — —

OK to execute next step.

CANCEL to exit task.

Edited.

piemmm
Administrator
Posts: 6332
Post Re: Scripting support
on: January 6, 2022 (GMT)

OK – Some of this might make it’s way into the pushbutton to begin with then, as well as the equation parser to begin with.

Once I’ve finished with this version I’ll add it to the next beta update (it’s just in ‘bugfix mode’ at the moment for the next couple of updates before I work on the next ‘feature update’ where new stuff gets added)

Capp777
Member
Posts: 2926
Post Re: Scripting support
on: January 6, 2022 (GMT)

Bump for edits.

piemmm
Administrator
Posts: 6332
Post Re: Scripting support
on: January 7, 2022 (GMT)

Hi!

Ok, this will probably start appearing sometime near end of next week in pushbutton to start with, then the equation parser later on. It’ll be in beta for a while so I have time to get things right. Right now I’m finalising .254 which is looking like a good release

(But we’ll leave VisualBasic at the door….)

piemmm
Administrator
Posts: 6332
Post Re: Scripting support
on: January 14, 2022 (GMT)

This is mostly done now and is configurable via the pushbutton in the usual way – I need to write some documentation on the wiki before I release the beta

A side effect is that there are also now ‘core’ scripts in the main part of the app as well (accessible through the settings in a ‘Manage Scripts’ pane similar to the ‘Manage extra PIDs/sensors’ pane) – this will also be making it’s way into the beta

piemmm
Administrator
Posts: 6332
Post Re: Scripting support
on: January 18, 2022 (GMT)

Hi!

I’ve started documenting this now:

https://wiki.torque-bhp.com/view/Scripting

to get an idea of how it’s going to look – look at the pushbutton class as it at least contains a very, very quick example

You get modal/blocking dialogs too

Capp777
Member
Posts: 2926
Post Re: Scripting support
on: January 21, 2022 (GMT)

Tried using your example script but unable
to save.

/storage/emulated/0/Andriod/data/

org.prowl torque/files/buttonScripts:
open failed:

EISDIR (is a directory)

Tab S6 Lite
SM-P610
Android 11

piemmm
Administrator
Posts: 6332
Post Re: Scripting support
on: January 21, 2022 (GMT)

Hi!

That should be fixed in 1.12.4 (the latest update today) as the editor had a few issues – I’d been editing on the computer so didn’t see these but they should all be sorted out now

Capp777
Member
Posts: 2926
Post Re: Scripting support
on: January 24, 2022 (GMT)

Could you please include a working example
of a dialog popup in the pushbutton default
script? I trying to teach myself Java programming
as I go, but am struggling.

Noticed I had to leave dashboard then back again
to see more detailed error message.

Thanks for adding the scripting features.

Can’t wait to see other’s working scripts.

piemmm
Administrator
Posts: 6332
Post Re: Scripting support
on: January 25, 2022 (GMT)

Hi!

It’s “not quite java” but close – the OO approach (when coming from structured programming) does take a little time to get your head around it, but it is very much worth the effort! :) there’s more info here: https://commons.apache.org/proper/commons-jexl/reference/syntax.html

Also there’s now a pushbutton demo at the bottom of: https://wiki.torque-bhp.com/view/Scripting

You’ll want 1.12.10 (out in an hour or so) before it’ll work properly though as I discovered a small issue on some devices

Pages: [1]
WP-Forum by: Fredrik Fahlstad, Version: 2.4
Page loaded in: 0.047 seconds.

  Follow me on twitter