How to use external tools from AkelPad?
- Author
- Message
-
Offline
- Posts: 61
- Joined: Thu Feb 04, 2016 5:27 am
How to use external tools from AkelPad?
I want use the FreeBASIC compiler directly from AkelPad
ie an option to execute or compile the current file on AkelPad with FreeBASIC.
by example Programmer's Notepad have a Tools option to do it.
How i can do something like that on AkelPad?
ie an option to execute or compile the current file on AkelPad with FreeBASIC.
by example Programmer's Notepad have a Tools option to do it.
How i can do something like that on AkelPad?
-
Offline
- Posts: 1161
- Joined: Sun Oct 20, 2013 11:44 am
c-sanchez
Log plugin? Example: XMLStarlet.
Log plugin? Example: XMLStarlet.
%f - active file
%d - directory of active file
%a - AkelPad's directory (i.e. contains AkelPad.exe)
%% - % symbol
%system variable% (i.e. environment variable)
-
Offline
- Posts: 61
- Joined: Thu Feb 04, 2016 5:27 am
Please show me how i can setup log pluginSkif_off wrote:Log plugin? Example: XMLStarlet.
by ex. having freebasic compiler on C:\freebasic\fbc.exe
and a test.bas on any directory as D:\example\hello.bas
on this case the command to compile on frebasic is:
C:\freebasic\fbc.exe D:\example\hello.bas
so i guess the equivalent on log will be something like
C:\freebasic\fbc.exe %f
i don't have idea how i can do that.
what file i need create? is possible add own icons on akelpad with custom operations also?
other details, the log file can check if the current file is or not saved?
because if not, then it can't compile nothing. but maybe can something more as a quick run (temporary compilation and run)
have other variables? like current file without extension, current file extension, etc.
-
Offline
- Posts: 1250
- Joined: Thu Nov 16, 2006 11:53 am
- Location: Kyiv, Ukraine
A script RunMe.js ( http://akelpad.sourceforge.net/forum/vi ... 3010#13010 ) could be used for this.
The file RunMe.js must be placed under AkelPad's Plugs\Scripts subfolder and can be started via the Scripts plugin.
And I usually assign 2 shortcuts for it in the Hotkeys plugin, e.g.:
In addition to this, the nature of the RunMe.js assumes each new external tool/compiler support needs to be added manually.
In case of FreeBasic, the following needs to be added:
1. Find the "var oCommands = {" part of RunMe.js and add the following there (for example, before the line "bat cmd"):
2. Then, under "// user-defined functions...", add:
The file RunMe.js must be placed under AkelPad's Plugs\Scripts subfolder and can be started via the Scripts plugin.
And I usually assign 2 shortcuts for it in the Hotkeys plugin, e.g.:
Code: Select all
Run | Call("Scripts::Main", 1, "RunMe.js") | Ctrl + F9
Run2 | Call("Scripts::Main", 1, "RunMe.js", "1") | Ctrl + Shift + F9
In case of FreeBasic, the following needs to be added:
1. Find the "var oCommands = {" part of RunMe.js and add the following there (for example, before the line "bat cmd"):
Code: Select all
"bas" :
":run_bas(\"%f\")" ,
Code: Select all
function run_bas(filePathName, args) // 'args' is optional
{
var dir = getFileDir(filePathName);
var fileNameExt = getFileNameExt(filePathName);
var cmd = buildCommandWithOptionalArgs("C:\\freebasic\\fbc.exe \"" + fileNameExt + "\"", args);
runCommand(cmd, dir);
}
-
Offline
- Posts: 1161
- Joined: Sun Oct 20, 2013 11:44 am
FAQ and AkelFiles\Docs\Log-Eng.txt.c-sanchez wrote:Please show me how i can setup log plugin
Most simple: Plugins > Log view > Output panel: button Run... http://fs5.directupload.net/images/170217/ljyutwy3.png
Or you can add menu item (like FreeBASIC item).
I think file must be saved (or it can be saved automatic before run).c-sanchez wrote:other details, the log file can check if the current file is or not saved?
Maybe VBS- or JS-script, like thisc-sanchez wrote:but maybe can something more as a quick run (temporary compilation and run)
have other variables? like current file without extension, current file extension, etc.
P.S. Some functions: GetExecExitCode(), GetExecState(), GetOutputWindowText() and SaveLineScroll()/RestoreLineScroll().
-
Offline
- Posts: 61
- Joined: Thu Feb 04, 2016 5:27 am
Thanks DV this work, although i need say this is not "friendly with the user" hehe, but is ok, works for what i need.DV wrote:A script RunMe.js ( http://akelpad.sourceforge.net/forum/vi ... 3010#13010 ) could be used for this.
The file RunMe.js must be placed under AkelPad's Plugs\Scripts subfolder and can be started via the Scripts plugin.
And I usually assign 2 shortcuts for it in the Hotkeys plugin, e.g.:In addition to this, the nature of the RunMe.js assumes each new external tool/compiler support needs to be added manually.Code: Select all
Run | Call("Scripts::Main", 1, "RunMe.js") | Ctrl + F9 Run2 | Call("Scripts::Main", 1, "RunMe.js", "1") | Ctrl + Shift + F9
In case of FreeBasic, the following needs to be added:
1. Find the "var oCommands = {" part of RunMe.js and add the following there (for example, before the line "bat cmd"):2. Then, under "// user-defined functions...", add:Code: Select all
"bas" : ":run_bas("%f")" ,
Code: Select all
function run_bas(filePathName, args) // 'args' is optional { var dir = getFileDir(filePathName); var fileNameExt = getFileNameExt(filePathName); var cmd = buildCommandWithOptionalArgs("C:\\freebasic\\fbc.exe "" + fileNameExt + """, args); runCommand(cmd, dir); }
I've tried that, but i got this error Can't execute command: D:\FreeBASIC\fbc.exe "f"Skif_off wrote:FAQ and AkelFiles\Docs\Log-Eng.txt.c-sanchez wrote:Please show me how i can setup log plugin
Most simple: Plugins > Log view > Output panel: button Run... http://fs5.directupload.net/images/170217/ljyutwy3.png
Or you can add menu item (like FreeBASIC item).
I think file must be saved (or it can be saved automatic before run).c-sanchez wrote:other details, the log file can check if the current file is or not saved?
Maybe VBS- or JS-script, like thisc-sanchez wrote:but maybe can something more as a quick run (temporary compilation and run)
have other variables? like current file without extension, current file extension, etc.
P.S. Some functions: GetExecExitCode(), GetExecState(), GetOutputWindowText() and SaveLineScroll()/RestoreLineScroll().
i don't understand why occurs, ie to compile a freebasic file in this case you need only "freebasic patch" + "file.bas patch"
sorry for my ignorance.
Thanks one more time by the help provided folks!
-
Offline
- Posts: 61
- Joined: Thu Feb 04, 2016 5:27 am
Nothing, same problemSkif_off wrote:c-sanchez
Sorry, I don't use this dialog Try double %: "%%f" and "%%d".
https://s6.postimg.org/5api7hoj5/log_fb.gif
-
Offline
- Site Admin
- Posts: 6311
- Joined: Thu Jul 06, 2006 7:20 am
c-sanchez
Use the next command via ContextMenu, Hotkeys or ToolBar plugin:
Use the next command via ContextMenu, Hotkeys or ToolBar plugin:
Code: Select all
Call("Log::Output", 1, `"D:\FreeBASIC\fbc.exe" "%f"`, "%d")
-
Offline
- Posts: 61
- Joined: Thu Feb 04, 2016 5:27 am
Thank you very much Instructor! it's just what I was looking for
I wonder if can you explain me some things about this command
Call("Log::Output", 1, `"D:\FreeBASIC\fbc.exe" "%f"`, "%d")
What is the 1 on this command?
why the simple quotes?
I can assume the simple quotes are for specify is an command using several things at same time, on this case, ' "freebasic compiler" + "current file" '
I'm right?
I want make the following things from akelpad:
1* Compile a file directly from this, now possible with your command
2* Run a compiled file directly too, so by ex. instead run test.bas we will run/open test.exe
Based on your command I ve tried with:
Call("Log::Output", 1, `"" "%n.exe"`, "%d")
assuming %n is the current file without extension, but i can see this don't works.
So how i can make this?
3* Compile and then run current file, I don't know if possible make this directly with some command via log. It is?
* 4. How i can customize the main menu? (File, Edit, View, Options, Window, Help)
I know thanks to ContextMenu Plugin i can customize several menus, but i can only hide the main menu, i can't modify this.
I would like to add my own menu "Build" and on this "Compile, Run, Compile and Run, etc"
I must say that the way on how flexible/customizable is akelpad and also well done, is really incredible, wonderful.
But well, everyone here know this
I wonder if can you explain me some things about this command
Call("Log::Output", 1, `"D:\FreeBASIC\fbc.exe" "%f"`, "%d")
What is the 1 on this command?
why the simple quotes?
I can assume the simple quotes are for specify is an command using several things at same time, on this case, ' "freebasic compiler" + "current file" '
I'm right?
I want make the following things from akelpad:
1* Compile a file directly from this, now possible with your command
2* Run a compiled file directly too, so by ex. instead run test.bas we will run/open test.exe
Based on your command I ve tried with:
Call("Log::Output", 1, `"" "%n.exe"`, "%d")
assuming %n is the current file without extension, but i can see this don't works.
So how i can make this?
3* Compile and then run current file, I don't know if possible make this directly with some command via log. It is?
* 4. How i can customize the main menu? (File, Edit, View, Options, Window, Help)
I know thanks to ContextMenu Plugin i can customize several menus, but i can only hide the main menu, i can't modify this.
I would like to add my own menu "Build" and on this "Compile, Run, Compile and Run, etc"
I must say that the way on how flexible/customizable is akelpad and also well done, is really incredible, wonderful.
But well, everyone here know this
-
Offline
- Posts: 61
- Joined: Thu Feb 04, 2016 5:27 am
Haha yeah, i'm sorry, I just read it now, I've answered that question myselfopk44 wrote:what's a problem to read here: "\AkelFiles\Docs\Log-Eng.txt" ?
Althought i can't view modificable the default menu, i found is possible add custom entries on menu also* 4. How i can customize the main menu? (File, Edit, View, Options, Window, Help)
I know thanks to ContextMenu Plugin i can customize several menus, but i can only hide the main menu, i can't modify this.
I would like to add my own menu "Build" and on this "Compile, Run, Compile and Run, etc"
I must say that the way on how flexible/customizable is akelpad and also well done, is really incredible, wonderful.
But well, everyone here know this
-
Offline
- Posts: 1250
- Joined: Thu Nov 16, 2006 11:53 am
- Location: Kyiv, Ukraine
It's possible using the RunMe.js, applying the same technique as the one used in the RunMe's function run_pas.c-sanchez wrote:3* Compile and then run current file
E.g.
Code: Select all
function run_bas(filePathName, args) // 'args' is optional
{
var cmd1 = "C:\\freebasic\\fbc.exe "%n.%e""; // <-- compile
var cmd2 = buildCommandWithOptionalArgs(""%n.exe"", args); // <-- run
var cmd = "cmd /c " + cmd1 + " && " + cmd2;
cmd = substituteVars(cmd, filePathName); // pre-process %f, %n etc.
runCommand(cmd, getFileDir(filePathName));
}
-
Offline
- Posts: 61
- Joined: Thu Feb 04, 2016 5:27 am
Thanks DV! I'll try with RunMe.js and your function
Although i think then this can be a feature request for log plugin.
mm, maybe we can call this as "some option to run batch process"?
i guess RunMe.js is an good option, but i think don't have muchsense, ie use scripts for everything if possible make what you need with plugin directly.
----
I managed to adjust akelpad more to what I was looking for, something like an "IDE"
Click on image to enlarge it.
Now i want make some "global variable" saving the compiler path.
So instead setup the path for everything (Toolbar, Context Menu, Shortcut Keys), save on a one site (the "global variable"?) and put this on all the corresponding elements.
Can any one help me with this?
And they really forgive my abuse by asking for so much help for everything.
Regards.
Although i think then this can be a feature request for log plugin.
mm, maybe we can call this as "some option to run batch process"?
i guess RunMe.js is an good option, but i think don't have muchsense, ie use scripts for everything if possible make what you need with plugin directly.
----
I managed to adjust akelpad more to what I was looking for, something like an "IDE"
Click on image to enlarge it.
Now i want make some "global variable" saving the compiler path.
So instead setup the path for everything (Toolbar, Context Menu, Shortcut Keys), save on a one site (the "global variable"?) and put this on all the corresponding elements.
Can any one help me with this?
And they really forgive my abuse by asking for so much help for everything.
Regards.
-
Offline
- Posts: 61
- Joined: Thu Feb 04, 2016 5:27 am
Hi! long time without touch this for akelpad, I apologize for reopening the topic but I have a question.
it is usually %n but this don't works on my tests.
I've searched the documentation but I can't find what I'm looking for.
Have akelpad some method to check active file without extension?Skif_off wrote:c-sanchez
Log plugin? Example: XMLStarlet.%f - active file
%d - directory of active file
%a - AkelPad's directory (i.e. contains AkelPad.exe)
%% - % symbol
%system variable% (i.e. environment variable)
it is usually %n but this don't works on my tests.
I've searched the documentation but I can't find what I'm looking for.