Welcome Guest.   Make a donation to an author on the site April 20, 2014, 02:28:08 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.
 
Free DonationCoder.com Member Kit: Submit Request.
   
   Forum Home   Thread Marks Chat! Downloads Search Login Register  
Pages: [1] 2 Next   Go Down
  Reply  |  New Topic  |  Print  
Author Topic: last window id  (Read 13786 times)
cardboard42
Participant
*
Posts: 4


View Profile Give some DonationCredits to this forum member
« on: March 07, 2009, 12:02:30 PM »

Is it possible to get the hwnd of the last focused window in a plugin or alias? I know farr tracks it for other features, but it would be really helpful to be able to use it for other things. If it's not currently possible, consider this a feature request.
Logged
mouser
First Author
Administrator
*****
Posts: 32,674



see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #1 on: March 07, 2009, 12:07:06 PM »

Hi cardboard:

%LASTHWND% - integer value referring to the last window handle that had focus before FARR was triggered.

FARR actually uses such information when doing it's pasting functions, so that it can paste into the program that had focus when it was triggered.

Happy to answer more questions if you have an idea you are trying to implement.
« Last Edit: March 07, 2009, 12:09:16 PM by mouser » Logged
cardboard42
Participant
*
Posts: 4


View Profile Give some DonationCredits to this forum member
« Reply #2 on: March 07, 2009, 12:49:11 PM »

Basically I'm trying to implement a FARR version of the AHK Favorite Folders script (which I was the original author of). I'm now trying to make an alias action keyword that would launch a ahk script with the last hwnd and the selected result. This script would navigate the last focused window appropriately. Unfortunately I can't get the keyword to work.

I defined the alias like this: 1000>>>+test>#>C:\Command\Shell\AutoHotkey\Scripts\wintest.ahk %LASTHWND% "$$1"
And tried to use it like this: +test C:\command
I expected it to launch my script with C:\command as the second arg, but it just does the usual action.
Am I missing something here?
Logged
mouser
First Author
Administrator
*****
Posts: 32,674



see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #3 on: March 07, 2009, 01:15:52 PM »

i need to understand a little bit more about what you want to do.

IF what you want to do is type something like:
cardboardtest WHATEVERIWANT

and have it launch
C:\Command\Shell\AutoHotkey\Scripts\wintest.ahk %LASTHWND% "WHATEVERIWANT"

then what you want is just to define an alias and specify the regular expression
^cardboardtest (.*)$

that will capture the $$1 as you intend.



however if what you want is to let user search for a file the normal way, and use that found file as the $$1 then it's a little bit more complicated and you are on the right path.  i think the problem is you dont put the + in your alias name when you define the alias. just use test or cardboardtest whatever.

the + is the way the user tells FARR when they are typing that they want to use the alias to launch the result.
Logged
cardboard42
Participant
*
Posts: 4


View Profile Give some DonationCredits to this forum member
« Reply #4 on: March 07, 2009, 01:29:21 PM »

Awesome, leaving off the plus did what I intended, though it seems that may not have been what I wanted  Wink
I'll have to experiment a bit to find the nicest method.
Thanks for your help!
Logged
rulfzid
Participant
*
Posts: 28



View Profile Give some DonationCredits to this forum member
« Reply #5 on: March 17, 2009, 02:57:49 AM »

I hope I'm not stepping on any toes, but I had already come up with a solution, borrowing heavily from the Favorite Folders AHK script (which so many have come to know and love). I basically ripped off the meat of the script and passed it a couple of command-line arguments from FARR. I also tweaked it a tiny bit so that it works in Vista and 7.

You'll find 4 files in the zipped up alias pack:
  • FarrFolders.ahk
  • FarrFolders.alias
  • FarrFolders.exe
  • FarrFolders.ico

The AHK script is there in case anybody would like to tweak anything/view source. The alias itself uses the exe for ease of passing command-line parameters.

Basically, unzip the files into your AliasGroups/MyCustom folder. The alias itself is set to "faf", because i find that quick and easy to type and because "ff" kept showing "Microsoft Office" results for me.

Type "faf" into FARR, and you should see the three example folders. If the last window open is an explorer window, command console, or open file dialog, the script will navigate you to the selected folder in that window. If not, it will open a new explorer window.

To add more folders, simply edit the alias from within FARR (or directly in the FarrFolders.alias file). You'll see 3 examples already included:
  • Desktop | %ALIASDIR%\FarrFolders.exe %LASTHWND% %MYDESKTOP%
  • Program Files | %ALIASDIR%\FarrFolders.exe %LASTHWND% %PROGRAMFILES%
  • My Documents| %ALIASDIR%\FarrFolders.exe %LASTHWND% %MYDOCUMENTS%

As you can see, these take the form of:

[copy or print]
<folder_name> | %ALIASDIR%\FarrFolders.exe %LASTHWND% <folder_path>

where <folder_name> is the name of the folder as you'd like it to appear in your results and <folder_path> is the full path to the folder, which can (and should) utilize the FARR virtual folder names as much as possible. Leave the rest of the line the same, obv.

mouser, I was thinking about creating a "faf" alias command to edit the list, but it seems as though if I edit the alias file externally, the list doesn't automatically update the next time I type the alias. I could get it to do so if I manually opened up the "edit alias" box and closed it again, but not otherwise. Is there a way to get it to automatically rescan the alias file and refresh the results list? I'd like to add this functionality.

Till then, enjoy! This alias has already become indispensable to me - I hope it proves useful to others.

* FarrFolder alias pack.zip (200.25 KB - downloaded 231 times.)
Logged
nitrix-ud
Charter Member
***
Posts: 482

View Profile Give some DonationCredits to this forum member
« Reply #6 on: March 17, 2009, 03:24:45 AM »

Quote
mouser, I was thinking about creating a "faf" alias command to edit the list, but it seems as though if I edit the alias file externally, the list doesn't automatically update the next time I type the alias. I could get it to do so if I manually opened up the "edit alias" box and closed it again, but not otherwise. Is there a way to get it to automatically rescan the alias file and refresh the results list? I'd like to add this functionality.

try the #filecontents command Wink
Logged
mouser
First Author
Administrator
*****
Posts: 32,674



see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #7 on: March 17, 2009, 03:32:04 AM »

holy hell it works. that is VERY cool.
now you only need one more element to make this super useful, which is simply to let the user use this alias to activate with ANY folder shown in farr window in this way.  and this is pretty easy to do, let me add it.

couple things you could do in your farrfolders.exe that might help:
if folder passed ends in \ then remove it
if a filename is passed to farr folders, it actually worked for me but triggered an automatic Enter in my file open dialog.
Logged
mouser
First Author
Administrator
*****
Posts: 32,674



see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #8 on: March 17, 2009, 03:36:13 AM »

here's an additional alias that does what i was suggesting.

so for example, if you have the file open dialog of any program open, now you can bring up far, then search for the folder or file you want, or use directory browsing in farr, and type +fao at the end of your search string and trigger the result -- it will change to that folder or file thanks to the amazing farrfolders.

or type "fao explicit path here" to go to specific folder (but it wont search as you type, for that you need to put +fao)

Logged
mouser
First Author
Administrator
*****
Posts: 32,674



see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #9 on: March 17, 2009, 03:45:12 AM »

it would be more useful probably to be able to type it at start of string, which could be done with another alias (really i should fix farr so that the +fao can go at begining or end or so that typeing "fao blah" showed a live search, ill add that).

when you combine that with adding a special hotkey to farr to bring up farr with it preloaded with the +fao, what you have is a very very easy way to do live search in any program's file open/save dialog.

very cool.
Logged
mouser
First Author
Administrator
*****
Posts: 32,674



see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #10 on: March 17, 2009, 03:47:46 AM »

nitrix is right about the ideal way to handle your alias customization: http://www.donationcoder....m/index.php?topic=17270.0
another advantage of that is that to let use "edit" the list of known alias entries, you could just launch notepad with that text file containing alias contents.
« Last Edit: March 17, 2009, 03:56:30 AM by mouser » Logged
rulfzid
Participant
*
Posts: 28



View Profile Give some DonationCredits to this forum member
« Reply #11 on: March 17, 2009, 12:50:35 PM »

Awesome, I didn't know about #filecontents, and it's exactly what I needed. I can now implement some of the fun bells and whistles that I wasn't quite sure I was going to be able to do.

I have another question, concerning your creation of another alias. If the regex for 'faf' were modified to "faf (.*)", does that mean that if I type "faf <somecommand>" that it will still launch the first result when I hit enter?

Basically, I'm thinking about adding some commands to faf and then just having the FarrFolders script parse the commands. Just trying to figure out the best way to do that.
Logged
skajfes
Honorary Member
**
Posts: 204


View Profile Give some DonationCredits to this forum member
« Reply #12 on: March 17, 2009, 06:51:42 PM »

Wow, great idea. I think I am gonna love this extension, thanks.

I've tweaked it a bit to support Directory Opus and Office 2007 dialogs.

* FarrFolder.zip (200.55 KB - downloaded 182 times.)
Logged

It is impossible to make anything foolproof because fools are so ingenious.
rulfzid
Participant
*
Posts: 28



View Profile Give some DonationCredits to this forum member
« Reply #13 on: March 17, 2009, 06:59:39 PM »

Wow, great idea. I think I am gonna love this extension, thanks.

I've tweaked it a bit to support Directory Opus and Office 2007 dialogs.

Awesome! I'll be sure to include your changes as I do more stuff to/with this.

Logged
TucknDar
Charter Member
***
Posts: 1,093


Advanced coder of Nowt

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

Would be nice with user variable 'FileManager=[customfilemanager]' so it'll open a dir in a user's favourite file manager if no Open Dialog is... open. Even better would be if it could read FARR's setting for custom file explorer, but I don't know if that's possible.

Otherwise this could be on it's way to becoming a favourite (no pun intended) of mine!
Logged
rulfzid
Participant
*
Posts: 28



View Profile Give some DonationCredits to this forum member
« Reply #15 on: March 18, 2009, 12:53:46 PM »

Would be nice with user variable 'FileManager=[customfilemanager]' so it'll open a dir in a user's favourite file manager if no Open Dialog is... open. Even better would be if it could read FARR's setting for custom file explorer, but I don't know if that's possible.

Otherwise this could be on it's way to becoming a favourite (no pun intended) of mine!

Great idea. And it looks like FARR stores the custom file managers info in the FindAndRunRobot.ini file, so I could just read it from there. I'll update this pack soon.

Logged
mouser
First Author
Administrator
*****
Posts: 32,674



see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #16 on: March 18, 2009, 02:07:28 PM »

i'm happy to make the custom file explorer available as a %variable% so you can pass it on commandline if you like.
Logged
rulfzid
Participant
*
Posts: 28



View Profile Give some DonationCredits to this forum member
« Reply #17 on: March 18, 2009, 04:19:25 PM »

i'm happy to make the custom file explorer available as a %variable% so you can pass it on commandline if you like.

That would be fantastic. smiley
Logged
nitrix-ud
Charter Member
***
Posts: 482

View Profile Give some DonationCredits to this forum member
« Reply #18 on: March 18, 2009, 06:18:33 PM »

Quote
i'm happy to make the custom file explorer available as a %variable% so you can pass it on commandline if you like.

good idea Wink

please while you are at it, could you please add the %LASTURL% variable Wink  tongue
Logged
mouser
First Author
Administrator
*****
Posts: 32,674



see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #19 on: March 18, 2009, 06:23:39 PM »

done and done.  will be in next update.
Logged
nitrix-ud
Charter Member
***
Posts: 482

View Profile Give some DonationCredits to this forum member
« Reply #20 on: March 18, 2009, 06:59:53 PM »

 Kiss
Logged
ewemoa
Honorary Member
**
Posts: 2,242



View Profile Give some DonationCredits to this forum member
« Reply #21 on: March 18, 2009, 09:30:33 PM »

Excellent add-on  Thmbsup

BTW, I'm not finding root drives to work mostly (e.g. C: nor C:\) -- though it seems to work by accident(?) for cmd.exe.  Any one else experience this?

As far as specific situations where I had problems is concerned:

  • the save as dialog in notepad
  • working with windows explorer windows
Logged
rulfzid
Participant
*
Posts: 28



View Profile Give some DonationCredits to this forum member
« Reply #22 on: March 18, 2009, 09:57:05 PM »

Excellent add-on  Thmbsup

BTW, I'm not finding root drives to work mostly (e.g. C: nor C:\) -- though it seems to work by accident(?) for cmd.exe.  Any one else experience this?

As far as specific situations where I had problems is concerned:

  • the save as dialog in notepad
  • working with windows explorer windows

Which windows version are you on?

And part of that seems to be the trailing "\", which, as per mouser's suggestion above, I'm going to automatically remove.

I'll be posting an update soon - real busy with work, but I'm hoping to finish adding what I want to in the next day or two.
Logged
ewemoa
Honorary Member
**
Posts: 2,242



View Profile Give some DonationCredits to this forum member
« Reply #23 on: March 18, 2009, 10:06:04 PM »

I am using Windows XP Pro SP3 -- non-English though.

Thanks for your efforts  Thmbsup
Logged
mouser
First Author
Administrator
*****
Posts: 32,674



see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #24 on: March 18, 2009, 11:52:36 PM »

beta uploaded to http://www.donationcoder..../FindAndRunRobotSetup.exe
i'd appreciate some beta reports before i make it official.
Logged
Pages: [1] 2 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.046s | Server load: 0.19 ]