Code: Select all
$a = input("Text to replace", , <curbase> , s);
$b = input("Replace with", , , s);
rename s, "$a/$b"; 
But I don't know how to incorporate the two. Any pointers would be great.
Cheers
Code: Select all
$a = input("Text to replace", , <curbase> , s);
$b = input("Replace with", , , s);
rename s, "$a/$b"; 
Code: Select all
/*
For XYplorer script command syntax see
Help > Adv. Topics > Scripting Command Reference > HTML
html([html], [width=600], [height=400], [caption=XYplorer])
For HTML syntax see e.g.
http://werbach.com/barebones/barebones.html
*/Code: Select all
$myHTMLvar = urldecode(html('
<html>
<body>
<form method="get" action="xys:">
<INPUT type="submit" name="DoItButton" value="DoIt" >
</form>
</body>
</html>
',"600", "400", "My HTML GUI")); Code: Select all
//Execute the XYplorer htlm() script command
//and get the result into an variable called $myHTMLvar
$myHTMLvar = urldecode(html('
//compose a HTML page
<html>
<body>
<form method="get" action="xys:">
Replace: <INPUT TYPE="TEXT" NAME="InputONE" SIZE="80" VALUE="string (to search)"><BR>
With: <INPUT TYPE="TEXT" NAME="InputTWO" SIZE="80" VALUE="replace string"> <BR>
<BR><HR>
<p align="right"><INPUT type="submit" name="DoItButton" value=" DoIt " ></p>
</form>
</body>
</html>',"600", "400", "My HTML GUI"));
//end of the html() command
//----------------------------------------------------------------------------
// After the user clicked at one of the buttons, you have to parse the returning
// of this html() command which was stored into the $myHTMLvar variable:
//If the user clicked at [Close] of the XYplorer dialog:
end($myHTMLvar == ""), "Close pressed. Script will quit here.";
//else one of the type="submit" buttons are clicked:
msg "The script returned:<crlf 2>$myHTMLvar";
//so you will see an dialog like this:
/*
---------------------------
XYplorer
---------------------------
The script returned:
?InputONE=string (to search)&InputTWO=replace string&DoItButton= DoIt
---------------------------
OK
---------------------------
*/
//Note: without the urlDEcode() command the returning string would look like:
//?InputONE=string+%28to+search%29&InputTWO=replace+string&DoItButton=++++DoIt++++
//to continue the how-to INSERT HERE THE SECOND PART ==>
Code: Select all
//THE SECOND PART
//Now we split the content of the $myHTMLvar into parts.
//Since we already know the correct order of the returned NAME/VALUE pairs,
//(just as they appears in the html code) we do simple processing one by one.
//The content of the $myHTMLvar is like: ?NAME1=VALUE1&NAME2=VALUE2&NAME3=VALUE3
//So we split first at the ampersand sign &:
$FieldOne = gettoken($myHTMLvar, "1", "&");
$FieldTwo = gettoken($myHTMLvar, "2", "&");
//Test:
msg $FieldOne; //> ?InputONE=string (to search)
msg $FieldTwo; //> InputTWO=replace string
//Next we split at the equal sign =:
$FieldOne = gettoken($FieldOne, "2", "=");
$FieldTwo = gettoken($FieldTwo, "2", "=");
//Test:
msg $FieldOne; //> string (to search)
msg $FieldTwo; //> replace string

Code: Select all
rename s, "$FieldOne/$FieldTwo"; Code: Select all
VALUE="string (to search)"Code: Select all
VALUE="<curbase>"That is shown in the above linked post too:kiwichick wrote:Hi Stefan,
I don't get the basename in the 'Replace this' field, I just get <curbase>.
Code: Select all
<TEXTAREA WRAP=Off NAME="taINPUT" ROWS=14 COLS=90>'. "<get SelectedItemsPathNames>" .'</TEXTAREA> Code: Select all
Replace: <INPUT TYPE="TEXT" NAME="InputONE" SIZE="80" VALUE="string (to search)"><BR>Code: Select all
Replace: <INPUT TYPE="TEXT" NAME="InputONE" SIZE="80" VALUE="'."<curbase>".'"><BR>Code: Select all
<TEXTAREA >' . "<get SelectedItemsPathNames>" . '</TEXTAREA>Code: Select all
Replace: <INPUT TYPE="TEXT" NAME="InputONE" SIZE="80" VALUE=" ' . $myVar . ' "><BR>