Home | Blog | Software | Reviews and Features | Forum | Help | Donate | About us
topbanner_forum
  *

avatar image

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

Login with username, password and session length
  • September 02, 2015, 01:30:46 AM
  • Proudly celebrating 10 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 90312 times)

ewemoa

  • Honorary Member
  • Joined in 2008
  • **
  • default avatar
  • Posts: 2,702
    • View Profile
    • Donate to Member
Re: Qatapult
« Reply #200 on: March 02, 2012, 04:21:54 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: 409
    • View Profile
    • Blog & Projects
    • Donate to Member
Re: Qatapult
« Reply #201 on: March 02, 2012, 04:30:47 AM »
Great, I know what's the issue now ;)
Blog & Projects : Blog | Qatapult | SwiffOut | FScript

ewemoa

  • Honorary Member
  • Joined in 2008
  • **
  • default avatar
  • Posts: 2,702
    • View Profile
    • Donate to Member
Re: Qatapult
« Reply #202 on: March 02, 2012, 04:47:08 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: 409
    • View Profile
    • Blog & Projects
    • Donate to Member
Re: Qatapult
« Reply #203 on: March 02, 2012, 05:03:07 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
  • **
  • default avatar
  • Posts: 2,702
    • View Profile
    • Donate to Member
Re: Qatapult
« Reply #204 on: March 02, 2012, 05:24:22 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
  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:44 PM by ewemoa »

ecaradec

  • Honorary Member
  • Joined in 2006
  • **
  • Posts: 409
    • View Profile
    • Blog & Projects
    • Donate to Member
Re: Qatapult
« Reply #205 on: March 02, 2012, 06:32: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: 409
    • View Profile
    • Blog & Projects
    • Donate to Member
Re: Qatapult
« Reply #206 on: March 02, 2012, 06:36:16 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
  • **
  • default avatar
  • Posts: 2,702
    • View Profile
    • Donate to Member
Re: Qatapult
« Reply #207 on: March 02, 2012, 05:30:54 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
  • **
  • default avatar
  • Posts: 2,702
    • View Profile
    • Donate to Member
Re: Qatapult
« Reply #208 on: March 02, 2012, 05:34:40 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: 409
    • View Profile
    • Blog & Projects
    • Donate to Member
Re: Qatapult
« Reply #209 on: March 02, 2012, 06:56:33 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: 409
    • View Profile
    • Blog & Projects
    • Donate to Member
Re: Qatapult
« Reply #210 on: March 04, 2012, 04:26:03 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
  • **
  • default avatar
  • Posts: 2,702
    • View Profile
    • Donate to Member
Re: Qatapult
« Reply #211 on: March 04, 2012, 06:46:53 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
  • **
  • default avatar
  • Posts: 2,702
    • View Profile
    • Donate to Member
Re: Qatapult
« Reply #212 on: March 04, 2012, 08:04:15 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:

Quote
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:

Quote
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:01 AM by ewemoa »

ewemoa

  • Honorary Member
  • Joined in 2008
  • **
  • default avatar
  • Posts: 2,702
    • View Profile
    • Donate to Member
Re: Qatapult
« Reply #213 on: March 05, 2012, 02:04:34 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
  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:53 AM by ewemoa »

ecaradec

  • Honorary Member
  • Joined in 2006
  • **
  • Posts: 409
    • View Profile
    • Blog & Projects
    • Donate to Member
Re: Qatapult
« Reply #214 on: March 05, 2012, 02:07:13 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
  • **
  • default avatar
  • Posts: 2,702
    • View Profile
    • Donate to Member
Re: Qatapult
« Reply #215 on: March 05, 2012, 02:19:18 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: 409
    • View Profile
    • Blog & Projects
    • Donate to Member
Re: Qatapult
« Reply #216 on: March 05, 2012, 02:56:35 AM »
Wuhuu !
Blog & Projects : Blog | Qatapult | SwiffOut | FScript

ecaradec

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






ecaradec

  • Honorary Member
  • Joined in 2006
  • **
  • Posts: 409
    • View Profile
    • Blog & Projects
    • Donate to Member
Re: Qatapult
« Reply #224 on: March 06, 2012, 05:31:56 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:11 AM by ecaradec »