Page 2 of 2
Re: How to Check Both Panes for Existing Files?
Posted: 13 Nov 2010 17:11
by Stefan
Basic script would be f.ex. like:
Code: Select all
$ITEM = "<curname>";
$OtherPane = get("path", i);
if (exists("$OtherPane\$ITEM")==1)
{
echo "Yes, file $ITEM exist on other pane too.";
//do more actions here
}
elseif(exists("$OtherPane\$ITEM")==2)
{
msg "$ITEM exists as folder.";
//do more actions here
}
else
{
msg "$ITEM not found on other Pane";
//do more actions here
}
Re: How to Check Both Panes for Existing Files?
Posted: 13 Nov 2010 17:15
by admin
Stefan wrote:Basic script would be f.ex. like:
Code: Select all
$ITEM = "<curname>";
$OtherPane = get("path", i);
if (exists("$OtherPane\$ITEM")==1)
{
echo "Yes, file $ITEM exist on other pane too.";
//do more actions here
}
elseif(exists("$OtherPane\$ITEM")==2)
{
msg "$ITEM exists as folder.";
//do more actions here
}
else
{
msg "$ITEM not found on other Pane";
//do more actions here
}
Again categories are being mixed.

The function exists() does not tell whether an item exists on a pane (but in the file system). If the pane is e.g. visually filtered it does not "exist" on that pane.
But then I have no idea what the OP tries to achieve... so I better leave this thread...

Re: How to Check Both Panes for Existing Files?
Posted: 13 Nov 2010 17:26
by SkyFrontier
@Stefan (or anyone interested on this):
The thing is:
Pane 1:
Pane 2:
Code: Select all
= is text.diz here? No.
text.txt = but it has this one! (=same basename!) so ok - script will apply to this item; if text.diz were present too, both files should be affected.
Code: Select all
no text.txt nor test.diz = stop script.
Thanks for trying!
Re: How to Check Both Panes for Existing Files?
Posted: 13 Nov 2010 17:30
by SkyFrontier
...and I believe THIS VARIATION will solve the problem!!!
($item is now <
curbase> and elseif(exists("$OtherPane\$ITEM")==
0)
Code: Select all
$ITEM = "<curbase>";
$OtherPane = get("path", i);
if (exists("$OtherPane\$ITEM")==1)
{
echo "Yes, file $ITEM exist on other pane too.";
//do more actions here
}
elseif(exists("$OtherPane\$ITEM")==0)
{
msg "$ITEM exists as folder.";
//do more actions here
}
else
{
msg "$ITEM not found on other Pane";
//do more actions here
Re: How to Check Both Panes for Existing Files?
Posted: 13 Nov 2010 17:50
by Stefan
admin wrote:Stefan wrote:Basic script would be f.ex. like:
Code: Select all
$ITEM = "<curname>";
$OtherPane = get("path", i);
if (exists("$OtherPane\$ITEM")==1)
{
echo "Yes, file $ITEM exist on other pane too.";
//do more actions here
}
elseif(exists("$OtherPane\$ITEM")==2)
{
msg "$ITEM exists as folder.";
//do more actions here
}
else
{
msg "$ITEM not found on other Pane";
//do more actions here
}
Again categories are being mixed.

The function exists() does not tell whether an item exists on a pane (but in the file system). If the pane is e.g. visually filtered it does not "exist" on that pane.
Ahh,
thanks for that explanation, i never thought about this
Maybe this should be reflected in the help:
exists()
Checks whether a file or directory exists on the file system (Must not be visible on an pane).
Name: listpane
Action: Lists the visible contents of a (even filtered) pane.
Now i understood why listpane() was introduced
Code: Select all
$ITEM = "<curname>";
$Result = listpane(i, $ITEM, 5); //check for file
if ($Result == "")
{
$Result = listpane(i, $ITEM, 6); //check for folder
if ($Result == "")
{
msg "$ITEM not found on other Pane";
}
else
{
msg "$ITEM exists as folder.";
}
}
else
{
msg "Yes, file $ITEM exist on other pane too.";
}
Re: How to Check Both Panes for Existing Files?
Posted: 13 Nov 2010 17:55
by admin
Stefan wrote:Now i understood why listpane() was introduced
Code: Select all
$ITEM = "<curname>";
$Result = listpane(i, $ITEM, 5); //check for file
if ($Result == "")
{
$Result = listpane(i, $ITEM, 6); //check for folder
if ($Result == "")
{
msg "$ITEM not found on other Pane";
}
else
{
msg "$ITEM exists as folder.";
}
}
else
{
msg "Yes, file $ITEM exist on other pane too.";
}
Yep, you finally got it.

Re: How to Check Both Panes for Existing Files?
Posted: 13 Nov 2010 20:03
by SkyFrontier
Problem solved.
Used some
count values along with
selfilter as a completely different approach. Now my script checks if a file exists (whatever "existence" means for a file

) and makes virtually impossible for an user to get into trouble.
Thanks for the ideas, guys!