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, 2:33 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 330583 times)

ewemoa

  • Honorary Member
  • Joined in 2008
  • **
  • Posts: 2,922
    • View Profile
    • Donate to Member
Re: Qatapult
« Reply #275 on: March 29, 2012, 05:40 PM »
No problem at all.  Please rename appropriately.

ewemoa

  • Honorary Member
  • Joined in 2008
  • **
  • Posts: 2,922
    • View Profile
    • Donate to Member
Re: Qatapult
« Reply #276 on: March 29, 2012, 05:44 PM »
Just thinking that one of the common uses for setInput would be when you zip a file, or do something else with a file to reopen Qatapult with the ouput file focused.

Thanks for the example situation.

Along the lines of zipping / archiving, do you have any UI ideas how one might approach multiple files / folders being selected for zipping / archiving?  In QS, there was the "comma trick", but I'm wondering whether there might be better alternatives...

ecaradec

  • Honorary Member
  • Joined in 2006
  • **
  • Posts: 410
    • View Profile
    • Blog & Projects
    • Read more about this member.
    • Donate to Member
Re: Qatapult
« Reply #277 on: March 29, 2012, 06:16 PM »
The comma trick seems good to me. I had a look to integrate that this WE. This is really a core change and there is well over 50 places where I must fix things, so I will really need some quiet time to plug that. I don't know what could make it better, I think that allowing Qatapult to be a drop target might be nice so that we could drop files directly from the explorer into Qatapult. I would certainly use that. If you have some other usage ideas, I'm listening.

As a status update, I'm doing two things right now :
- fix memory leaks (I unplugged my memory leak finder to find a bug and left it unplugged. Leaks are not easier to find in larger quantities ;) )
- implementing a paste using the new DynaWrapper code. I have working clipboard code for text already. I'm also discovering that this is not a very easy environnement to develop into, but may be it will be easier as I write more wrappers.



Blog & Projects : Blog | Qatapult | SwiffOut | FScript

ewemoa

  • Honorary Member
  • Joined in 2008
  • **
  • Posts: 2,922
    • View Profile
    • Donate to Member
Re: Qatapult
« Reply #278 on: March 29, 2012, 07:12 PM »
The comma trick seems good to me. I had a look to integrate that this WE. This is really a core change and there is well over 50 places where I must fix things, so I will really need some quiet time to plug that. I don't know what could make it better,

I don't know about the aesthetics of it, but the following display idea came up:

1. Press comma
2. Current pane extends vertically (like a stack?)

Just a random thought :)



I think that allowing Qatapult to be a drop target might be nice so that we could drop files directly from the explorer into Qatapult. I would certainly use that.

Same here!  Drop target would be great.  Also being able to drag from Qatapult would be nice too -- quickly find something with Qatapult for use elsewhere (until there's a plugin :) ).



One thing that I've wanted in FARR is the ability to drop items on to an individual result.  I have FARR configured to use "Blank search shows files from launch history..." -- and I've wanted to use that as a kind of dock to drop items on to, but last I checked, this doesn't work.  So certainly would be nice to have this in Qatapult!



As a status update, I'm doing two things right now :
- fix memory leaks (I unplugged my memory leak finder to find a bug and left it unplugged. Leaks are not easier to find in larger quantities ;) )
- implementing a paste using the new DynaWrapper code. I have working clipboard code for text already. I'm also discovering that this is not a very easy environnement to develop into, but may be it will be easier as I write more wrappers.

Wishing you luck in these matters...



By the way, what do you think of the idea of a command history like in command line shells?  IIRC, in bash and other *nix shells, Control-P / Control-N is used for previous command / next command.

If there were hooks for a plugin to register to execute code upon certain key sequences as well as a chance to operate on command content before Qatapult executes the command, I'd be interested in writing a plugin for command history :)

ewemoa

  • Honorary Member
  • Joined in 2008
  • **
  • Posts: 2,922
    • View Profile
    • Donate to Member
Re: Qatapult
« Reply #279 on: April 04, 2012, 08:01 PM »
Do you mind if I change the name of setInput to setOutput ? I think it would be more appropriate.

On a related note regarding renaming -- I think in English, spelling for collector ends in 'or'.  When I did search, I found that in French there is a word that ends in 'er'.

May be you knew this already :)

ecaradec

  • Honorary Member
  • Joined in 2006
  • **
  • Posts: 410
    • View Profile
    • Blog & Projects
    • Read more about this member.
    • Donate to Member
Re: Qatapult
« Reply #280 on: April 05, 2012, 06:33 AM »
I don't know about the aesthetics of it, but the following display idea came up:

1. Press comma
2. Current pane extends vertically (like a stack?)
I think, I'll let skins handle that. I was considering doing something similar to QS as a default : putting extra arguments icon under each items. But that's going to be totally customisable in others skins.

History is something you'd need probably more access that you currently have. The history I though was most interesting is an history of rules, I really think that objects are insufficient, you want to repeat an action usually, not get the previous object. However I totally like the idea, and this is going to find its way into Qatapult.

Collecter is a a mistake. Thanks.
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 #281 on: April 05, 2012, 05:13 PM »
I just spotted that autohotkey has a dll version http://www.autohotke...HotKeyIt/AutoHotkey/

Embedding that would allow to build scripts plugin directly with autohotkey.
Blog & Projects : Blog | Qatapult | SwiffOut | FScript

ewemoa

  • Honorary Member
  • Joined in 2008
  • **
  • Posts: 2,922
    • View Profile
    • Donate to Member
Re: Qatapult
« Reply #282 on: April 05, 2012, 06:49 PM »
FWIW, AutoHotkey.dll is what I've been using for at least one earlier Qatapult plugin -- the Calculate one.

For reference, below is a bit from Calculate.ahk:

Code: Autohotkey [Select]
  1. ; XXX: ScriptText should have #Persistent and a function def
  2. ;      Pass the script's text using ScriptText
  3. ;      Pass the name of the function in using FuncName
  4. RunFuncInScriptWithInputText(ScriptText, FuncName, InputText)
  5. {
  6.   ; XXX: before didn't need to muck with path...
  7.   AhkDll := AhkDllThread(A_ScriptDir . "\..\AHK\AutoHotkey.dll")
  8.   ;OutputDebug, % "Script content: " . ScriptText
  9.   AhkDll.ahkTextDll(ScriptText)
  10.   OutputDebug, % "Value passing to script: " . InputText
  11.   Result := AhkDll.ahkFunction(FuncName, InputText)
  12.   OutputDebug, % "Script returned: " . Result
  13.   AhkDll.Terminate()
  14.   Return Result
  15. }
  16.  
  17. Calculate(InputText)
  18. {
  19.   FuncName := "Calculate"
  20.   ScriptText := "#Persistent`n`n"
  21.               . "#NoTrayIcon`n`n"
  22.               . FuncName . "()`n"
  23.               . "{`n"
  24.               . "  Result := " . InputText . "`n"
  25.               . "  Return % Result . A_Space`n" ; XXX: convert to string
  26.               . "}`n"
  27.   Result := RunFuncInScriptWithInputText(ScriptText, FuncName, InputText)
  28.   Result := RTrim(Result)
  29.   ; XXX: consider whether to modify trailing zeros
  30.   Return Result
  31. }

AutoHotkey.dll aside
AutoHotkey.dll has some nice features and the developer (HotKeyIt) is usually pretty responsive about bug reports, but docs for his things are not always up-to-date.

« Last Edit: April 05, 2012, 06:54 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 #283 on: April 09, 2012, 05:18 PM »
I've uploaded a new version. This is the ground for the future settings ui that should be more usable. You can now enable and disable plugins from the UI. There is also a ton of less memory leaks.

There are new functions that you can use by doing a require("lib/clipboard.js") : they are clip and paste. Paste can optionally take a text to paste. You can also do a sendinput but it's currently limited to printable characters only. If you feel like improving it, I'll be happy to take your version and put it in Qatapult.

Both functions are built with direct call to win32 dll from javascript using the dynamic wrapper. Have a look to clipboard.js in lib if you want to see what it looks like.

There is a new jsmath plugin that eval javascript as a way to evaluate mathematical expression. Start a query with = on the first pane to trigger it. It work well but doesn't handle the display exactly the way I would like : The perfect thing ihmo would be to have a custom display on the first pane that display both the expression and the result, then a second pane with the operation. The current thing use 3 panes. I think that it might  be worthwhile that we use some specially named values that skins could detect and handle display for a large number of types instead of handling types individually like we do today : skins could be more versatile that way ihmo.

I've also fixed the collecter things as ewemoa suggested => please use now collector.js for your plugins now.
Blog & Projects : Blog | Qatapult | SwiffOut | FScript

ewemoa

  • Honorary Member
  • Joined in 2008
  • **
  • Posts: 2,922
    • View Profile
    • Donate to Member
Re: Qatapult
« Reply #284 on: April 09, 2012, 05:42 PM »
I've uploaded a new version. This is the ground for the future settings ui that should be more usable. You can now enable and disable plugins from the UI. There is also a ton of less memory leaks.

Thanks for the new version!

Just a quick note -- I no longer see "Quit" or "Reload".  This is with a fresh install on Windows XP SP3.

Any ideas?

ewemoa

  • Honorary Member
  • Joined in 2008
  • **
  • Posts: 2,922
    • View Profile
    • Donate to Member
Re: Qatapult
« Reply #285 on: April 09, 2012, 05:48 PM »
There are new functions that you can use by doing a require("lib/clipboard.js") : they are clip and paste. Paste can optionally take a text to paste. You can also do a sendinput but it's currently limited to printable characters only. If you feel like improving it, I'll be happy to take your version and put it in Qatapult.

Both functions are built with direct call to win32 dll from javascript using the dynamic wrapper. Have a look to clipboard.js in lib if you want to see what it looks like.

There is a new jsmath plugin that eval javascript as a way to evaluate mathematical expression. Start a query with = on the first pane to trigger it. It work well but doesn't handle the display exactly the way I would like : The perfect thing ihmo would be to have a custom display on the first pane that display both the expression and the result, then a second pane with the operation. The current thing use 3 panes. I think that it might  be worthwhile that we use some specially named values that skins could detect and handle display for a large number of types instead of handling types individually like we do today : skins could be more versatile that way ihmo.

Looking forward to checking these bits out...however, I don't see them in the latest zip.  I tried downloading with 2 browsers but didn't notice any difference.  For reference, the MD5 of what I ended up with was:

  MD5: 7a416eb360fcbd53dcfc1e672f575839

What am I missing?

ecaradec

  • Honorary Member
  • Joined in 2006
  • **
  • Posts: 410
    • View Profile
    • Blog & Projects
    • Read more about this member.
    • Donate to Member
Re: Qatapult
« Reply #286 on: April 09, 2012, 05:59 PM »
Oups, I forgot to say that I moved all Qatapult verbs under the Qatapult file : type Qatapult and look at the available verbs
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 #287 on: April 09, 2012, 06:02 PM »
Thanks for spotting the missing plugins, they were still excluded from the package. The last version should contain all of them.
Blog & Projects : Blog | Qatapult | SwiffOut | FScript

ewemoa

  • Honorary Member
  • Joined in 2008
  • **
  • Posts: 2,922
    • View Profile
    • Donate to Member
Re: Qatapult
« Reply #288 on: April 09, 2012, 07:52 PM »
...the missing plugins, they were still excluded from the package. The last version should contain all of them.

I see them now.  Thanks!

ewemoa

  • Honorary Member
  • Joined in 2008
  • **
  • Posts: 2,922
    • View Profile
    • Donate to Member
Re: Qatapult
« Reply #289 on: April 09, 2012, 07:56 PM »
I moved all Qatapult verbs under the Qatapult file : type Qatapult and look at the available verbs

I typed 'qatapult' (no quotes) and I see three results in pane 0:

  • qatapult.png
  • Qatapult.exe
  • qatapult

None of the associated verbs for any of these (in pane 1) appears to be 'Quit' nor 'Reload'.  May be I misunderstood?

FWIW, the currentversion.txt file contains:

  20120410010112

and MD5 of the zip file is:

  614f0ec74c5ccdf48b6af2574d341858

ewemoa

  • Honorary Member
  • Joined in 2008
  • **
  • Posts: 2,922
    • View Profile
    • Donate to Member
Re: Qatapult
« Reply #290 on: April 09, 2012, 08:59 PM »
please use now collector.js for your plugins now.

FWIW, in the latest download, I see the following file names:

  • jsmath.collecter.js
  • putty.collecter.js
  • snippets.collecter.js
  • uninstall.collecter.js

Also, in Qatapult\Lib there is FileGetVersionInfo.ahk -- I think this is unnecessary.

ewemoa

  • Honorary Member
  • Joined in 2008
  • **
  • Posts: 2,922
    • View Profile
    • Donate to Member
Re: Qatapult
« Reply #291 on: April 09, 2012, 09:11 PM »
There is a new jsmath plugin that eval javascript as a way to evaluate mathematical expression. Start a query with = on the first pane to trigger it.

I like that I get an immediate result displayed  :Thmbsup:

=Math.sin(Math.PI)

Now how to get a history thing working...

BTW, any chance of functionality for clearing the current pane's input?  May be there is already something...

ewemoa

  • Honorary Member
  • Joined in 2008
  • **
  • Posts: 2,922
    • View Profile
    • Donate to Member
Re: Qatapult
« Reply #292 on: April 09, 2012, 09:13 PM »
There are new functions that you can use by doing a require("lib/clipboard.js") : they are clip and paste. Paste can optionally take a text to paste. You can also do a sendinput but it's currently limited to printable characters only. If you feel like improving it, I'll be happy to take your version and put it in Qatapult.

Both functions are built with direct call to win32 dll from javascript using the dynamic wrapper. Have a look to clipboard.js in lib if you want to see what it looks like.

I found clibpboard.js and test.command.js in plugins\commands -- taking a look now.

Thanks for this example code.
« Last Edit: April 09, 2012, 09:18 PM by ewemoa »

ewemoa

  • Honorary Member
  • Joined in 2008
  • **
  • Posts: 2,922
    • View Profile
    • Donate to Member
Re: Qatapult
« Reply #293 on: April 10, 2012, 06:23 AM »
In plugins\commands\clipboard.js there are a few lines that I don't understand well.  Please explain what the following were meant to do:

Code: Javascript [Select]
  1. for(var a in args[i]) { break; }

Code: Javascript [Select]
  1. this.length+=desc[t].size;

For the second bit, I don't see any desc anywhere else in the file.  I see that Struct is defined in lib\stdutils.js, so may be I should be ignoring some or all of clipboard.js?

ecaradec

  • Honorary Member
  • Joined in 2006
  • **
  • Posts: 410
    • View Profile
    • Blog & Projects
    • Read more about this member.
    • Donate to Member
Re: Qatapult
« Reply #294 on: April 11, 2012, 06:39 AM »
About the collecter plugins, I feared that people would copy plugins folder over the old one without deleting the previous one. That's what I do actually. I feared that it would lead to entries being duplicated so I just leaved collecter for the moment. However if you create a new plugin collector.js is the correct name to use. Just thinking about it, I think that I could let qatapult rename theses files for consistency.

Reload, Quit and Options should now appears under the Qatapult entry. Here is what I got :
qatapult_reload.pngQatapult
Is it different from what you have ewemoa ?

I agree with you about the history ewemoa. I was considering doing a global history. May be there should be some way to narrow the history to things that have the same start as the current selection so that we could get an history of math results and an history of operations on some file.

You're right about clipboard.js. It should be there. It's actually useless as it's not loaded. It doesn't do anything. The whole code about clipboard is in test.command.js that I should probably rename. I probably considered that it should only be called by command plugins so there wasn't too much needs to put it available as a library. I'm not sure if that's a good choice.

this.length+=desc[t].size;
clipboard.js is actually useless, this code is incorrect.

for(var a in args) { break; }
This is a trick to have a take the value of the first available item. I iterate once then exits. It do that because I describe types of the Struct function as an array of object : [{key:value}]. This line allows me to get the name of the key. I don't know of any other way to get that in javascript.
Blog & Projects : Blog | Qatapult | SwiffOut | FScript

ewemoa

  • Honorary Member
  • Joined in 2008
  • **
  • Posts: 2,922
    • View Profile
    • Donate to Member
Re: Qatapult
« Reply #295 on: April 11, 2012, 06:19 PM »
Thanks for the response :)

Reload, Quit and Options should now appears under the Qatapult entry.

...

Is it different from what you have

Yes.  I get:

qatapultexe-pane-1-results.pngQatapult

ewemoa

  • Honorary Member
  • Joined in 2008
  • **
  • Posts: 2,922
    • View Profile
    • Donate to Member
Re: Qatapult
« Reply #296 on: April 11, 2012, 06:21 PM »
I was considering doing a global history. May be there should be some way to narrow the history to things that have the same start as the current selection so that we could get an history of math results and an history of operations on some file.

Narrowing / filtering history sounds like an interesting idea.  May be it's worth trying if it's easy to implement.

ewemoa

  • Honorary Member
  • Joined in 2008
  • **
  • Posts: 2,922
    • View Profile
    • Donate to Member
Re: Qatapult
« Reply #297 on: April 11, 2012, 06:45 PM »
Thanks for the explanations regarding the 2 bits of code.

Regarding the "for in" construct, I remember something about possible problems in some circumstances if hasOwnProperty is not used to check that an iterated key is not inherited.  I'm not sure of what the precise details are, but FWIW, the following is from the Options page of jshint:

This option requires all for in loops to filter objects' items. The for in statement allows for looping through the names of all of the properties of an object including those inherited throught the prototype chain. This behavior can lead to unexpected items in your object so it is generally safer to always filter inherited properties out as shown in the example:

for (key in obj) {
  if (obj.hasOwnProperty(key)) {
    // We are sure that obj[key] belongs to the object and was not inherited.
  }
}

For more in-depth understanding of for in loops in JavaScript, read Exploring JavaScript for-in loops by Angus Croll.

I wonder if it is relevant in this case.

ecaradec

  • Honorary Member
  • Joined in 2006
  • **
  • Posts: 410
    • View Profile
    • Blog & Projects
    • Read more about this member.
    • Donate to Member
Re: Qatapult
« Reply #298 on: April 12, 2012, 06:15 AM »
Thanks for the explanations regarding the 2 bits of code.
No pb.

About the for in construct, yes it can be annoying if it match some extra properties defined on prototype object. I will avoid to do that, it is somewhat seen as a bad practice now because of such issues.
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 #299 on: April 12, 2012, 06:16 AM »
I think that your version of Qatapult.exe is old, it probably didn't copied correctly or something like that. The new version has an hi-resolution icon when you focus it.
Blog & Projects : Blog | Qatapult | SwiffOut | FScript