topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Saturday December 14, 2024, 7:02 am
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Last post Author Topic: Qatapult  (Read 361331 times)

ecaradec

  • Honorary Member
  • Joined in 2006
  • **
  • Posts: 410
    • View Profile
    • Blog & Projects
    • Read more about this member.
    • Donate to Member
Re: Qatapult
« Reply #225 on: March 07, 2012, 06:50 AM »
Sorry for the strange previous response. I typed it on my phone, so it's a bit weird.  :P. I forgot to address some of your questions :

- For the input field I probably forgot to use the specified fontsize and color. I'll fix that.
- About 4, I'll give you a way to enumerate what is available inside the objects. Until that you can watch in the database too : anything that's available as a string in the DB is available via getArgValue. There are some properties that are deduced like rpath and rdirectory but there are only a few.
Blog & Projects : Blog | Qatapult | SwiffOut | FScript

ecaradec

  • Honorary Member
  • Joined in 2006
  • **
  • Posts: 410
    • View Profile
    • Blog & Projects
    • Read more about this member.
    • Donate to Member
Re: Qatapult
« Reply #226 on: March 07, 2012, 04:35 PM »
I tried a small test adding a background to the pigeonlips skin to test the new transparent results and it looks nice so I'm sharing it for just that reason. The picture is from here http://photography.n...ranean-sea-swimming/ I picked it a bit randomly on the internet.
Blog & Projects : Blog | Qatapult | SwiffOut | FScript

pigeonlips

  • Participant
  • Joined in 2011
  • *
  • Posts: 69
    • View Profile
    • Donate to Member
Re: Qatapult
« Reply #227 on: March 07, 2012, 04:53 PM »
For now here's a *cough* better version on the skin.

This skin is my first time ever using js so please point out anything that's wrong. Its but fugaly (code wise) but it does get closer to that "alfred app" experience.

Found out how to get the extended properties of a file.

Bashed my head against a wall trying to get data out of id3 tags, so for now album art only works if you have a cover.jpg in the folder of the mp3s listed. Lucky me i always have this. I need to include a library to get this done right but at the moment thats a little advanced for me.  Any tips around this will save me a lot off googleing

Also the extended property index of a file differ for windows OS (win Xp, 2000, vista, 7) so they need to be changed. I'll write a skin for each version, but can only test on xp.

I was using info from http://www.kixtart.o...at&Number=201630 to get them.

its still very rough but my heart isn't in getting it to look slick until it can be something other than white.

You post gives me hope. It looks nice. I cannot wait to try it out - let me know when its ready and how to set the transparency. Then i'll add tons more polish and finish it off.

If you just after the js (dont think the images changed):

Spoiler
var skin         ="skins\\alfred-like\\";
var SkinWidth      =500;
var SkinHeight      =300;
var SkinBorder      =10;

function draw(ui)
{
   // set the text color
   ui.textcolor   =0x88000000;
   ui.fontsize   =12;
   
   // draw the canvas
   ui.drawBitmap(skin+"background.png", 0, 0, SkinWidth, SkinHeight);
   
   //  >  ----------------------------------------------------------
   //  > I mieght make this bigger one day
   //  >  ----------------------------------------------------------
   ui.drawInput(30,42,SkinWidth-((SkinBorder+10)*2),15);
   
   // now draw the items - pane one
   if(qatapult.argscount==1)
   {
      drawItem(ui,0, SkinBorder + 20, SkinHeight - 47, 150, 36);
      //ui.drawBitmap(skin+"next.png",190,SkinHeight - 37, 15, 15);
   }
   // now draw the items - pane two
   if (qatapult.argscount==2)
   {
      drawItem(ui,0, SkinBorder + 20, SkinHeight - 47, 150, 36);
      drawItem(ui,1, SkinBorder + 200, SkinHeight - 47, 150, 36);
      ui.drawBitmap(skin+"next.png",190,SkinHeight - 37, 15, 15);   
   }
   // now draw the items - pane three
   if (qatapult.argscount==3)
   {
      drawItem(ui,0, SkinBorder + 20, SkinHeight - 47, 150, 36);
      drawItem(ui,1, SkinBorder + 200, SkinHeight - 47, 150, 36);
      drawItem(ui,2, SkinBorder + 350, SkinHeight - 47, 150, 36);
      ui.drawBitmap(skin+"next.png",340,SkinHeight - 37, 15, 15);
   }
   
   // draw results box
   if(qatapult.resultscount!=0)
   {
      var resultscount=Math.min(5,qatapult.resultscount);
      // >  ----------------------------------------------------------
      // >  new version might allow the background or color of the results box
      // >  to change - revisit if this happens as we need to set it here
      //  >  ----------------------------------------------------------

      ui.drawResults(SkinBorder,65,(SkinWidth/2) - SkinBorder,SkinHeight -(100+SkinBorder));
      
      if (qatapult.resultscount>4)
      {
         ui.fontsize   =   8;
         ui.drawText("... arrow down for more ...", SkinBorder,SkinHeight -(57+SkinBorder),(SkinWidth/2) - SkinBorder, 15);
      }
   }   
   else
   {
      ui.drawText("start typing ..... ", SkinBorder * 2 ,190,200,50);
   }
   
   if(qatapult.argscount>1)
   {
      // whats the type?
      type = qatapult.getArgValue(0, "type");
      
      if (type == "TEXT")
      {         
         // display the image of the object
         ui.drawBitmap("icons\\edit.png",320 ,65, 107, 91);

         // set text size and color
         ui.fontsize   =   14;
         ui.textcolor   =   0x88000000;
      
         // display the heading of the object
         ui.drawText("free text", SkinWidth/2 + SkinBorder,160,200,25);
         // reset the size
         ui.fontsize   =   8;
         ui.textcolor   =0x88000000;
         
         // display the text info about the object
         ui.drawText(qatapult.getArgValue(0, "status"), SkinWidth/2 + SkinBorder,190,200,50);
         
         /*
         // the first result at the bottom in free text is white. ? Add it here instead.
         ui.drawText(status, SkinBorder + 20,SkinHeight - 47, 150, 36);
         */
      }
      if (type == "WINDOW")
      {
         // set text size and color
         ui.fontsize   =   8;
         ui.textcolor   =   0x88000000;
         
         // draw the frame - this can be used for images or something.
         ui.drawBitmap(skin+"frame.png",320 ,65, 107, 91);
         
         // display some info in text
         winTitle       = qatapult.getArgValue(0, "title");
         winHWD       = qatapult.getArgValue(0, "hwnd");
         text       = qatapult.getArgValue(0, "text");
         ui.drawText(winTitle, SkinWidth/2 + SkinBorder,160,200,15); // seams static in the wrong position ?
         ui.drawText("Windows Handle : "+winHWD, SkinWidth/2 + SkinBorder,180,200,15); // seams centered?
         ui.fontsize   =   12;
      }
      if (type == "FILE")
      {
         var heading    =    "";
         var picture    =    "";
         var item1    =    "";
         var item2    =    "";
         var item3    =    "";

         var fileext   =    "";
      
         // what is the file and where is it. We'll need this most of the time in the if statements below. Get it early then.
         filedir = qatapult.getArgValue(0, "directory")
         filename = qatapult.getArgValue(0, "filename")
         
         // Time to work out the extention. WIth this we can target the best properties of an object to display
         fileext = filename.substring(filename.length,filename.length-4);
         // lower case the extension then it doesnt matter is its .xxx or .XXX or .XxX - we still know it
         fileext = fileext.toLowerCase()

         if ((fileext == ".png")||(fileext == ".jpg")||(fileext == ".bmp"))
         {
            heading    =    "Image";
            picture    =    filedir+"\\"+filename;
            
            // draw the picture border
            //ui.drawBitmap(skin+"frame.png",316 ,61, 116, 100);

            item1    =    "";
            item2    =    "";
            item3    =    "";
         }
         else if (fileext == ".mp3")
         {
            heading    = "Audio";
            // cheap but luckly me i keep cover.jpg in my music folders. - would be nice to rip the thumb from the id3 tag.
            // ui.drawBitmap(skin+"frame.png",316 ,61, 116, 100);
            picture    =    filedir+"\\cover.jpg";
            
            // now lets get the extended properties of the file.
            // these vaules are diffrent for XP win 7 and vista. Need to make seprate skins for this.
            // http://www.kixtart.o...at&Number=201630            
            var ARTIST_NAME    =    16; // Win7 use 216
            var ALBUM_TITLE    =    17; // Win7 use 14
            var YEAR          =    18; // Win7 use 15

            // need the filename to be an object!
            var oShell        =    new ActiveXObject("Shell.Application");
            var oFolder       =    oShell.Namespace(filedir);
            var oFile         =    oFolder.ParseName(filename);
                        
            item1   =   "Artist : "    + oFolder.GetDetailsOf(oFile, ARTIST_NAME);
            item2   =   "Album: "      + oFolder.GetDetailsOf(oFile, ALBUM_TITLE);
            item3   =   "Year: "      + oFolder.GetDetailsOf(oFile, YEAR);
   
         }
         else if (fileext == ".lnk")
         {
            heading    =    "Shortcut";         
            item1   =   qatapult.getArgValue(0, "rfilename");
            item2   =   qatapult.getArgValue(0, "rdirectory");            
         }
         else if (fileext == ".exe")
         {   
            heading = filename;
            // now lets get the extended properties of the file.
            // these vaules are diffrent for XP win 7 and vista. Need to make seprate skins for this.
            // http://www.kixtart.o...at&Number=201630            
            var COMPANY_NAME    =    35;
            var FILE_VERSION    =    37; // Win7 use 156
            var PROGRAM_DESC    =    30;

            // need the filename to be an object!
            var oShell     =   new ActiveXObject("Shell.Application");
            var oFolder    =    oShell.Namespace(filedir);
            var oFile      =    oFolder.ParseName(filename);
            
            item1   =   "Company Name : "       + oFolder.GetDetailsOf(oFile, COMPANY_NAME);
            item2   =   "File Version : "      + oFolder.GetDetailsOf(oFile, FILE_VERSION);
            item3   =   "Description : "      + oFolder.GetDetailsOf(oFile, PROGRAM_DESC);
         }
         else
         {
            // now lets get the extended properties of the file.
            // these vaules are diffrent for XP win 7 and vista. Need to make seprate skins for this.
            // http://www.kixtart.o...at&Number=201630            
            var FILE_TYPE       =    2;
            var DATE_CREATED    =    4; // Win7 use 156
            var FILE_SIZE          =    1;
            var ATTRIBUTES    =    6;

            // need the filename to be an object!
            var oShell     =    new ActiveXObject("Shell.Application");
            var oFolder    =    oShell.Namespace(filedir);
            var oFile      =    oFolder.ParseName(filename);
            
            heading       =    oFolder.GetDetailsOf(oFile, FILE_TYPE);      
            item1      =   "Created : "       + oFolder.GetDetailsOf(oFile, DATE_CREATED);
            item2      =   "Size : "         + oFolder.GetDetailsOf(oFile, FILE_SIZE);
            item3      =   "Attributes : "      + oFolder.GetDetailsOf(oFile, ATTRIBUTES);
         }

         // Draw the properties of the object for type FILE depending on whats been set above
         
         // display the image of the object
         if (picture !="")
         {
            ui.drawBitmap(picture,320 ,65, 107, 91);
         }
         else
         {
            drawItem(ui,0,320 ,65, 107, 91);
         }
         
         // set text size and color for header
         ui.fontsize   =   14;
         ui.textcolor   =   0x88000000;
      
         // display the heading of the object
         ui.drawText(heading, SkinWidth/2 + SkinBorder,160,200,25);
         
         // reset the size for the rest
         ui.fontsize   =   8;
         ui.textcolor   =   0x88000000;
         
         // display the text info about the object
         ui.drawText(item1, SkinWidth/2 + SkinBorder,190,200,15);
         ui.drawText(item2, SkinWidth/2 + SkinBorder,210,200,15);
         ui.drawText(item3, SkinWidth/2 + SkinBorder,230,200,15);
      }
      else
      {
         drawItem(ui,0,320 ,65, 107, 91);
      }
}

   // draw the menu button
   ui.drawBitmap(skin+"ui-radio-button.png", SkinWidth-33, SkinBorder+2, 16, 16);

    // drawn index progress
    ui.fontsize   =   8;
    ui.textcolor   =   0x88000000;
    if(qatapult.crawlprogress!=0 && qatapult.crawlprogress!=100)
        ui.drawText("Updating index : "+qatapult.crawlprogress+"%",SkinBorder,SkinBorder,SkinWidth-(SkinBorder*2),15)

      
   // this drew status line - opting out of this as i dont know where to put it at the moment
   /*
   var focus=qatapult.getFocus();
   ui.drawEmphased(qatapult.getArgValue(focus,"status"),qatapult.getQuery(focus),15,SkinHeight-20,SkinWidth-30,10);
   */
   
   
   // determine the mode - will add support for this later.
   /*
    if(qatapult.textmode)
    {
        //ui.drawBitmap(skin+"textbackground.png", 0, 0, 350, 200);
        //ui.drawInput(25,25,305,138);
        //height=200;
    }
    else
    {
        //ui.textcolor=0xFF000000;
        // draw the background according to the number of current args
        if(qatapult.argscount<3)
      {
            //ui.drawBitmap(skin+"background.png", 0, 0, 350, 120);
            //height=120;
        }
      else
      {
            //ui.drawBitmap(skin+"background_3.png", 0, 0, 350, 170);
            //height=170;
        }
    }
    */
}

function drawItem(ui,i,x,y,w,h)
{    
    if(qatapult.getArgValue(i,"type")=="TEXT")
    {
      // HELP >  ----------------------------------------------------------
      // HELP > free text always appears in white. Dont know how to set the color?
      // ui.drawItem(i,x+5,y+5,w-10,h-20);
    }
    else
    {
        // draw the item visual and draw it's label below
        ui.drawItem(i,x+2,y+2,h-4,h-4);
        var text   =   "";
        //if(qatapult.getArgValue(i,"email")!="")
          //  var text=" <"+qatapult.getArgValue(i,"email")+">";
        ui.drawEmphased(qatapult.getArgValue(i,"text")+text,qatapult.getQuery(i),x+h,y+10,w-2*h,30);
    }
}

//   ui.drawBitmap(skin+"ui-radio-button.png", SkinWidth-33, SkinBorder+2, 16, 16);
function onClick(x,y)
{
    if(x > SkinWidth-33 && x < SkinWidth-17 && y > SkinBorder + 2 && y < SkinBorder + 18)
        qatapult.showmenu(x,y);
}


ecaradec

  • Honorary Member
  • Joined in 2006
  • **
  • Posts: 410
    • View Profile
    • Blog & Projects
    • Read more about this member.
    • Donate to Member
Re: Qatapult
« Reply #228 on: March 07, 2012, 05:06 PM »
That's a very impressive work for a newcomer to javascript.

I've also added a few things to allow path trimming (... inside the middle of the path instead of the end ) and a textrendering hint that allow you to use full antialias or grid fit that looks darker on screens.
Blog & Projects : Blog | Qatapult | SwiffOut | FScript

pigeonlips

  • Participant
  • Joined in 2011
  • *
  • Posts: 69
    • View Profile
    • Donate to Member
Re: Qatapult
« Reply #229 on: March 07, 2012, 05:14 PM »
For text color you can use textcolor on the UI object. You can also use the fontfamily property to select a different font.

thanks i'll give this a try.

3. Uuuh ? I'm not sure about what you mean, I'll give a look at the skin tomorrow
Again i didnt explain this well. I didnt understand what was happening at first, but I think its on the matching of the status. In stead of colors i'll explain via text case. for example i type:

> appcatn

and in the bottom left by the 3 in the piture i get :

> APPliCATioN

only the Upper case text (its not really upper case - just making it that way to help explain) shows in an off white which is nearly invisible - its this text i would like to control the color off. The lower case text displays in the normal color i set so that bits fine. The only real problem is if its free text (using ' for example) then it all appears in uppercase. I understand it better now after more playing around so in a nutshell

- it would be nice to set the color of the matching text from the inputbox

4. Don't worry about the performance of getstring it's in memory, you'll run out of place on the skin before it get slow

Again i didnt explain this too well ether. I was worryed about preformance of the skin/qatapult if i coded to get properties of the object from other sources. ID3 tag of the file, EXIF info for images etc. I guess i just wanted a little hand holding, but the only way to find out is to give it a try.

I have and the new skin looks up extended properties of a FILE type. ID3 tags and EXIF are a little out of my reach for now.

I love the start of that skin

thanks :) - its still very early - It needs lots more polish. Little things like the alignment of contorls, text sizes etc. i'll make it nicer soon. Work in progress.

pigeonlips

  • Participant
  • Joined in 2011
  • *
  • Posts: 69
    • View Profile
    • Donate to Member
Re: Qatapult
« Reply #230 on: March 07, 2012, 05:20 PM »
That's a very impressive work for a newcomer to javascript. - I've also added a few things to allow path trimming

lol - while writing and testing , writing and testing you wouldn't believe the pain i was causing qatapult and the crazy erratic behavior i got  :) - thanks for the kind comment, but i'm still worried its buggy.

also dont add to much - the learning curve is hard! LOL - just kidding.

ewemoa

  • Honorary Member
  • Joined in 2008
  • **
  • Posts: 2,922
    • View Profile
    • Donate to Member
Re: Qatapult
« Reply #231 on: March 07, 2012, 07:56 PM »
This skin is my first time ever using js so please point out anything that's wrong.

You may find strong opinions about JavaScript :)

As I understand it, JavaScript didn't get much time for design and polish before it got shipped and this shows.  There are many oddities / warts in the language and sadly often trying to do things in a way that seems to make sense can backfire -- particularly if one has expectations about the language coming from a C / C++ (or similar) background.

If you intend to continue with the language, I highly recommend checking out some of Douglas Crockford's material early on, perhaps starting with:

  Crockford on JavaScript

Even if one doesn't agree with some or much of what he says, I've found his material well worth the time.

He suggests an approach to the language based on being quite selective in what to use in the language and staying away from certain bits (e.g. he suggests not using == or != and instead using === and !==).  I have found this helps tremendously for JavaScript (and even AHK) but it isn't necessarily the easiest thing to figure out or get used to.

To help in this process, there is a tool Crockford developed and maintains called jslint (and now at least one fork called jshint).  I used jslint while doing JavaScript (via FScript) plugin development for FARR and found it to be really helpful.  Haven't set it up for Qatapult yet, but based on working with the OpenWith plugin, getting the feeling it may be a good idea.



After writing the above, I remembered that there is now this thing called CoffeeScript.  It compiles to JavaScript and although it has its problems, seems a far nicer language to be writing in.  It's pretty easy to get it set up once one has Node.js installed.  May be I'll see how practical it would be to use for Qatapult-related things.

Any interest?
« Last Edit: March 07, 2012, 08:07 PM by ewemoa »

ewemoa

  • Honorary Member
  • Joined in 2008
  • **
  • Posts: 2,922
    • View Profile
    • Donate to Member
Re: Qatapult
« Reply #232 on: March 07, 2012, 08:55 PM »
BTW, any chance of being able to use PgUp and PgDn for results navigation?

ewemoa

  • Honorary Member
  • Joined in 2008
  • **
  • Posts: 2,922
    • View Profile
    • Donate to Member
Re: Qatapult
« Reply #233 on: March 07, 2012, 09:03 PM »
Just a quick note to mention that slightly modifying the output of coffee (a CoffeeScript compiler), seems to produce a Qatapult-usable result.

The following CoffeeScript content for snippets.collecter.js:

Code: Text [Select]
  1. collect = (query, results) ->
  2.   if results.expects('TEXT')
  3.     fso = new ActiveXObject("Scripting.FileSystemObject")
  4.     f = fso.OpenTextFile("plugins\\snippets\\text.txt")
  5.     while not f.AtEndOfStream
  6.       l = f.ReadLine()
  7.       if qatapult.match(l, query)
  8.         obj =
  9.           key: l
  10.           text: l
  11.           icon: "plugins\\snippets\\text.jpg"
  12.         results.addObject('TEXT', l, obj)

turns into:

Code: Javascript [Select]
  1. (function() {
  2.   var collect;
  3.  
  4.   collect = function(query, results) {
  5.     var f, fso, l, obj, _results;
  6.     if (results.expects('TEXT')) {
  7.       fso = new ActiveXObject("Scripting.FileSystemObject");
  8.       f = fso.OpenTextFile("plugins\\snippets\\text.txt");
  9.       _results = [];
  10.       while (!f.AtEndOfStream) {
  11.         l = f.ReadLine();
  12.         if (qatapult.match(l, query)) {
  13.           obj = {
  14.             key: l,
  15.             text: l,
  16.             icon: "plugins\\snippets\\text.jpg"
  17.           };
  18.           _results.push(results.addObject('TEXT', l, obj));
  19.         } else {
  20.           _results.push(void 0);
  21.         }
  22.       }
  23.       return _results;
  24.     }
  25.   };
  26.  
  27. }).call(this);

I think removing the first and last lines may make the result usable by Qatapult.

ewemoa

  • Honorary Member
  • Joined in 2008
  • **
  • Posts: 2,922
    • View Profile
    • Donate to Member
Re: Qatapult
« Reply #234 on: March 08, 2012, 02:36 AM »
I tried a rough rewrite (non-idiomatic CoffeeScript) of OpenWith.collecter.js.  Removing the debugging related stuff, it looks like:

Code: Text [Select]
  1. collect = (query, results) ->
  2.   # for OpenTextFile
  3.   ForReading = 1
  4.   ForWriting = 2
  5.   ForAppending = 8
  6.   # http://coffeescriptcookbook.com/chapters/classes_and_objects/type-function
  7.   type = (obj) ->
  8.     if obj == undefined or obj == null
  9.       return String obj
  10.     classToType = new Object
  11.     for name in "Boolean Number String Function Array Date RegExp".split(" ")
  12.       classToType["[object " + name + "]"] = name.toLowerCase()
  13.     myClass = Object.prototype.toString.call obj
  14.     if myClass of classToType
  15.       return classToType[myClass]
  16.     return "object"
  17.   # file extension from file path
  18.   pathToExtension = (filePath) ->
  19.     extRE = /\.([^\\.]*)$/
  20.     ma = extRE.exec(filePath)
  21.     if not ma
  22.       return null
  23.     ma[1]
  24.   #
  25.   if not results.expects('FILE')
  26.     return
  27.   #
  28.   pane = qatapult.getFocus()
  29.   if pane != 2
  30.     return
  31.   #
  32.   fso = new ActiveXObject("Scripting.FileSystemObject")
  33.   #
  34.   p0 = qatapult.getArgValue(0, "path")
  35.   ext = pathToExtension(p0)
  36.   if not ext
  37.     ext = 'NONE'
  38.   #
  39.   table = {}
  40.   try
  41.     rf = fso.OpenTextFile("plugins\\OpenWith\\associations.js")
  42.     text = rf.ReadAll()
  43.     result = eval(text)
  44.   catch e
  45.     #
  46.   finally
  47.     rf.close()
  48.   #
  49.   if fso.FolderExists(p0)
  50.     if "_folderhandler" of table
  51.       ext = "_folderhandler"
  52.   if ext of table
  53.     rule = table[ext]
  54.     theType = type(rule)
  55.     switch theType
  56.       when "string"
  57.         path = rule
  58.         obj =
  59.           key: path
  60.           text: path
  61.           path: path
  62.         results.addObject('FILE', path, obj)
  63.       when "array"
  64.         for path in rule
  65.           obj =
  66.             key: path
  67.             text: path
  68.             path: path
  69.           results.addObject('FILE', path, obj)

ecaradec

  • Honorary Member
  • Joined in 2006
  • **
  • Posts: 410
    • View Profile
    • Blog & Projects
    • Read more about this member.
    • Donate to Member
Re: Qatapult
« Reply #235 on: March 08, 2012, 04:44 AM »
BTW, any chance of being able to use PgUp and PgDn for results navigation?
yes there is ;)
Blog & Projects : Blog | Qatapult | SwiffOut | FScript

ewemoa

  • Honorary Member
  • Joined in 2008
  • **
  • Posts: 2,922
    • View Profile
    • Donate to Member
Re: Qatapult
« Reply #236 on: March 08, 2012, 06:40 AM »
heres an attempt at an Alfred like skin (note i have never used it so its based on the screen shots I've seen)

I've been using it for a bit and noticed that to "get out of Qatapult" the number of times to type the escape key seems to be higher :)

Time to retrain the fingers and brain to use the hotkey may be...wonder how successful I'll be at that...

ecaradec

  • Honorary Member
  • Joined in 2006
  • **
  • Posts: 410
    • View Profile
    • Blog & Projects
    • Read more about this member.
    • Donate to Member
Re: Qatapult
« Reply #237 on: March 08, 2012, 07:03 AM »
@ewemoa, I spotted that as well. This is because the first escape hide the results but in the alfred skin the results are always visible so that hides just nothing. The second esc should exit though.

I'll add a fix for that, I just need to figure exactly how to do it. I'll probably need to defer the escape key handling to the skin.
Blog & Projects : Blog | Qatapult | SwiffOut | FScript

ecaradec

  • Honorary Member
  • Joined in 2006
  • **
  • Posts: 410
    • View Profile
    • Blog & Projects
    • Read more about this member.
    • Donate to Member
Re: Qatapult
« Reply #238 on: March 08, 2012, 02:37 PM »
Hi, I'm in the middle of an PC update, I'm not sure I'll get my PC available this evening  :'(. Can't work on Qatapult.
Blog & Projects : Blog | Qatapult | SwiffOut | FScript

ecaradec

  • Honorary Member
  • Joined in 2006
  • **
  • Posts: 410
    • View Profile
    • Blog & Projects
    • Read more about this member.
    • Donate to Member
Re: Qatapult
« Reply #239 on: March 08, 2012, 02:39 PM »
Thinking about something else : Do you think it would be worthwhile that I ask mouser a child board ? This is a little bit of a mess here, would you like to be able to have your own thread of plugins and extensions ?
Blog & Projects : Blog | Qatapult | SwiffOut | FScript

pigeonlips

  • Participant
  • Joined in 2011
  • *
  • Posts: 69
    • View Profile
    • Donate to Member
Re: Qatapult
« Reply #240 on: March 08, 2012, 03:40 PM »
I was wanting to suggest this too. Good idea. It would be great to split out all the topics. (talk on plugins, skins, features, bugs etc.....)

pigeonlips

  • Participant
  • Joined in 2011
  • *
  • Posts: 69
    • View Profile
    • Donate to Member
Re: Qatapult
« Reply #241 on: March 08, 2012, 03:47 PM »
Good spot by ewemoa - i thought something felt wrong but couldnt put my finger on what!

"I'll add a fix for that, I just need to figure exactly how to do it"

any way i can fix this in the skin? Tried adding "qatapult.resultsvisible" to the if that shows the results but no success. Also tryed playing around with the "qatapult.getArgValue(focus,"status")" and text and type = EMPTY and adding that to the if, but no sucess. Now ewemoa's pointed it out its really bothering me  :D

ecaradec

  • Honorary Member
  • Joined in 2006
  • **
  • Posts: 410
    • View Profile
    • Blog & Projects
    • Read more about this member.
    • Donate to Member
Re: Qatapult
« Reply #242 on: March 08, 2012, 05:36 PM »
I don't think you can pigeonlips. I keep an internal state about the visibility of the results and I'm using it for handling the esc key. There is no way you could fix that on the side, and I'd rather you don't try because that would necessarily be tricky if you found something and that could be an ascendency compatibility issue.

Don't worry, I'll fix it soon.
Blog & Projects : Blog | Qatapult | SwiffOut | FScript

pigeonlips

  • Participant
  • Joined in 2011
  • *
  • Posts: 69
    • View Profile
    • Donate to Member
Re: Qatapult
« Reply #243 on: March 08, 2012, 10:19 PM »
Hi All,

Here's another update to the skin in case anyone wants to play around with it over the weekend and see the progress.

took another pass over the code and cleaned it up - added a few things. Got the focus in the bottom to indicate where you are to work nicely. Also made it so that's it all nicely aligned and i am mostly happy with the position of the components as its all worked out with fantastic Maths! The configuration can be tweaked at the top of the js.

Its almost ready for the "final cut" but i want to hold off on this until i can set the background to the results box.

Enjoy


pigeonlips

  • Participant
  • Joined in 2011
  • *
  • Posts: 69
    • View Profile
    • Donate to Member
Re: Qatapult
« Reply #244 on: March 09, 2012, 02:02 AM »
Forgot to say - I really want to extend the skin with two things:

ID3 tag info -

and to use DWM (see this link - http://msdn.microsof...969521(v=vs.85).aspx) so that i can get it to draw the thumbnail of the window object.

Not sure how it will pan out, but incase i get anywhere fast with it, the first problem will be i dont have windows 7 to test if the DWM will work. . Anyone fancy being my gini-pig ?

Enjoy the weekend!

ecaradec

  • Honorary Member
  • Joined in 2006
  • **
  • Posts: 410
    • View Profile
    • Blog & Projects
    • Read more about this member.
    • Donate to Member
Re: Qatapult
« Reply #245 on: March 09, 2012, 06:46 AM »
Win 7 previews are a very cool idea ! I can enable that for Win 7 for the WINDOW type.
Blog & Projects : Blog | Qatapult | SwiffOut | FScript

ecaradec

  • Honorary Member
  • Joined in 2006
  • **
  • Posts: 410
    • View Profile
    • Blog & Projects
    • Read more about this member.
    • Donate to Member
Re: Qatapult
« Reply #246 on: March 10, 2012, 03:18 PM »
Here is a new version. What's changed :
- I added support for creating commands in script. Add *.command.js files under the plugin folder, all the methods defined there are loaded into Qatapult and you can call them from the rules using the tag <script>. Define your rule like this :
       <rule>
            <arg>TEXT</arg>
<arg>
<item>
<lbl>Append to file</lbl>
<ico>icons\defaultverb.png</ico>
</item>
</arg>
            <script>appendtofile(qatapult.getArgValue(0,"text"),"plugins\\commands\\test.txt")</script>
</rule>
- The matching method is much improved : it now takes into account if the match is near the start of the word or if the query match characters consecutively and gives appropriate bonuses
- You can now use page up and page down to navigate the results
- You can configure the color of results with ui.resultBgColor, ui.resultFocusColor, and ui.resultScrollbarColor (because there is a scrollbar now ;) )
- You can also configure other like fontfamily, stringTrimming to change the font for various text in the skin. I'll extract a full doc.
- You can also take complete ownership of the rendering of the results and draw them exactly as you want them with a API similar to the one of the args. However the drawResult might be preferable unless you have some very specific idea. Here is an example that can be plugged into the alfred-like skin :
       var nbres=4;
        qatapult.setVisibleResults(nbres);
        for (var i = qatapult.firstResult; i < qatapult.firstResult + nbres; i++) {
            var y=65+(i-qatapult.firstResult) * 40;
            if(qatapult.focusedResult==i)
                ui.fillRectangle(SkinBorder,y,(SkinWidth/2)-SkinBorder,40, 0x88FF0000);

            if(qatapult.getResValue(i,"type")=="TEXT")
                ui.drawText(qatapult.getResValue(i,"text"),SkinBorder, y+2, (SkinWidth/2)-SkinBorder, 38);                
            else {            
                ui.drawResItem(i, SkinBorder, y, 40, 40);
                ui.drawText(qatapult.getResValue(i,"text"),SkinBorder+45,y+10,(SkinWidth/2)-SkinBorder-50,10);
            }
        }
Blog & Projects : Blog | Qatapult | SwiffOut | FScript
« Last Edit: March 10, 2012, 03:29 PM by ecaradec »

ewemoa

  • Honorary Member
  • Joined in 2008
  • **
  • Posts: 2,922
    • View Profile
    • Donate to Member
Re: Qatapult
« Reply #247 on: March 11, 2012, 05:24 AM »
Wow -- seems like lots of new goodies :)

Just a quick note...

- You can now use page up and page down to navigate the results

Thanks for this!  Working here so far with Windows 7 Pro 64-bit and XP Pro SP3.
« Last Edit: March 11, 2012, 05:55 AM by ewemoa »

ecaradec

  • Honorary Member
  • Joined in 2006
  • **
  • Posts: 410
    • View Profile
    • Blog & Projects
    • Read more about this member.
    • Donate to Member
Re: Qatapult
« Reply #248 on: March 11, 2012, 01:15 PM »
I've found a small issue with the latest build and probably a few others. If you invoked a command on a result from the result list that is not the first, the bonus was assigned to the first item instead of the selected one.
Blog & Projects : Blog | Qatapult | SwiffOut | FScript

ewemoa

  • Honorary Member
  • Joined in 2008
  • **
  • Posts: 2,922
    • View Profile
    • Donate to Member
Re: Qatapult
« Reply #249 on: March 14, 2012, 08:35 PM »
- I added support for creating commands in script. Add *.command.js files under the plugin folder, all the methods defined there are loaded into Qatapult and you can call them from the rules using the tag <script>. Define your rule like this :
        <rule>
            <arg>TEXT</arg>
<arg>
<item>
<lbl>Append to file</lbl>
<ico>icons\defaultverb.png</ico>
</item>
</arg>
            <script>appendtofile(qatapult.getArgValue(0,"text"),"plugins\\commands\\test.txt")</script>
</rule>

I got part-way through a plugin for calculating MD5 checksums only to find that FileSystemObject doesn't appear to support working with binary files...