PFA to Detect Folders - How?

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
Post Reply
SkyFrontier
Posts: 2341
Joined: 04 Jan 2010 14:27
Location: Pasárgada (eu vou!)

PFA to Detect Folders - How?

Post by SkyFrontier »

Ok, it's a portable FILE association...
But I'd like to know if there's a way so PFA (or other means) intercepts a folder when I enter it so I can perform scripted actions based on that info.

I could test (sc exists) <curitem>, but again: folders would be totally ignored beforehand.

Thanks.
New User's Ref. Guide and Quick Setup Guide can help a bit! Check XYplorer Resources Index for many useful links!
Want a new XYperience? XY MOD - surfYnXoard
-coz' the aim of computing is to free us to LIVE...

binocular222
Posts: 1423
Joined: 04 Nov 2008 05:35
Location: Win11, Win10, 100% Scaling

Re: PFA to Detect Folders - How?

Post by binocular222 »

ahk>::Load MyScript.xys

You need to write separate xys script, not so nice but it works
I'm a casual coder using AHK language. All of my xys scripts:
http://www.xyplorer.com/xyfc/viewtopic. ... 243#p82488

SkyFrontier
Posts: 2341
Joined: 04 Jan 2010 14:27
Location: Pasárgada (eu vou!)

Re: PFA to Detect Folders - How?

Post by SkyFrontier »

Hmmmm...
*> = works with all files, regardless extensions
??? (the logic says "\>") = to work with folders
??? ("\*>") = files and folders, perhaps...

Got it...?
New User's Ref. Guide and Quick Setup Guide can help a bit! Check XYplorer Resources Index for many useful links!
Want a new XYperience? XY MOD - surfYnXoard
-coz' the aim of computing is to free us to LIVE...

admin
Site Admin
Posts: 66362
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: PFA to Detect Folders - How?

Post by admin »

Yes, \> applies to all folders.

SkyFrontier
Posts: 2341
Joined: 04 Jan 2010 14:27
Location: Pasárgada (eu vou!)

Re: PFA to Detect Folders - How?

Post by SkyFrontier »

So there's something going wrong here, Don.
13.10.0100 doesn't react at all to a "\>" PFA.
Test:
\>::copytext "ok";
it only works if CTRL+ALT+ENTER is pressed, then the proper "::copytext "ok";" entry is selected.
I'd expect this to perform the action like it does for files, ie, auto-activated when ENTER is pressed.
New User's Ref. Guide and Quick Setup Guide can help a bit! Check XYplorer Resources Index for many useful links!
Want a new XYperience? XY MOD - surfYnXoard
-coz' the aim of computing is to free us to LIVE...

admin
Site Admin
Posts: 66362
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: PFA to Detect Folders - How?

Post by admin »

Confirmed. ENTER/DblCLick on a folder will open the folder, it's kind of hard-coded to bypass the PFA definitions. I never expected that anybody would want something else. :)

Stefan
Posts: 1360
Joined: 18 Nov 2008 21:47
Location: Europe

Re: PFA to Detect Folders - How?

Post by Stefan »

SkyFrontier wrote:... I'd like to know if there's a way so PFA (or other means) intercepts a folder
when I enter it so I can perform scripted actions based on that info.
PFA

Code: Select all

+|"Test for file or folder" *;\>::if(exists("<curitem>")==2){msg "folder";}else{msg "file";}
or

Code: Select all

+|"Test for file or folder" *;\>Load myScript;

...\xyplorer\Data\Scripts\myScript.xys
  if(exists("<curitem>")==2){
     msg "hi, I am a folder or drive or share or server, but you know what u do, don't u?",1;
  }else{
     msg "ho, this should be a file",1;
  }
This code should be enough for non-toddler humans, but needs more cleverness to make it foolproof.



@Don
The F1-key has no effect in the "Customize File Association" dialogue, after I switch to 'edit mode' with the pencil button.



.

SkyFrontier
Posts: 2341
Joined: 04 Jan 2010 14:27
Location: Pasárgada (eu vou!)

Re: PFA to Detect Folders - How?

Post by SkyFrontier »

Same story, Stefan.
Even if I invert the items ("\;*) (which should be and in fact is irrelevant),
even if I give it full precedence (top of the list),
even if I disable all other PFAs,
even on fresh installs.
It does work for files (both versions: one-liner and .xys launcher, "*;\" or just "*") but not for folders, ie, if I want this to work on folders, I must CTRL+SHIFT+ENTER and select proper entry.
New User's Ref. Guide and Quick Setup Guide can help a bit! Check XYplorer Resources Index for many useful links!
Want a new XYperience? XY MOD - surfYnXoard
-coz' the aim of computing is to free us to LIVE...

Stefan
Posts: 1360
Joined: 18 Nov 2008 21:47
Location: Europe

Re: PFA to Detect Folders - How?

Post by Stefan »

SkyFrontier wrote:.
Ahh, you want to execute a script the same time you go inside a folder by pressing the Enter-key?
I think I just don't had understood what you are after, and I am still don't really :whistle:

My script is just an PFA example to differ between folder and file for an script call, that how I understood your question.




.

SkyFrontier
Posts: 2341
Joined: 04 Jan 2010 14:27
Location: Pasárgada (eu vou!)

Re: PFA to Detect Folders - How?

Post by SkyFrontier »

Usage case (my actual problem, of course):
I need to rename some folders as I enter then to manage client's profiles. That can be scripted following several specific rules (if <curitem> has a "_marker", for instance), but it must not be applied blindly using a script that scans a whole drive, as it will lead to confusion and totally break the revision I need to do client after client.

If PFA could process scripts on pressing ENTER prior to actually ENTER a folder, the whole checking+renaming would be a piece of cake.
New User's Ref. Guide and Quick Setup Guide can help a bit! Check XYplorer Resources Index for many useful links!
Want a new XYperience? XY MOD - surfYnXoard
-coz' the aim of computing is to free us to LIVE...

TheQwerty
Posts: 4373
Joined: 03 Aug 2007 22:30

Re: PFA to Detect Folders - How?

Post by TheQwerty »

What you really want are CEAs and they'll eventually come.. just be patient.

In the meantime you can try this... forget about PFA and use the following script to ALWAYS open/browse anything. You'll have to go through a long period of reprogramming to break old habits, though I'm sure some of the AHK coders can craft up some scripts to make this easier for you (by remapping Enter and double-click to some random keyboard shortcut which calls this script.)
Last edited by TheQwerty on 15 Oct 2013 19:49, edited 1 time in total.
Reason: Removed script - no point keeping a "usability nightmare" around.

SkyFrontier
Posts: 2341
Joined: 04 Jan 2010 14:27
Location: Pasárgada (eu vou!)

Re: PFA to Detect Folders - How?

Post by SkyFrontier »

Hi, TheQwerty.
No, it's not hard - it's a usability nightmare...

It could work as it is *IF* I was intentionally looking for such folders and the rule being a single one.
My aim is to set and forget, eventually adjusting more rules as I find them. Mouse/touchpad clicking is indispensable. I really don't see a reason to wait for CEA just because of that, as what is required here is PFA to work as it already does, but supporting folders.
Don's call, them.

Please...?

As the urgency calls, yes, I'd like to know if there's any AHK programmer up to the rescue.
Basically a script which intercepts any enter/double click and launch a "<xyscripts>\AHK_enter_dblClkTrap.xys".
New User's Ref. Guide and Quick Setup Guide can help a bit! Check XYplorer Resources Index for many useful links!
Want a new XYperience? XY MOD - surfYnXoard
-coz' the aim of computing is to free us to LIVE...

admin
Site Admin
Posts: 66362
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: PFA to Detect Folders - How?

Post by admin »

Stefan wrote:@Don
The F1-key has no effect in the "Customize File Association" dialogue, after I switch to 'edit mode' with the pencil button..
Better next version.

binocular222
Posts: 1423
Joined: 04 Nov 2008 05:35
Location: Win11, Win10, 100% Scaling

Re: PFA to Detect Folders - How?

Post by binocular222 »

This ahk works:

Code: Select all

#SingleInstance force
#notrayicon
#NoEnv

Settitlematchmode, 2
#Ifwinactive, XYplorer ahk_class ThunderRT6FormDC
Enter::
Sendinput {Enter}
sleep 50       ;Spare time for folder to be created
FunctionMessagetoXYplorer("::load Rename2")
Return


FunctionMessagetoXYplorer(MessagetoXYplorer, HWND = "Null")
{
SetTitleMatchMode, 2
if( HWND = "Null")
HWND := WinExist("XYplorer ahk_class ThunderRT6FormDC")

Size := StrLen(MessagetoXYplorer)
  If !(A_IsUnicode)
  {
  VarSetCapacity(Data, Size * 2, 0)
  StrPut(MessagetoXYplorer, &Data, Size, "UTF-16")
  }
  Else
  Data := MessagetoXYplorer

VarSetCapacity(COPYDATA, A_PtrSize * 3, 0)
NumPut(4194305, COPYDATA, 0, "Ptr")
NumPut(Size * 2, COPYDATA, A_PtrSize, "UInt")
NumPut(&Data, COPYDATA, A_PtrSize * 2, "Ptr")
SendMessage, 0x4a, 0, &COPYDATA, , ahk_id %HWND%
}
- Remember to customize FunctionMessagetoXYplorer("::load Rename2"). It just load a Rename2.xys script everytime you press Enter
- Remove #notrayicon if you want to see the AHK icon
- Of course, there's drawback: There're times when you press Enter not for creating folders. I can fix this by adding a watch_folder_creation windows event if you need
I'm a casual coder using AHK language. All of my xys scripts:
http://www.xyplorer.com/xyfc/viewtopic. ... 243#p82488

Post Reply