Scripting: shortcut to re-use very last script

Features wanted...
Post Reply
Stefan
Posts: 1360
Joined: 18 Nov 2008 21:47
Location: Europe

Scripting: shortcut to re-use very last script

Post by Stefan »

Hi, is there a way XY could store and remember last used script
so i can add an shortcut to just execute last used script, whatever it was?

f.ex.
- i load an script or execute one from menu
- later i want to use the same script again, here i just want to press an shortcut to use last script

I don't want to assign an shortcut for ever single script
I don't want to put the script into the menu or catalog
...because i may use this script only now and then


I just want to load an script once and execute it several times
(also nice for editing and saving an script with an favorite editor and execute it inside XY per last-used-script shortcut)


What do you think?

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

Re: Scripting: shortcut to re-use very last script

Post by admin »

Stefan wrote:What do you think?
I think, uh, about it... :)

jjk
Posts: 202
Joined: 10 Oct 2007 20:11
Location: Paris

Re: Scripting: shortcut to re-use very last script

Post by jjk »

Support also.

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

Re: Scripting: shortcut to re-use very last script

Post by Stefan »

Stefan wrote: I just want to load an script once and execute it several times
(also nice for editing and saving an script with an favorite editor and execute it inside XY per last-used-script shortcut)
Solved by using MRU feature.
v8.10.0010 - 2009-08-04 17:17

* Address Bar: Experimentally quick scripts entered through the
Address Bar are now added to the Address Bar's MRU. Might save you
lots of typing depending on your work style.
EX.:
::load "<xypath>\scripts\htmltest.xys"


Thanks Don.

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

Re: Scripting: shortcut to re-use very last script

Post by Stefan »

Is there already such feature or could i suggest this now:

Current:
To load/execute an script i use ::load "<xypath>\scripts\htmltest.xys"


Idea:
What's about an trigger to just look for what i have typed after ::
and interpret this as looking for an script in "<xypath>\scripts\" ?

I mean smtg like:
:::ht<TAB>

and get an drop-down list of all scripts inside xy script folder starting with "ht".
Just choose the right one and execute by pressing enter.


What do you think?

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

Re: Scripting: shortcut to re-use very last script

Post by admin »

(To quote Heidi Klum:) Hmmmmmmmmmmmmmmmmmmmmmmm, no.

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

Re: Scripting: shortcut to re-use very last script

Post by Stefan »

:D
You mean
Hmmmmmmmmmmmmmmmmmmmmmmm, no. it's not implemented right now *wondering* but good idea

or no, not from interests to quickly access an rarely used script that way *evenmorewondering* just provide the full path

?

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

Re: Scripting: shortcut to re-use very last script

Post by admin »

Stefan wrote::D
You mean
Hmmmmmmmmmmmmmmmmmmmmmmm, no. it's not implemented right now *wondering* but good idea

or no, not from interests to quickly access an rarely used script that way *evenmorewondering* just provide the full path

?
I mean "no" as in "I have other things to do" AND "I don't like it" AND "I have no time to explain why". :mrgreen:

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

Re: Scripting: shortcut to re-use very last script

Post by Stefan »

WOW, what an explanation :D


O.K. thanks.

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

Re: Scripting: shortcut to re-use very last script

Post by Stefan »

Stefan wrote: Current:
To load/execute an script i use ::load "<xypath>\scripts\htmltest.xys"
Just learned from jacky that using "::load name" is enough to execute an script (inside <xypath>\scripts\).

Thanks.

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

Re: Scripting: shortcut to re-use very last script

Post by Stefan »

Another idea:

- i am on dual pane
- i have an script selected on the left pane
- i have on the right a few files selected

- i execute "Scripting > Load Selected Script File"
but since the script is in the inactive pane this didn't work.
I see i could tweak the script by adding focus "PI"; , but ...


So how about an another menu item
"Scripting > Load Selected Script File from other pane"
or like that?
Or
"Scripting > Execute script on the other panel"

That way we could browse on the left our scripts and select one rarely used
and on the right our files on which we want to execute the script.

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

Re: Scripting: shortcut to re-use very last script

Post by admin »

Stefan wrote:Another idea:

- i am on dual pane
- i have an script selected on the left pane
- i have on the right a few files selected

- i execute "Scripting > Load Selected Script File"
but since the script is in the inactive pane this didn't work.
I see i could tweak the script by adding focus "PI"; , but ...


So how about an another menu item
"Scripting > Load Selected Script File from other pane"
or like that?
Or
"Scripting > Execute script on the other panel"

That way we could browse on the left our scripts and select one rarely used
and on the right our files on which we want to execute the script.
Naah, bloat. Use some global interface for this kind of stuff, e.g. the catalog, favorites, or UDC, and now even User Buttons. There are enough possibilities.

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

Re: Scripting: shortcut to re-use very last script

Post by Stefan »

>Naah, bloat.
I think not (of course :D )

> and now even User Buttons.
Thanks for that!

> There are enough possibilities.
But mostly all have to set up first and removed later again.

I try to suggest an easier way to browse, edit, chose and execute scripts on the fly.
Using DP with one pane as big list of all available scripts
and the other to chose the files to manipulate with would be very handy in my POV.

I will try to create an script add-on like <If self,path==scripts Then focus "PI"> or like that
but i think smtg like that should be an integrated feature to increase usability :wink:

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

Re: Scripting: shortcut to re-use very last script

Post by TheQwerty »

Code: Select all

"Load Inactive Pane's Focus As Script File"
	$err = "";

	Focus("PI");
	$fi = "<focitem>";
	Focus("PI");
	Self($self, "File");
	if (Compare("$fi", "$self", "i")) {
		if (Exists("$fi") == 1) {
			SubStr($ext, "$fi", -4);
			if ("$ext" LikeI ".xys") {
				Status("Loading: $fi",, "ready");
				Load("$fi");
			} else {
				$err = "ERROR: Focused item is not an .xys.";
			}
		} else {
			$err = "ERROR: Focused item is not a file.";
		}
	} else {
		$err = "ERROR: Fell in Recursive Rabbit Hole!";
	}

	if ($err) {
		Global($result);
		Sub("_getMarkedColor");
		Status("$err", "$result", "alert");
	}


//Get the user defined value for marked text 2
"_getMarkedColor"
	Global($result);
	GetKey($result, "clrMarkedTextHex", "TEMP SCRIPT SETINGS");
	if ($result LikeI "") {
		Global($decVal);
		GetKey($decVal, "clrMarkedText", "General");
		Sub("_dec2hex");
		SetKey($result, "clrMarkedTextHex", "TEMP SCRIPT SETINGS");
	}

//Convert decimal value to hex
"_dec2hex"
	Global($decVal, $result);
	$result = "";

	$place = 1;
	while ($decVal > $place*16) { $place = $place * 16; }

	while ($place >= 1) {
		$digit = $decVal / $place;
		$decVal	= ("0." . GetToken("$digit", 2, ".")) * $place;
		$digit	= GetToken($digit, 1, ".");
		if ($digit > 15) { $digit = 15; }
		SubStr($digit, "0123456789ABCDEF", $digit, 1);
		$result = "$result$digit";
		$place = $place / 16;
	}
This is overly complicated just for the heck of it. :twisted:
You could take out the error checking and other "fun" stuff to trim it down to just:

Code: Select all

"Load Inactive Focused Script"
	Focus("PI");
	$fi = "<focitem>";
	Focus("PI");
	Load("$fi");

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

Re: Scripting: shortcut to re-use very last script

Post by Stefan »

He thanks TheQwerty!

Works just fine:

Code: Select all

// Posted: 09 Sep 2009 21:14 by TheQwerty
// http://www.xyplorer.com/xyfc/viewtopic.php?f=5&t=3733&p=36881#p36881

// add this script to UDC and assign an shortcut to it
// on one side select desired script, 
// on the ohter side select files, 
// then press shortcut to execute this very script  to execute first selected script

"Load Inactive Focused Script"
   Focus("PI");
   $fi = "<focitem>";
   Focus("PI");
   Load("$fi");
"Run this Script with Inactive Focused files"
   $fi = "<focitem>";
   Focus("PI");
   Load("$fi");   
"Edit this &script : edit"
   self $ScriptFile, file;
   OpenWith "<xypath>\Tools\NotePad2\Notepad2.exe", ,$ScriptFile;
Something like this i had in mind.

---

Now i try how an script with just this snipped will work for me the next days:

Code: Select all

/*
1. select files
2. select script to load
3. press shortcut to execute THIS script
*/
   $fi = "<focitem>";
   Focus("PI");
   Load("$fi");   
I have assigned an shortcut to this
which i press instead of "Scripting > Load Selected Script File"
when i want to do what i have described above :D

---

for your first code i have nothing to say right now.... needs some more time for this :roll:

Post Reply