adBlocks Console Module

Share business templates, ideas, experiences, etc with fellow Servoy developers here

adBlocks Console Module

Postby jgarfield » Fri Sep 12, 2008 3:20 pm

I've had a few requests for an updated version of our console module. I'll be posting this updated version to our consulting page but thought it might be found by more people here.

We've tried to make it as extensible as possible so that you can add your own functionality to it as needed. If you have any questions about the console, how to use it, extend it, etc, please feel free to let me know.

Also, if you make any modifications, I would love to hear about them, and I'm sure the rest of the community would as well. So drop a post here and let us know what you've done!

Once you've imported the module into Servoy (it works in 3.5 and 4 as far as I know) just run the method 'showCosole' to bring it up. At adBlocks we bind that to a method that runs when we press ctrl+1, but there are plenty of other ways to use it (I believe Troy has the most interesting one I've seen).

Once at the console prompt, just type "help" and you should be well on your way.

Enjoy!
Attachments
console_module.servoy
(20.73 KiB) Downloaded 450 times
Programmer.
adBlocks
http://www.adblocks.com
jgarfield
 
Posts: 223
Joined: Wed Sep 28, 2005 9:02 pm
Location: Boston, US

Re: adBlocks Console Module

Postby Karel Broer » Fri Sep 12, 2008 3:33 pm

Thanks for sharing this excellent tool guys! I use the console for many years now and it's become a standard tool in the STB framework.
Loved the tips and tricks session at SW and looking forward to see you next year at SW'09!
Karel Broer
ServoyCamp - http://www.servoycamp.com
User avatar
Karel Broer
 
Posts: 779
Joined: Mon May 03, 2004 12:49 am
Location: Doetinchem

Re: adBlocks Console Module

Postby BenBaby » Fri Sep 12, 2008 3:49 pm

Thank you so much James - you guys rock!

Sincerely,

Ben
Ben Savignac
LOGIsoft
Servoy Alliance Network Partner
http://www.logisoft.qc.ca
BenBaby
 
Posts: 1
Joined: Wed Feb 06, 2008 1:54 pm

Re: adBlocks Console Module

Postby Karel Broer » Sun Sep 14, 2008 9:00 pm

I made a small method that shows you what plugins are installed (and some have version info with them too :D ):

Code: Select all
/********************************************************************************
   @method: view_plugins()

   @return:

   @description: show list of current plugins with (optional) version info

   @note:

   @history:   14/09/2008   Created by Karel Broer
********************************************************************************/

var vPlugins = plugins.allnames
vPlugins.sort();
var vText = ''
var vName
for(var i in vPlugins){
   vName = vPlugins[i]
   if(plugins[vName] && plugins[vName].getVersion){
      vText += vName + '&nbsp&nbsp<b>' + plugins[vName].getVersion() + '</b><br>'
   }
   else {
      vText += vName + '<br>'
   }
}

return vText

If you add this method on the _console form and type 'run view_plugins()' you'll see a nice list of plugs.
Have fun with it!
Karel Broer
ServoyCamp - http://www.servoycamp.com
User avatar
Karel Broer
 
Posts: 779
Joined: Mon May 03, 2004 12:49 am
Location: Doetinchem

Re: adBlocks Console Module

Postby david » Mon Sep 15, 2008 4:50 pm

One of our favorite tools. Thanks guys!
Attachments
Picture 75.png
Picture 75.png (163.35 KiB) Viewed 5523 times
David Workman, Kabootit

Image
Everything you need to build great apps with Servoy
User avatar
david
 
Posts: 1727
Joined: Thu Apr 24, 2003 4:18 pm
Location: Washington, D.C.

Re: adBlocks Console Module

Postby jgarfield » Tue Sep 16, 2008 12:05 am

Karel Broer wrote:I made a small method that shows you what plugins are installed (and some have version info with them too :D ):


If you'd like I've added modifications to the code to make this a command you can run directly from the console just by typing "plugins", instead of "run view_plugins()".

The trick mainly lies in naming the method in the form of console_commandNameHere

After that you just have to add in the logic for dealing with the syntax argument, and change the return text to be in oArg.result , and then return either true or false to indicate success or failure.

console_query is a good example of how to do some simple parsing for arguments, and how different returns work if you are interested.

Code: Select all
/********************************************************************************
   @method: console_plugins()

   @arg oArg
   @opt oArg.syntax

   @return:

   @description: show list of current plugins with (optional) version info

   @note:

   @history:   14/09/2008   Created by Karel Broer
   @history:   15/09/2008   Modified by James Garfield
********************************************************************************/

var oArg = arguments[0];

if (oArg.syntax)
{
   var oSyntax = new Object();
   oSyntax.description = "Display information about installed plugins"
   oSyntax.syntax = new Array();
   oSyntax.syntax.push('license');
   return oSyntax;
}

var vPlugins = plugins.allnames
vPlugins.sort();
var vText = ''
var vName
for(var i in vPlugins){
   vName = vPlugins[i]
   if(plugins[vName] && plugins[vName].getVersion){
      vText += vName + '&nbsp&nbsp<b>' + plugins[vName].getVersion() + '</b><br>'
   }
   else {
      vText += vName + '<br>'
   }
}

oArg.result = vText;

return true;
Programmer.
adBlocks
http://www.adblocks.com
jgarfield
 
Posts: 223
Joined: Wed Sep 28, 2005 9:02 pm
Location: Boston, US

Re: adBlocks Console Module

Postby Karel Broer » Tue Sep 16, 2008 7:47 am

jgarfield wrote:If you'd like I've added modifications to the code to make this a command you can run directly from the console just by typing "plugins", instead of "run view_plugins()".

Excellent modification James! Thanks a bunch! :D
Karel Broer
ServoyCamp - http://www.servoycamp.com
User avatar
Karel Broer
 
Posts: 779
Joined: Mon May 03, 2004 12:49 am
Location: Doetinchem


Return to Sharing Central

Who is online

Users browsing this forum: No registered users and 3 guests