Welcome Guest. March 10, 2014, 01:39:56 PM

Or did you miss your validation email?

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! Entire Forum This board This topic Members Help Desk Entire Site
Pages: Prev 1 ... 5 6 7 8 9 [10] 11 12 13 14 Next   Go Down
 Reply  |  New Topic  |  Print
 Author Topic: Qatapult  (Read 55598 times)
Honorary Member

Posts: 408

 « 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.  . 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
Honorary Member

Posts: 408

 « 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 96 times.) Logged

Blog & Projects : Blog | Qatapult | SwiffOut | FScript
pigeonlips
Participant

Posts: 69

 « 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):

Honorary Member

Posts: 408

 « 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

 « 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 - 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

 « 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  - 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,194

 « 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

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,194

 « 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,194

 « 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]collect = (query, results) ->  if results.expects('TEXT')    fso = new ActiveXObject("Scripting.FileSystemObject")    f = fso.OpenTextFile("plugins\\snippets\\text.txt")    while not f.AtEndOfStream      l = f.ReadLine()      if qatapult.match(l, query)        obj =           key: l          text: l          icon: "plugins\\snippets\\text.jpg"        results.addObject('TEXT', l, obj)

turns into:

Formatted for Javascript with the GeSHI Syntax Highlighter [copy or print](function() {  var collect;   collect = function(query, results) {    var f, fso, l, obj, _results;    if (results.expects('TEXT')) {      fso = new ActiveXObject("Scripting.FileSystemObject");      f = fso.OpenTextFile("plugins\\snippets\\text.txt");      _results = [];      while (!f.AtEndOfStream) {        l = f.ReadLine();        if (qatapult.match(l, query)) {          obj = {            key: l,            text: l,            icon: "plugins\\snippets\\text.jpg"          };          _results.push(results.addObject('TEXT', l, obj));        } else {          _results.push(void 0);        }      }      return _results;    }  }; }).call(this);

I think removing the first and last lines may make the result usable by Qatapult.
 Logged
ewemoa
Honorary Member

Posts: 2,194

 « 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]collect = (query, results) ->  # for OpenTextFile  ForReading = 1  ForWriting = 2  ForAppending = 8  # http://coffeescriptcookbook.com/chapters/classes_and_objects/type-function  type = (obj) ->    if obj == undefined or obj == null      return String obj    classToType = new Object    for name in "Boolean Number String Function Array Date RegExp".split(" ")      classToType["[object " + name + "]"] = name.toLowerCase()    myClass = Object.prototype.toString.call obj    if myClass of classToType      return classToType[myClass]    return "object"  # file extension from file path  pathToExtension = (filePath) ->    extRE = /\.([^\\.]*)\$/    ma = extRE.exec(filePath)    if not ma      return null    ma[1]  #  if not results.expects('FILE')    return  #  pane = qatapult.getFocus()  if pane != 2    return  #  fso = new ActiveXObject("Scripting.FileSystemObject")  #  p0 = qatapult.getArgValue(0, "path")  ext = pathToExtension(p0)  if not ext    ext = 'NONE'  #  table = {}  try    rf = fso.OpenTextFile("plugins\\OpenWith\\associations.js")    text = rf.ReadAll()    result = eval(text)  catch e    #  finally    rf.close()  #  if fso.FolderExists(p0)    if "_folderhandler" of table      ext = "_folderhandler"  if ext of table    rule = table[ext]    theType = type(rule)    switch theType      when "string"        path = rule        obj =          key: path          text: path          path: path        results.addObject('FILE', path, obj)      when "array"        for path in rule          obj =            key: path            text: path            path: path          results.addObject('FILE', path, obj)
 Logged
Honorary Member

Posts: 408

 « 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
 Logged

Blog & Projects : Blog | Qatapult | SwiffOut | FScript
ewemoa
Honorary Member

Posts: 2,194

 « 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

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

Posts: 408

 « 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
Honorary Member

Posts: 408

 « 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  . Can't work on Qatapult.
 Logged

Blog & Projects : Blog | Qatapult | SwiffOut | FScript
Honorary Member

Posts: 408

 « 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

 « 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

 « 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
 Logged
Honorary Member

Posts: 408

 « 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

 « 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

pigeonlips
Participant

Posts: 69

 « 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
Honorary Member

Posts: 408

 « 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
Honorary Member

Posts: 408

 « 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 )
- 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,194

 « Reply #247 on: March 11, 2012, 05:24:03 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:40 AM by ewemoa » Logged
Honorary Member

Posts: 408

 « 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,194

 « 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
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 1, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.3073795437812805, "perplexity": 6918.969815723704}, "config": {"markdown_headings": false, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2014-10/segments/1394010951612/warc/CC-MAIN-20140305091551-00011-ip-10-183-142-35.ec2.internal.warc.gz"}