Scolring - Forum

Entraides et échanges autour de la technologie Scol - Informations and exchanges on the Scol technology

Vous pouvez changer la langue de l'interface une fois inscrit - You can change the language once registered

You are not logged in.

#1 27-Jul-2011 08:35:04

errichar
Member
Registered: 14-May-2011
Posts: 14

Problem creating a plugin to run .bat

Hi again, i have finished the pluging to use a database on Openspace and now im making a new one. I want to run a .bat file. I know that exist a plugit called exec but i cant make it work properly. anyone can explain me hoe to make this.

Thanks for all and in a few days i will upload the Mysqlplugin that i made. Sorry my poor english XD

Offline

#2 27-Jul-2011 09:59:43

iri
Admin. / Scol language & Scol apps developer
From: France
Registered: 22-Feb-2009
Posts: 2,024
Website

Re: Problem creating a plugin to run .bat

Hi,

For security reasons, Scol should not run any exe. But it can ... hmm

You must add your exe into the ext.ini file (at the root of Scol directory) :
- set a category (« launch » for example can be a good choice)
- set an alias
- set the path

Then use _refreshExe (Scol function) to reset your list of exes and _startExe to launch it (_startExe <category> <alias> <any arguments>)

Or, you could use the Scol function _addExe / _delExe.
I _addExe S P (fun [S P] I)
- the category
- the path (type P, so must be in the Scol partition)
- return 0 if ok, nil if an error occurs

You can list all alias (in a category) with _getExe.

errichar wrote:

i will upload the Mysqlplugin that i made.

Thanks a lot smile

Offline

#3 27-Jul-2011 11:55:19

iri
Admin. / Scol language & Scol apps developer
From: France
Registered: 22-Feb-2009
Posts: 2,024
Website

Re: Problem creating a plugin to run .bat

Basics examples ...
Launch MS Write from a Scol application on a MS Windows system.

1- Add "write.exe" to the ext.ini

[launch]
exe explore .
exe openExplorer explorer
exe write_a_text write

and here a Scol code to list available exe and to launch write.exe :

fun main ()=
    _showconsole;

    _refreshExe;
    _fooSList _getExe "launch";
    _startExe "launch" "write_a_text" nil;
    0;;

Note : if your exe (or a .bat, it is a same thing) is not in the PATH environment, then you must give the complete path
Note : you could give an argument : replace 'nil' in _startExe.


2- With _addExe :

the Scol code is :

fun main ()=
    _showconsole;
    
    _addExe "launch" _checkpack "tests/exe/write.exe";
    _refreshExe;
    _fooSList _getExe "launch";
    _startExe "launch" "write" nil;
    0;;

Note : the alias is automatically the name of the executable (without its extension)
Note : the executable must be in the Scol partition (so, for this example, i copied write.exe in this directory)
Note : the ext.ini becomes :

[launch]
exe explore .
exe openExplorer explorer
exe write_a_text write
exe write C:\\Program\ Files\\Scol\ Voyager\\Partition_LockedApp\\tools\\scolmeeting3\\write.exe

Note : the exe run on its process. So, if Scol is closed, the exe will not be exited

Offline

#4 27-Jul-2011 17:32:14

arkeon
Admin. / Scol language & OpenSpace3D developer
From: Nantes
Registered: 30-Mar-2009
Posts: 5,089
Website

Re: Problem creating a plugin to run .bat

Hi errichar !

the exec plugIT should work with the ext.ini updated properly as explain by Iri.

however this plugIT (and scol functions) only works when you use a local and stand alone application.
for security reason this is disabled when you access the application online (with the cache activated)

another solution is to pass by file:// url and the open url plugIT, this will show an alert to ask the user if he want to launch the link

I'm really interested to get your database plugIt to add it in the next release smile (if it is generic and with a free licence of course)

Offline

#5 27-Jul-2011 19:47:44

iri
Admin. / Scol language & Scol apps developer
From: France
Registered: 22-Feb-2009
Posts: 2,024
Website

Re: Problem creating a plugin to run .bat

... and the exe must be present in the system, of course !!

If a specific use, no problem, the exe should be in your system
If a distributed use, be careful smile

Offline

#6 29-Jul-2011 09:02:37

errichar
Member
Registered: 14-May-2011
Posts: 14

Re: Problem creating a plugin to run .bat

thanks to all big_smile  i will try it today.

Last edited by errichar (29-Jul-2011 09:03:08)

Offline

#7 4-Jul-2018 15:21:16

rasami
Member
Registered: 4-Jul-2018
Posts: 5

Re: Problem creating a plugin to run .bat

Hi,

I know I'm reopening a quite old thread but it's just I'm not able to find the Scol code that needs to be modified. I see nowhere any "fun main". hmm

So may I know that Scol file name in order to add other .exe files, pls? Should I modify the cexec plugIT? And I've already modified my ext.ini file.

Thanks a lot! smile

Last edited by rasami (4-Jul-2018 15:32:00)

Offline

#8 4-Jul-2018 15:29:34

arkeon
Admin. / Scol language & OpenSpace3D developer
From: Nantes
Registered: 30-Mar-2009
Posts: 5,089
Website

Re: Problem creating a plugin to run .bat

Hello,

if the ext.ini file in c:\program files(x86)\scol voyager\ is updated correctly the plugIt should list the available commands.
Be aware that windows 10 do not allow to modify a file directly in c:\program files(x86)
copy the file first on the desktop to modify it, then copy it back in the c:\program files(x86)\scol voyager\ folder

Offline

#9 4-Jul-2018 15:40:42

rasami
Member
Registered: 4-Jul-2018
Posts: 5

Re: Problem creating a plugin to run .bat

I've Windows 7 and it does show me new command in "Command to execute" but it doesn't launch the execution. sad
Here's the line I added in ext.ini:

xlsm fill_Sheet D:\x\x\Documents\x\OS3D_portable_assets\OS3D_portable\OpenSpace3D\os3D-vba.xlsm

This file isn't really .exe but a VBA macro. Does it impact anything? hmm

x represents name of my folders. I'd to hide them for privacy reasons. And you're super fast in replying! big_smile

Last edited by rasami (4-Jul-2018 15:41:12)

Offline

#10 4-Jul-2018 16:26:24

arkeon
Admin. / Scol language & OpenSpace3D developer
From: Nantes
Registered: 30-Mar-2009
Posts: 5,089
Website

Re: Problem creating a plugin to run .bat

if it's a vba macro just try to use it in command parameter of the default commands

Offline

#11 5-Jul-2018 07:57:55

rasami
Member
Registered: 4-Jul-2018
Posts: 5

Re: Problem creating a plugin to run .bat

I tried that one too. In the "Execute" link, I typed "os3d-osali.xlsm". In Logs, it does show me the full address path
"D:\x\x\Documents\x\OS3D_portable_assets\OS3D_portable\OpenSpace3D\os3D-vba.xlsm" but it ends up opening just "OS3D_portable" folder. This one was with "explore" as Command to execute but when I try with "openExplorer", it merely opens "My Documents" folder.

I've even looked at the plugit client PKG File. I guess the destination path for "execute" and "openExplorer" are constants. But, as I'm just a novice in SCOL, I've no idea where to modify. neutral

Offline

#12 5-Jul-2018 08:17:33

arkeon
Admin. / Scol language & OpenSpace3D developer
From: Nantes
Registered: 30-Mar-2009
Posts: 5,089
Website

Re: Problem creating a plugin to run .bat

to open a file with a special software, you need to call the executable file with the file in parameter.
in ext.ini

[launch]
exe explore .
exe openExplorer explorer
exe xlsm xlsm_program_path

then just set the file in command parameter in the plugit

Offline

#13 5-Jul-2018 09:00:07

rasami
Member
Registered: 4-Jul-2018
Posts: 5

Re: Problem creating a plugin to run .bat

Wow! I finally managed to do that!! big_smile
Thanks a lot!

Offline

#14 5-Jul-2018 09:15:14

arkeon
Admin. / Scol language & OpenSpace3D developer
From: Nantes
Registered: 30-Mar-2009
Posts: 5,089
Website

Re: Problem creating a plugin to run .bat

you're welcome!

Offline

#15 5-Jul-2018 14:43:31

iri
Admin. / Scol language & Scol apps developer
From: France
Registered: 22-Feb-2009
Posts: 2,024
Website

Re: Problem creating a plugin to run .bat

Hi,
They remain a security issue. I never liked this. But it can be convenient

Offline

Board footer

Powered by FluxBB