topbanner_forum
  *

avatar image

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

Login with username, password and session length
  • Tuesday March 19, 2024, 1:23 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 330573 times)

ewemoa

  • Honorary Member
  • Joined in 2008
  • **
  • Posts: 2,922
    • View Profile
    • Donate to Member
Re: Qatapult
« Reply #200 on: March 02, 2012, 04:21 AM »
I installed script debugger as you suggested and there is no crash now -- at least on Windows 7 Pro 64-bit.

I tried uninstalling script debugger and starting Qatapult -- it crashed again on start up.

ecaradec

  • Honorary Member
  • Joined in 2006
  • **
  • Posts: 410
    • View Profile
    • Blog & Projects
    • Read more about this member.
    • Donate to Member
Re: Qatapult
« Reply #201 on: March 02, 2012, 04:30 AM »
Great, I know what's the issue now ;)
Blog & Projects : Blog | Qatapult | SwiffOut | FScript

ewemoa

  • Honorary Member
  • Joined in 2008
  • **
  • Posts: 2,922
    • View Profile
    • Donate to Member
Re: Qatapult
« Reply #202 on: March 02, 2012, 04:47 AM »
I hope that means you have an idea of how to fix it :)

An additional data point -- similar situation with Windows XP Pro SP3: crash without Script Debugger installed, and no crash with Script Debugger installed.

ecaradec

  • Honorary Member
  • Joined in 2006
  • **
  • Posts: 410
    • View Profile
    • Blog & Projects
    • Read more about this member.
    • Donate to Member
Re: Qatapult
« Reply #203 on: March 02, 2012, 05:03 AM »
Yes, JScript debugger needs that you create interfaces for them to connect but they are only available if a debugger is available (nothing says that, that's just observations I learned latter from building fscript )
Blog & Projects : Blog | Qatapult | SwiffOut | FScript

ewemoa

  • Honorary Member
  • Joined in 2008
  • **
  • Posts: 2,922
    • View Profile
    • Donate to Member
Re: Qatapult
« Reply #204 on: March 02, 2012, 05:24 AM »
What does the query parameter to the collect function represent?  Does it correspond to what a user has typed for the currently focused pane?

When I used the typeof operator, I got back that query is a string, but when I try to see what the value is by writing it to a file, I think I'm seeing a blank value.  Code modified so that file is appended to -- and consequently non-empty query values also show up.

Below is some code trying to make its way toward becoming a plugin :)

Code: Javascript [Select]
  1. function collect(query, results) {
  2.   var fso, f, of, ForReading = 1, ForWriting = 2, ForAppending = 8;
  3.   //
  4.   if (!results.expects('TEXT')) {
  5.     return;
  6.   }
  7.   fso = new ActiveXObject("Scripting.FileSystemObject");
  8.   //
  9.   of = fso.OpenTextFile("plugins\\OpenWith\\log.txt", ForAppending, true);
  10.   of.WriteLine("query: " + query);
  11.   //
  12.   ext = pathToExtension(query);
  13.   if (ext === null) {
  14.     ext = "NONE";
  15.   }
  16.   //
  17.   of.WriteLine("ext: " + ext);
  18.   of.close();
  19.   //
  20.   f = fso.OpenTextFile("plugins\\OpenWith\\" + ext + ".txt");
  21.   //
  22.   while (!f.AtEndOfStream) {
  23.     l = f.ReadLine();
  24.     if (qatapult.match(l, query)) {
  25.       results.addObject('TEXT', l, {'key': l, 'text': l});
  26.     }
  27.   }
  28.   f.Close();
  29. }
  30.  
  31. function pathToExtension(path) {
  32.   var ma;
  33.   ma = /\.([^\\.]*)$/.exec(path);
  34.   if (ma === null) {
  35.     return null;
  36.   }
  37.   return ma[1];
  38. }
« Last Edit: March 02, 2012, 05:32 PM 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 #205 on: March 02, 2012, 06:32 AM »
That's strange, it works perfectly here. Try adding something like that at the top and check if that result is visible. You might also ask for the 'openwith (catalog )' to see all the results available at this point (expects return true in all cases when you enter the catalog ).

results.addObject('TEXT', 'XXX', {'key': 'XXX', 'text': query});

I think that you'll need to define an OPENWITH type so that you can write rules. I don't know if that was clear from my explanation. That way you'll be able to create rules like FILE,'open with',OPENWITH with a correct filtering.
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 #206 on: March 02, 2012, 06:36 AM »
Considering what you're trying to do I think you'll need an access to the current args available in the rule to display the appropriates verbs. I don't think it is doable with what's is available for plugins at this moment... unless you've found a trick ?
Blog & Projects : Blog | Qatapult | SwiffOut | FScript

ewemoa

  • Honorary Member
  • Joined in 2008
  • **
  • Posts: 2,922
    • View Profile
    • Donate to Member
Re: Qatapult
« Reply #207 on: March 02, 2012, 05:30 PM »
Thanks for taking a look.

Changing ForWriting to ForAppending made it so that I can now see non-blank queries.  Perhaps with ForWriting, the file was getting overwritten coincidentally always when the query was an empty string...

I've update the code posted before.

ewemoa

  • Honorary Member
  • Joined in 2008
  • **
  • Posts: 2,922
    • View Profile
    • Donate to Member
Re: Qatapult
« Reply #208 on: March 02, 2012, 05:34 PM »
Considering what you're trying to do I think you'll need an access to the current args available in the rule to display the appropriates verbs. I don't think it is doable with what's is available for plugins at this moment... unless you've found a trick ?

I haven't found a trick -- just trying to become familiar with what's currently possible :)

ecaradec

  • Honorary Member
  • Joined in 2006
  • **
  • Posts: 410
    • View Profile
    • Blog & Projects
    • Read more about this member.
    • Donate to Member
Re: Qatapult
« Reply #209 on: March 02, 2012, 06:56 PM »
No worry I'll add a getargvalue so that you get access to the other args. Of course this will make the source dependant of the rules.
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 #210 on: March 04, 2012, 04:26 PM »
I've uploaded a new version. That make me think that it would be really useful that I make something to notify of changes...

- You can now script your skins. Having played with it, I think it feels really flexible and powerful. It should be pretty simple to do an Alfred like skin, or do a white background for text editing. You can control the position of each texts and add custom text for individual types, etc... I've reworked the two demonstrations skin so that you can see how to port your skin. If you had made skin you'll need to port those to the new system, there is not too many skins yet and I'll can provide help as needed. The code is a bit long (for a skin ) but I've added variable for the size of the different elements to help you to get started. Have a look at painter.js in the skin folder.

- I've also added a bunch of method on the qatapult object so those become availables for the collecter plugins as well. Ewemoa you should be able to code your openwith plugin... I think you'll found all the features you need. I'll write an api reference but for the moment most methods are demonstrated in the painter.js and they are pretty straigthforward.

- The presence of a debugger should not be required anymore now either. I wasn't able to really test it as I have too many debuggers installed, it would be a chore to get rid of every one of them. It would be nice if you could report me if it's ok.
Blog & Projects : Blog | Qatapult | SwiffOut | FScript

ewemoa

  • Honorary Member
  • Joined in 2008
  • **
  • Posts: 2,922
    • View Profile
    • Donate to Member
Re: Qatapult
« Reply #211 on: March 04, 2012, 06:46 PM »
Thanks for the new version :)



Just a quick note regarding:

- The presence of a debugger should not be required anymore now either. I wasn't able to really test it as I have too many debuggers installed, it would be a chore to get rid of every one of them. It would be nice if you could report me if it's ok.

When I tried with what I think is the latest -- the Qatapult.exe with MD5 d2442ae8ea4a5a8d433a131083e36682 (Qatapult.zip MD5 8cd63377c7e6bda0c9cf017e191cbeb1) -- I still get a crash on start up using Windows XP Pro SP3.

ewemoa

  • Honorary Member
  • Joined in 2008
  • **
  • Posts: 2,922
    • View Profile
    • Donate to Member
Re: Qatapult
« Reply #212 on: March 04, 2012, 08:04 PM »
- I've also added a bunch of method on the qatapult object so those become availables for the collecter plugins as well.

Thanks!

Here's what I picked out of painter.js:

qatapult.getFocus()
qatapult.textmode
qatapult.getArgValue(i, "type") // i - pane number: 0, 1, 2; str - "type", "email", "text", "status"
qatapult.getQuery(i) // i - pane number
qatapult.argscount
qatapult.resultsvisible
qatapult.resultscount
qatapult.crawlprogress
qatapult.showmenu(x, y) // x, y - coordinates

and from snippets.collector.js:

qatapult.match(text, query)
results.expects('TEXT')
results.addObject('TEXT', text, {'key':l, 'text':l, 'icon':'plugins\\somewhere\\image.png'})
« Last Edit: March 05, 2012, 12:48 AM by ewemoa »

ewemoa

  • Honorary Member
  • Joined in 2008
  • **
  • Posts: 2,922
    • View Profile
    • Donate to Member
Re: Qatapult
« Reply #213 on: March 05, 2012, 02:04 AM »
Attached, please find a first attempt at an OpenWith plugin.

Usage

  pane 0: some file name
  pane 1: Open With...
  pane 2: application name <-- see below for some notes on this

Some points:

  • Didn't figure out how to give results higher scores -- the added results appear to be quite a bit toward the end of the results
  • The paths of the applications are configured in the file associations.js
  • The paths of the applications are represented as JavaScript strings and backslashes need escaping
  • The paths of the applications use relative paths
  • Some items like hashmyfiles won't work because it actually requires command line switches, e.g. /file <filename>
  • Lots of output statements in the code for testing / debugging purposes

example association.js (what's included)
Code: Javascript [Select]
  1. table =
  2.   (function () {
  3.     var table,
  4.         ahk_l, emacs, gimp, hashmyfiles, nppp, pdfx, sevenzip, sumatra,
  5.         uniextract, xnview,
  6.         imageviewers;
  7.     //
  8.     ahk_l = "..\\AutoHotkey_L\\AutoHotkey.exe";
  9.     emacs = "..\\emacs\\bin\\runemacs.exe";
  10.     gimp = "..\\GIMPPortable\\GIMPPortable.exe";
  11.     hashmyfiles = "..\\NirLaunchers\\NirSoft\\hashmyfiles.exe";
  12.     nppp = "..\\Notepad++Portable\\Notepad++Portable.exe";
  13.     pdfx = "..\\PDFX_Vwr\\PDFXCview.exe";
  14.     sevenzip = "..\\7-ZipPortable\\7-ZipPortable.exe";
  15.     sumatra = "..\\SumatraPDFPortable\\SumatraPDFPortable.exe";
  16.     uniextract = "..\\uniextract\\UniExtract.exe";
  17.     xnview = "..\\XnViewPortable\\XnViewPortable.exe";
  18.     //
  19.     imageviewers = [gimp, xnview];
  20.     //
  21.     table =
  22.       {
  23.        "exe": uniextract,
  24.        //
  25.        "pdf": [sumatra, pdfx],
  26.        "txt": [nppp, emacs],  
  27.        //
  28.        "png": imageviewers,
  29.        "jpg": imageviewers,
  30.        "gif": imageviewers,
  31.        //
  32.        "7z": sevenzip,
  33.        "iso": [sevenzip],
  34.        "rar": sevenzip,
  35.        "tgz": sevenzip,
  36.        "zip": [sevenzip, uniextract]
  37.       };
  38.     return table;
  39.    })();

MD5: 17eef4789a9a064d15a7c4006d07776c
« Last Edit: March 05, 2012, 03:30 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 #214 on: March 05, 2012, 02:07 AM »
I've found a mistake that is probably causing the crash. Could you try it again ewemoa ?

Scores configuration is not available yet, you're correct.
Blog & Projects : Blog | Qatapult | SwiffOut | FScript

ewemoa

  • Honorary Member
  • Joined in 2008
  • **
  • Posts: 2,922
    • View Profile
    • Donate to Member
Re: Qatapult
« Reply #215 on: March 05, 2012, 02:19 AM »
Hurray!  No crashes when starting up for both Windows XP Pro SP3 and Windows 7 Pro 64-bit :)


ecaradec

  • Honorary Member
  • Joined in 2006
  • **
  • Posts: 410
    • View Profile
    • Blog & Projects
    • Read more about this member.
    • Donate to Member
Re: Qatapult
« Reply #216 on: March 05, 2012, 02:56 AM »
Wuhuu !
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 #217 on: March 05, 2012, 03:05 AM »
Hum, judging from the colors of icons it seems that I forgot an alpha premultiplication. If you have weird colors, this is it : I'll fix that this evening.
Blog & Projects : Blog | Qatapult | SwiffOut | FScript

ewemoa

  • Honorary Member
  • Joined in 2008
  • **
  • Posts: 2,922
    • View Profile
    • Donate to Member
Re: Qatapult
« Reply #218 on: March 05, 2012, 03:34 AM »
Thanks for the pointer -- I'm not noticing anything with the colors under Windows XP Pro SP3.



Below is a bit fancier associations.js.  It provides an array addtoall which can be used to add applications to all configured extensions -- for example, it might be convenient for all extensions to be associated with applications such as hex editors, checksum calculators, etc.

Code: Javascript [Select]
  1. table =
  2.   (function () {
  3.     var table, ext, rule, theType,
  4.         //
  5.         ahk_h, ahk_l, emacs, frhed, gimp, hashmyfiles, hfs, nppp, pdfx,
  6.         sevenzip, smplayer, ssc, sumatra, uniextract, vlc, xnview,
  7.         //
  8.         imageviewers, videoplayers,
  9.         //
  10.         addtoall;
  11.     //
  12.     ahk_h = "..\\AutoHotkey_H\\Win32w\\AutoHotkey.exe";
  13.     ahk_l = "..\\AutoHotkey_L\\AutoHotkey.exe";
  14.     emacs = "..\\emacs\\bin\\runemacs.exe";
  15.     frhed = "..\\FrhedPortable\\FrhedPortable.exe";
  16.     gimp = "..\\GIMPPortable\\GIMPPortable.exe";
  17.     hashmyfiles = "..\\NirLauncher\\NirSoft\\hashmyfiles.exe";
  18.     hfs = "..\\hfs\\hfs.exe";
  19.     nppp = "..\\Notepad++Portable\\Notepad++Portable.exe";
  20.     pdfx = "..\\PDFX_Vwr\\PDFXCview.exe";
  21.     sevenzip = "..\\7-ZipPortable\\7-ZipPortable.exe";
  22.     ssc = "..\\ScreenshotCaptor\\ScreenshotCaptor.exe";
  23.     smplayer = "..\\SMPlayer\\smplayer.exe";
  24.     sumatra = "..\\SumatraPDFPortable\\SumatraPDFPortable.exe";
  25.     uniextract = "..\\uniextract\\UniExtract.exe";
  26.     vlc = "..\\VLCPortable\\VLCPortable.exe";
  27.     xnview = "..\\XnViewPortable\\XnViewPortable.exe";
  28.     //
  29.     imageviewers = [gimp, xnview];
  30.     videoplayers = [smplayer, vlc];
  31.     //
  32.     addtoall = [frhed, hashmyfiles, hfs];
  33.     //
  34.     table =
  35.       {
  36.        "ahk": [ahk_h, ahk_l],
  37.        //
  38.        "exe": uniextract,
  39.        //
  40.        "pdf": [sumatra, pdfx],
  41.        "txt": [nppp, emacs],  
  42.        //
  43.        "gif": imageviewers,
  44.        "jpg": imageviewers,
  45.        "png": imageviewers,
  46.        "ssc": imageviewers,
  47.        //
  48.        "avi": videoplayers,
  49.        "flv": videoplayers,
  50.        "mpg": videoplayers,
  51.        "mpeg": videoplayers,
  52.        "mp4": videoplayers,
  53.        "mov": videoplayers,
  54.        //
  55.        "7z": sevenzip,
  56.        "iso": [sevenzip],
  57.        "rar": sevenzip,
  58.        "tgz": sevenzip,
  59.        "zip": [sevenzip, uniextract]
  60.       };
  61.     // adding to all
  62.     // XXX: not worrying about duplicates atm
  63.     for (ext in table) {
  64.       rule = table[ext];
  65.       theType = typeof rule;
  66.       if (theType === "string") {
  67.         table[ext] = [rule].concat(addtoall);
  68.       } else if (theType === "object") {
  69.         table[ext] = table[ext].concat(addtoall);
  70.       } else {
  71.         // XXX: not expected...
  72.       }
  73.     }
  74.     //
  75.     return table;
  76.    })();

ecaradec

  • Honorary Member
  • Joined in 2006
  • **
  • Posts: 410
    • View Profile
    • Blog & Projects
    • Read more about this member.
    • Donate to Member
Re: Qatapult
« Reply #219 on: March 05, 2012, 07:16 AM »
It seems that the colors are actually corrects. The new ugly "internet explorer" icon induced me in error. What's the hell were they thinking ? The colors are so awful that I supposed that I had broken something !!!
Blog & Projects : Blog | Qatapult | SwiffOut | FScript

ewemoa

  • Honorary Member
  • Joined in 2008
  • **
  • Posts: 2,922
    • View Profile
    • Donate to Member
Re: Qatapult
« Reply #220 on: March 05, 2012, 07:21 AM »
Perhaps one of the purposes was to attract attention...it seems there was some success in that...

ecaradec

  • Honorary Member
  • Joined in 2006
  • **
  • Posts: 410
    • View Profile
    • Blog & Projects
    • Read more about this member.
    • Donate to Member
Re: Qatapult
« Reply #221 on: March 05, 2012, 08:42 AM »
Looking back again, still there is an issue : the run command looks really bad, so does others.
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 #222 on: March 05, 2012, 05:42 PM »
After another check, I think this is ok :P . Pray that I don't change my mind in a few minutes.
Blog & Projects : Blog | Qatapult | SwiffOut | FScript

pigeonlips

  • Participant
  • Joined in 2011
  • *
  • Posts: 69
    • View Profile
    • Donate to Member
Re: Qatapult
« Reply #223 on: March 06, 2012, 02:27 PM »
Hi All,

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 wouldn't recommend using it as its far from finished, but i was hoping for a little help (or to find out whats possible)

Any hints on the following:



1 - any way of making the text in the input box a different size and color?

2 -

A) the results box background is white and i don't know how (or if) you can set a background. If i could then the skin could be something more classy than white. The ideal would be if i could make the background color transparent as that way there's less images to load for the skin.

B) is there any way of controlling the size of the results? This way i could fit more into results without the skin being very large.

3 - the text of the type TEXT always appears white at the bottom. I have no idea how to set this.

4 - you'll have to try the skin for this one but it would be nice to set some more properties depending on the type. Any way of finding out whats available by type in qatapult.getArgValue(0, "XXXX")
also Is it a bad idea to use code in the script to get other properties. I was thinking somthing like

if (last bit of filename = "mp3")
 show filename.album
 show filename.artist
 show filename.track

I'm not sure if this is ill advised as performance hit to qatapult is not what i want. I guess i might just have to try that one out.

Spoiler
Code: Javascript [Select]
  1. var skin="skins\\alfred-like\\";
  2. var SkinWidth=500;
  3. var SkinHeight=300;
  4. var SkinBorder=10;
  5.  
  6. function draw(ui)
  7. {
  8.         // set the text color
  9.         ui.textcolor=0x88000000;
  10.         ui.fontsize=12;
  11.         // draw the canvas
  12.         ui.drawBitmap(skin+"background.png", 0, 0, SkinWidth, SkinHeight);
  13.        
  14.         // draw the input box
  15.         // HELP >  ----------------------------------------------------------
  16.         // HELP >
  17.         // HELP > ui.fontsize=16; /* doesnt affect the size of the input box below */
  18.         // HELP >  ----------------------------------------------------------
  19.         ui.drawInput(30,42,SkinWidth-((SkinBorder+10)*2),15);
  20.        
  21.         // now draw the items - pane one
  22.         if(qatapult.argscount==1)
  23.         {
  24.                 drawItem(ui,0, SkinBorder + 20, SkinHeight - 47, 150, 36);
  25.                 //ui.drawBitmap(skin+"next.png",190,SkinHeight - 37, 15, 15);
  26.         }
  27.         // now draw the items - pane two
  28.         if (qatapult.argscount==2)
  29.         {
  30.                 drawItem(ui,0, SkinBorder + 20, SkinHeight - 47, 150, 36);
  31.                 drawItem(ui,1, SkinBorder + 200, SkinHeight - 47, 150, 36);
  32.                 ui.drawBitmap(skin+"next.png",190,SkinHeight - 37, 15, 15);    
  33.         }
  34.         // now draw the items - pane three
  35.         if (qatapult.argscount==3)
  36.         {
  37.                 drawItem(ui,0, SkinBorder + 20, SkinHeight - 47, 150, 36);
  38.                 drawItem(ui,1, SkinBorder + 200, SkinHeight - 47, 150, 36);
  39.                 drawItem(ui,2, SkinBorder + 350, SkinHeight - 47, 150, 36);
  40.                 ui.drawBitmap(skin+"next.png",340,SkinHeight - 37, 15, 15);
  41.         }
  42.        
  43.         // draw results box
  44.         if(/*qatapult.resultsvisible && */qatapult.resultscount!=0)
  45.         {
  46.                 var resultscount=Math.min(5,qatapult.resultscount);
  47.                 // HELP >  ----------------------------------------------------------
  48.                 // HELP >  can we change the background or color of the results box?
  49.                 // HELP >  I have am using a white skin so that it matchs the background of the results
  50.                 // HELP >  ----------------------------------------------------------
  51.                
  52.                 // HELP >  ----------------------------------------------------------
  53.                 // HELP >  can the size of the items be set. If it where smaller i could fit in more results
  54.                 // HELP >  ----------------------------------------------------------
  55.                
  56.                 ui.drawResults(SkinBorder,65,(SkinWidth/2) - SkinBorder,SkinHeight -(100+SkinBorder));
  57.         }      
  58.        
  59.         if(qatapult.argscount>1)
  60.         {
  61.                 // whats the type?
  62.                 type = qatapult.getArgValue(0, "type")
  63.        
  64.                 if (type == "TEXT")
  65.                 {
  66.                         // set text size and color
  67.                         ui.fontsize=8;
  68.                         ui.textcolor=0x88000000;
  69.                        
  70.                         // draw the frame - this can be used for images or something.
  71.                         ui.drawBitmap(skin+"frame.png",320 ,65, 107, 91);
  72.                        
  73.                         // display some info in text
  74.                         status = qatapult.getArgValue(0, "status")
  75.                         email = qatapult.getArgValue(0, "email")
  76.                         text = qatapult.getArgValue(0, "text")
  77.                         ui.drawText("type : "+type, SkinWidth/2 + SkinBorder,160,200,15); // seams static in the wrong position ?
  78.                         ui.drawText("status : "+status, SkinWidth/2 + SkinBorder,180,200,15); // seams centered?
  79.                         ui.drawText("email : "+email, SkinWidth/2 + SkinBorder,200,200,15); // seams static in the wrong position ?
  80.                         ui.drawText("text : "+text, SkinWidth/2 + SkinBorder,220,200,15); // seams centered?
  81.                         ui.fontsize=12;
  82.                        
  83.                         // the first result at the bottom in free text is white. ? Add it here instead.
  84.                         ui.drawText(status, SkinBorder + 20,SkinHeight - 47, 150, 36);
  85.                 }
  86.                 if (type == "FILE")
  87.                 {
  88.                         // set text size and color
  89.                         ui.fontsize=14;
  90.                         ui.textcolor=0x88000000;
  91.                        
  92.                         // draw the Icon
  93.                         drawItem(ui,0,320 ,65, 107, 91);
  94.                        
  95.                         // display some info in text
  96.                         filedir = qatapult.getArgValue(0, "rdirectory")
  97.                         filename = qatapult.getArgValue(0, "rfilename")
  98.  
  99.                         ui.drawText(filename, SkinWidth/2 + SkinBorder,160,200,25);
  100.                        
  101.                         ui.fontsize=8;
  102.                         ui.drawText("directory : ", SkinWidth/2 + SkinBorder,190,200,15);
  103.                         ui.drawText(filedir, SkinWidth/2 + SkinBorder,205,200,30);
  104.                         ui.fontsize=12;
  105.                        
  106.                 }
  107.                 if (type == "WINDOW")
  108.                 {
  109.                         // set text size and color
  110.                         ui.fontsize=8;
  111.                         ui.textcolor=0x88000000;
  112.                        
  113.                         // draw the frame - this can be used for images or something.
  114.                         ui.drawBitmap(skin+"frame.png",320 ,65, 107, 91);
  115.                        
  116.                         // display some info in text
  117.                         winTitle = qatapult.getArgValue(0, "title")
  118.                         winHWD = qatapult.getArgValue(0, "hwnd")
  119.                         text = qatapult.getArgValue(0, "text")
  120.                         ui.drawText(winTitle, SkinWidth/2 + SkinBorder,160,200,15); // seams static in the wrong position ?
  121.                         ui.drawText("Windows Handle : "+winHWD, SkinWidth/2 + SkinBorder,180,200,15); // seams centered?
  122.                         ui.fontsize=12;
  123.                 }
  124.                 else
  125.  
  126.                 {
  127.                         drawItem(ui,0,320 ,65, 107, 91);
  128.                 }
  129.         }
  130.  
  131.  
  132.        
  133.         // draw the menu button
  134.         ui.drawBitmap(skin+"ui-radio-button.png", SkinWidth-40, SkinBorder, 16, 16);
  135.  
  136.     // drawn index progress
  137.     ui.fontsize=8;
  138.     ui.textcolor=0x88000000;
  139.     if(qatapult.crawlprogress!=0 && qatapult.crawlprogress!=100)
  140.         ui.drawText("Updating index : "+qatapult.crawlprogress+"%",SkinBorder,SkinBorder,SkinWidth-(SkinBorder*2),15)
  141.  
  142.                
  143.         // this drew status line - opting out of this as i dont know where to put it at the moment
  144.         /*
  145.         var focus=qatapult.getFocus();
  146.         ui.drawEmphased(qatapult.getArgValue(focus,"status"),qatapult.getQuery(focus),15,SkinHeight-20,SkinWidth-30,10);
  147.         */
  148.        
  149.        
  150.         // determine the mode - will add support for this later.
  151.         /*
  152.     if(qatapult.textmode)
  153.     {
  154.         //ui.drawBitmap(skin+"textbackground.png", 0, 0, 350, 200);
  155.         //ui.drawInput(25,25,305,138);
  156.         //height=200;
  157.     }
  158.     else
  159.     {
  160.         //ui.textcolor=0xFF000000;
  161.         // draw the background according to the number of current args
  162.         if(qatapult.argscount<3)
  163.            {
  164.             //ui.drawBitmap(skin+"background.png", 0, 0, 350, 120);
  165.             //height=120;
  166.         }
  167.            else
  168.            {
  169.             //ui.drawBitmap(skin+"background_3.png", 0, 0, 350, 170);
  170.             //height=170;
  171.         }
  172.     }
  173.     */
  174. }
  175.  
  176. function drawItem(ui,i,x,y,w,h) {
  177.    
  178.     if(qatapult.getArgValue(i,"type")=="TEXT") {
  179.                 // HELP >  ----------------------------------------------------------
  180.                 // HELP > free text always appears in white. Dont know how to set the color?
  181.                 // ui.drawItem(i,x+5,y+5,w-10,h-20);
  182.     } else {
  183.         // draw the item visual and draw it's label below
  184.         ui.drawItem(i,x+2,y+2,h-4,h-4);
  185.         var text="";
  186.         //if(qatapult.getArgValue(i,"email")!="")
  187.           //  var text=" <"+qatapult.getArgValue(i,"email")+">";
  188.         ui.drawEmphased(qatapult.getArgValue(i,"text")+text,qatapult.getQuery(i),x+h,y+10,w-2*h,30);
  189.     }
  190.    
  191. }
  192.  
  193. function onClick(x,y) {
  194.     if(x>SkinWidth-(SkinBorder*2) && x<SkinWidth-(SkinBorder*2)+16 && y>SkinBorder && y<SkinBorder+20)
  195.         qatapult.showmenu(x,y);
  196. }






ecaradec

  • Honorary Member
  • Joined in 2006
  • **
  • Posts: 410
    • View Profile
    • Blog & Projects
    • Read more about this member.
    • Donate to Member
Re: Qatapult
« Reply #224 on: March 06, 2012, 05:31 PM »
For text color you can use textcolor on the UI object. You can also use the fontfamily property to select a different font.

The results have a white background, its actually not a very good idea, I'll give an option to change the colors. Anyways I'll probably give control on the display of the results.
Results are 40 pixels high right now, I use the size given in drawresults to know how much I can fit in.

3. Uuuh ? I'm not sure about what you mean, I'll give a look at the skin tomorrow

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

I've found a little issue with the usage bonus on results. It seems ignored on files. Beyond that, I'm splitting this info so that I get exact number of uses and last data for improving the quality and learning of qatapult

I love the start of that skin ;)
Blog & Projects : Blog | Qatapult | SwiffOut | FScript
« Last Edit: March 07, 2012, 06:31 AM by ecaradec »