View Full Version : User-Utilities in thinAir
ReneMiner
05-10-2015, 09:07
I wish thinAir would have the ability to launch user-utilities on currently open script.
(see image)
the blue bordered box shows the thinAir-path on my C:\-Drive with some new created folder ("Utilities") inside.
There the users could place thinBasic-scripts or executeable files (custom utilities)
The content of this folder (.exe & .tBasic files) would be listed in thinAir-menu Tools\Utilities as the image shows
If click onto for example "myUtil.exe",
thinAir would shell this file and add the current scripts fullpath & -name (highlighted orange in titlebar of thinAir) as a command-parameter, so in this case it were alike
OS_Shell("C:\thinBasic\thinAir\Utilities\myUtil.exe C:\Users\René\Desktop\Documents\thinBasic\TBGL_Basics\testproject_009.tBasic" , _
%OS_WNDSTYLE_NORMAL, _
%OS_SHELL_ASYNC)
Of course thinAir should save all scripts before running the user-utility.
Would this be possible to implement?
ErosOlmi
05-10-2015, 21:28
Wow Renč,
I think you find the way I could implement thinAir scripting. I was searching for a way to use thinBasic language as a programming language for thinAir and you gave me the idea. Fantastic.
thinAir has already not documented way to execute scripting able to partially interact with thinAir.
For example if you open the following example and execute it using right click on its tab and then choose "Execute script inside thinAir" (see attached image) this will load the script not as a separated process but inside thinAir itself using thinCore.dll as an internal programming language (to give the idea ... similar to VBA for MS Office application). Doing that it it possible for thinAir to pass to the script some thinAir inside objects to which it is possible to interact.
I can use an XML format similar to thinAir script templates so we can add additional info to the script.
Great, thanks.
Next version will have it!
'---ThinAir scripting test
Uses "Console"
String sSep = String$(79, "-")
Long nMDI
Long lCounter
PrintL sSep
PrintL "App_Path :", APP_Path
PrintL "App_Path :", APP_Name
PrintL "App_SourcePath:", APP_SourcePath
PrintL "App_ScriptPath:", APP_ScriptPath
PrintL "App_ScriptName:", APP_ScriptName
PrintL sSep
nMDI = thinAir_MDI_Count
PrintL "Number of MDI:", nMDI
For lCounter = 1 To nMDI
PrintL "MDI", lCounter, ", file name:", thinAir_MDI_GetFullFileName(lCounter)
Next
PrintL sSep
PrintL "---press a key to close---"
WaitKey
ReneMiner
07-10-2015, 19:46
I hope you understood me correct :)
Another thought to it:
thinAir could shell the utilitiy also in %OS_SHELL_SYNC-mode and wait for the result. (Long mostly as TBMain() will return this type by default)
As simple as
Long lResult = OS_Shell("C:\thinBasic\thinAir\Utilities\Sync\myUtil.exe C:\Users\René\Documents\thinBasic\testproject_009.tBasic" , _
%OS_WNDSTYLE_NORMAL, _
%OS_SHELL_SYNC) _
If lResult And 1 Then
' >>> thinAir shall reload the script
Endif
If lResult And 2 Then
' >>> thinAir could reload the script and all included files
Endif
If lResult And &HF0000000 Then
' >>> restart thinAir
Endif
You might add other result flags as you have ideas...
if both %OS_SHELL_SYNC & %OS_SHELL_ASYNC are thinkeable then having two subfolders to shell from like
"C:\thinBasic\thinAir\Utilities" & { "\Sync" | "\Async" } were a simple way to select this.
ReneMiner
15-11-2015, 11:26
i would like very much if thinAir could react on a utilities exit-code
(so run SYNC to wait for a result)
2 more switches could be handy:
' proceed the reload-switches (if any) before this
If lResult And 4 then
' >> thinair shall execute the current script now
ElseIf lResult And 8 then
' >> thinair shall execute the current script in Debug-Mode
Endif
ReneMiner
28-11-2015, 13:36
Please -
it would be very useful and it's becoming more and more urgent for me to have thinAir being able to shell utilities on a current opened script.
In words:
I want to shell thinICE as a thinAir-utility from thinAir.
thinAir shall pass the current active script (filename, fullpath)
and wait in sync mode for thinICE to end, means no input into thinAir-codewindow possible for that time.
thinICE can give the following results to thinAir:
• no action
- - - - - - - - - - - - - - - - - - - - - - - -
• reload the current script
• reload all in thinAir open scripts | to current script included ones that are opened
- - - - - - - - - - - - - - - - - - - - - - - -
• execute the current script [F5] after reload
• debug current script [F8] after reload
- - - - - - - - - - - - - - - - - - - - - - - -
I still try to figure a way to shell helpfiles - only once per file and to close them when my script ends. Any ideas?
ReneMiner
08-01-2016, 12:28
I still hope for a way to integrate user-defined utilities to thinAir
so even if thinAir is not open source written in thinBasic itself, every user can add features to run them on current open script-unit or on the main-script (where user can read out more included units of course)
and to be able to return some orders to thinAir.
We could achive that as thinBasic.exe does:
user-utility has to place a result into some ini-file as for example
OS_GetSpecialFolder(%CSIDL_LOCAL_APPDATA) & "temp\thinAir_Utility.Log"
and if file exists thinAir will delete it and follow the order...
like:
[Reload]
thinAir=1
;' no other orders possible then (= restart thinAir)
;' but if thinAir=0 then
;' can simply list filenames as
File1=filename
File2=...
;' to be reloaded by thinAir
[Show]
;' thinAir shall display a certain scripts position:
File=filename
Line=xxx
CursorPos=xxx
;' and/or we could already select text in codewindow:
SelectionStart=xxx
SelectionEnd=xxx | SelectionLen=xxx
[Execute]
;' thinAir shall execute a script (after possible reload) :
File=filename
Debug=1
;' if Debug then Run as F8, else as F5 was pressed