Welcome Guest.   Make a donation to an author on the site August 20, 2014, 05:24:19 PM  *

Please login or register.
Or did you miss your validation email?


Login with username and password (forgot your password?)
Why not become a lifetime supporting member of the site with a one-time donation of any amount? Your donation entitles you to a ton of additional benefits, including access to exclusive discounts and downloads, the ability to enter monthly free software drawings, and a single non-expiring license key for all of our programs.


You must sign up here before you can post and access some areas of the site. Registration is totally free and confidential.
 
The N.A.N.Y. Challenge 2010! Download 24 custom programs!
   
   Forum Home   Thread Marks Chat! Downloads Search Login Register  
Pages: Prev 1 ... 5 6 7 8 9 [10] 11 12 13 14 Next   Go Down
  Reply  |  New Topic  |  Print  
Author Topic: Qatapult  (Read 63689 times)
ecaradec
Honorary Member
**
Posts: 408



see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #225 on: March 07, 2012, 06:50:13 AM »

Sorry for the strange previous response. I typed it on my phone, so it's a bit weird.  tongue. 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.
Logged

Blog & Projects : Blog | Qatapult | SwiffOut | FScript
ecaradec
Honorary Member
**
Posts: 408



see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #226 on: March 07, 2012, 04:35:16 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.nation...diterranean-sea-swimming/ I picked it a bit randomly on the internet.


* test_qatapult_background.png (211.47 KB, 500x300 - viewed 104 times.)
Logged

Blog & Projects : Blog | Qatapult | SwiffOut | FScript
pigeonlips
Participant
*
Posts: 69


View Profile Give some DonationCredits to this forum member
« Reply #227 on: March 07, 2012, 04:53:19 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.org/fo...howflat&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):


* alfred-like.zip (8.66 KB - downloaded 51 times.)
Logged
ecaradec
Honorary Member
**
Posts: 408



see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #228 on: March 07, 2012, 05:06:10 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.
Logged

Blog & Projects : Blog | Qatapult | SwiffOut | FScript
pigeonlips
Participant
*
Posts: 69


View Profile Give some DonationCredits to this forum member
« Reply #229 on: March 07, 2012, 05:14:59 PM »

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

Quote
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

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

Quote
I love the start of that skin

thanks smiley - 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.
Logged
pigeonlips
Participant
*
Posts: 69


View Profile Give some DonationCredits to this forum member
« Reply #230 on: March 07, 2012, 05:20:58 PM »

Quote
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  smiley - 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.
Logged
ewemoa
Honorary Member
**
Posts: 2,409



View Profile Give some DonationCredits to this forum member
« Reply #231 on: March 07, 2012, 07:56:09 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 smiley

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:35 PM by ewemoa » Logged
ewemoa
Honorary Member
**
Posts: 2,409



View Profile Give some DonationCredits to this forum member
« Reply #232 on: March 07, 2012, 08:55:49 PM »

BTW, any chance of being able to use PgUp and PgDn for results navigation?
Logged
ewemoa
Honorary Member
**
Posts: 2,409



View Profile Give some DonationCredits to this forum member
« Reply #233 on: March 07, 2012, 09:03:41 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:

Formatted for UNKNOWN with the GeSHI Syntax Highlighter [copy or print]
  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:

Formatted for Javascript with the GeSHI Syntax Highlighter [copy or print]
  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.
Logged
ewemoa
Honorary Member
**
Posts: 2,409



View Profile Give some DonationCredits to this forum member
« Reply #234 on: March 08, 2012, 02:36:10 AM »

I tried a rough rewrite (non-idiomatic CoffeeScript) of OpenWith.collecter.js.  Removing the debugging related stuff, it looks like:

Formatted for UNKNOWN with the GeSHI Syntax Highlighter [copy or print]
  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)
Logged
ecaradec
Honorary Member
**
Posts: 408



see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #235 on: March 08, 2012, 04:44:43 AM »

Quote
BTW, any chance of being able to use PgUp and PgDn for results navigation?
yes there is Wink
Logged

Blog & Projects : Blog | Qatapult | SwiffOut | FScript
ewemoa
Honorary Member
**
Posts: 2,409



View Profile Give some DonationCredits to this forum member
« Reply #236 on: March 08, 2012, 06:40:28 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 smiley

Time to retrain the fingers and brain to use the hotkey may be...wonder how successful I'll be at that...
Logged
ecaradec
Honorary Member
**
Posts: 408



see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #237 on: March 08, 2012, 07:03:36 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.
Logged

Blog & Projects : Blog | Qatapult | SwiffOut | FScript
ecaradec
Honorary Member
**
Posts: 408



see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #238 on: March 08, 2012, 02:37:10 PM »

Hi, I'm in the middle of an PC update, I'm not sure I'll get my PC available this evening  Cry. Can't work on Qatapult.
Logged

Blog & Projects : Blog | Qatapult | SwiffOut | FScript
ecaradec
Honorary Member
**
Posts: 408



see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #239 on: March 08, 2012, 02:39:06 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 ?
Logged

Blog & Projects : Blog | Qatapult | SwiffOut | FScript
pigeonlips
Participant
*
Posts: 69


View Profile Give some DonationCredits to this forum member
« Reply #240 on: March 08, 2012, 03:40:48 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.....)
Logged
pigeonlips
Participant
*
Posts: 69


View Profile Give some DonationCredits to this forum member
« Reply #241 on: March 08, 2012, 03:47:54 PM »

Good spot by ewemoa - i thought something felt wrong but couldnt put my finger on what!

Quote
"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  cheesy
Logged
ecaradec
Honorary Member
**
Posts: 408



see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #242 on: March 08, 2012, 05:36:35 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.
Logged

Blog & Projects : Blog | Qatapult | SwiffOut | FScript
pigeonlips
Participant
*
Posts: 69


View Profile Give some DonationCredits to this forum member
« Reply #243 on: March 08, 2012, 10:19:06 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


* alfred-like.zip (13.39 KB - downloaded 41 times.)
Logged
pigeonlips
Participant
*
Posts: 69


View Profile Give some DonationCredits to this forum member
« Reply #244 on: March 09, 2012, 02:02:59 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.microsoft.com...op/aa969521(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!
Logged
ecaradec
Honorary Member
**
Posts: 408



see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #245 on: March 09, 2012, 06:46:58 AM »

Win 7 previews are a very cool idea ! I can enable that for Win 7 for the WINDOW type.
Logged

Blog & Projects : Blog | Qatapult | SwiffOut | FScript
ecaradec
Honorary Member
**
Posts: 408



see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #246 on: March 10, 2012, 03:18:56 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 :
[copy or print]
       <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 Wink )
- 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 :
[copy or print]
       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);
            }
        }
« Last Edit: March 10, 2012, 03:29:05 PM by ecaradec » Logged

Blog & Projects : Blog | Qatapult | SwiffOut | FScript
ewemoa
Honorary Member
**
Posts: 2,409



View Profile Give some DonationCredits to this forum member
« Reply #247 on: March 11, 2012, 05:24:03 AM »

Wow -- seems like lots of new goodies smiley

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:40 AM by ewemoa » Logged
ecaradec
Honorary Member
**
Posts: 408



see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #248 on: March 11, 2012, 01:15:36 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.
Logged

Blog & Projects : Blog | Qatapult | SwiffOut | FScript
ewemoa
Honorary Member
**
Posts: 2,409



View Profile Give some DonationCredits to this forum member
« Reply #249 on: March 14, 2012, 08:35:04 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 :
[copy or print]
        <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...
Logged
Pages: Prev 1 ... 5 6 7 8 9 [10] 11 12 13 14 Next   Go Up
  Reply  |  New Topic  |  Print  
 
Jump to:  
   Forum Home   Thread Marks Chat! Downloads Search Login Register  

DonationCoder.com | About Us
DonationCoder.com Forum | Powered by SMF
[ Page time: 0.148s | Server load: 0.09 ]