Page 1 of 2

QuickGoto

Posted: 24 Oct 2008 11:52
by Pagat
Hi,

Download QuickGoto.xys Needs at least XY v7.90.0030

i finally wrote a little script that allows me to give files, folders or scripts a nickname to quickly access them via a "QuickGoTo" input box. The script (i named it "QuickGoTo.xys") has the following features:

There are different type of "targets":
  • GoTo
    Everyting that can be put in XYs address bar can be defined as "goto" target. Most of the time it will be a folder, but Visual filters, Name Searches, script commands, ... are also possible.
  • Open
    Here you can define a file that will be opened with the associated application
  • Load
    In this section you can define a XY-script which will be loaded directly.
Copy the below code into a "QuickGoTo.xys" file in the Scripts directory and you are good to go. If you load the script you will get the main menu (not many possibilities yet, but i have plenty of ideas). To quickly access the QuickGoTo inout box you should load the script with the "QuickGoTo" label. This will prompt you for an existing or new nickname. If it's a new one, you will be asked if you want to define this nickname as "goto", "open" or "load" target. Afterwards you can enter the file/folder (xy-vars allowed) (i kind of copied the "leave empty to browse" feature from jackys Automatic-Updater. Hope you don't mind jacky :) )

All nicknames and temporary settings will be saved into the "QuickGoTo.ini".

I have defined this script as a "Load Script File"-UDC with the label "QuickGoTo" so that i can get the QuickGoTo input with just one shortcut. Here are a few examples of what can be defined:


[GoTo]

Code: Select all

dl=D:\Downloads
By typing in "dl" into the input box, the script will take me to my downloads folder

Code: Select all

xy=<xypath>
-> will browse to xy's folder

Code: Select all

exe=|*.exe
will apply a visual filter that only shows exe files

Code: Select all

txt=?*.txt /r
will search for all text files in the current directory including subdirectories

Code: Select all

deltemp=::selfilter ""*.temp"", f; delete 1, 0, "":list"";
will delete all temp files in the current directory. Be careful if you enter script commands like that: You have to double all quotes!


[Open]

Code: Select all

pic=D:\asdf\jkl.jpg
will open jkl.JPG with the associated application


[Load]

Code: Select all

ini=INI Tweaks
will load the script "INI Tweaks.xys" from XYs script directory.

Code: Select all

ini=INI Tweaks, sec6
will load the script "INI Tweaks.xys" with the label "sec6".


:arrow: Update
Since Don added the command "readfile" today, i updated the script. It's now possible to edit the ini sections for "GoTo", "Open" and "Load" directly in the script. I also began to add a functionality to use the "standard goto" as a fallback when no defined nickname was found. I'm not satisfied yet with the result. Will keep you updated.

:arrow: Update 26.10.2008
One more update: A few changes in the general structure of the script. And there is now a setting to define what to do in case a nickname does not exist yet: Add it, use input as "goto" parameter or do nothing.
Inspired by serendipity i also added the capability to define a label if a script is defined as "load" target. E.g.:

Code: Select all

ini=INI Tweaks, sec6
will load the script "INI Tweaks.xys" with the label "sec6".

You need at least XY v7.70.0007 to run this script.

:arrow: Update 03.11.2008
Added support for custom "variables" to the targets:
You can also use variables inside a target. A variable has to be surrounded by a forward slash (/) to be recognized. E.g. you can define the following 'open' nickname:

report=C:\Reports\Report 2008-/Month/.xls

If you now use the nickname 'report' you will be prompted to input a value for 'Month'. This value will replace '/Month/' in the target, resulting in 'C:\Reports\Report 2008-10.xls' for example. Therefore you can define one nickname for similiar targets.
You need at least XY v7.70.0010 to run this script.

:arrow: Update 08.01.2009

Latest changes:

Code: Select all

  v0.01.0005  2009.01.08  XY v7.80.0032
    + If a comma (',') is found in an 'open' target, it is handled through the
      command 'openwith'. The part before ',' is the executable, the part after
      ',' the parameter
    + Added automatic update support for the script through jacky's XYAU
You need at least XY v7.80.0032 to run this script.

:arrow: Update 09.01.2009

Latest changes:

Code: Select all

	v0.01.0006	2009.01.09	XY v7.90.0030  CJ v0.01.0002
		! Renamed INI section 'Setup' to 'Settings' and key 'NicknameExists' to
			'OnNewNickname'
		+ The character for separating executable from parameter ('open' target) and
			script file from label ('load' target) respectively can be changed to any
			character in the settings (defaults to comma (',')
		+ The character used to recognize inline variables (default is a slash ('/')
			can be changed to any character in the settings
		+ New settings dialog using XYs new 'html' function
		+ New Help page using XYs new 'html' function
You need at least XY v7.90.0030 to run this script.

Re: QuickGoto

Posted: 24 Oct 2008 15:11
by eurytos
very nice I will have to play with this.

Thanks for posting it!

Re: QuickGoto

Posted: 25 Oct 2008 00:10
by Pagat
:arrow: Update
Since Don added the command "readfile" today, i updated the script. It's now possible to edit the ini sections for "GoTo", "Open" and "Load" directly in the script. I also began to add a functionality to use the "standard goto" as a fallback when no defined nickname was found. I'm not satisfied yet with the result. Will keep you updated.

You need at least XY v7.70.0007 to run this script.

Re: QuickGoto

Posted: 25 Oct 2008 02:38
by jacky
Yeah, that's a cool idea & very nice script! :D

Well done, Pagat.
Actually, so much that I decided to make myself a similar script as well, though I don't use sections like you did, just one alias for one script, fits my needs better :)

Re: QuickGoto

Posted: 25 Oct 2008 09:51
by admin
Very nice indeed! Nicknames (aliases) have been wished since long. Now reading your code I suddenly have an idea how this could be implemented quite easily with only a few rules. Would work through the AB (and all other "location ports").

The whole task is to decide whether the entered string is a nickname or not (the replacing and managing via LM is trivial).

Idea 1: If there are only characters a-z then it's a nickname. This would only collide with browsing to folders relative to app path (and who would ever need this?) and if those folders have the same name as an existing nickname.

Idea 2: Same as Idea1 but start nicknames with a "-". Less collisions with relative folders, and more important: you'll get the MRU list in the AB showing all recent nicknames (all stuff starting with "-").

Anybody interested? This is a feature for AB maniacs...

Re: QuickGoto

Posted: 25 Oct 2008 10:57
by globuli
admin wrote:Anybody interested? This is a feature for AB maniacs...
I'm a newbie here, so I don't really understand Scripts, etc. yet.

But would that mean that this target could be a folder, a file, a VisualFilter, a Script, etc?
So that, if I enter "-ff" it would open Firefox, if I enter "-xy" it would open the XYplorer folder, and so on...

Would it be possible to implement the function "open in new tab"? E.g. by entering "--xy" instead of "-xy".

I think that would be so cool, that I couldn't resist to buy a license. ;-)

Re: QuickGoto

Posted: 25 Oct 2008 11:44
by admin
globuli wrote:
admin wrote:Anybody interested? This is a feature for AB maniacs...
I'm a newbie here, so I don't really understand Scripts, etc. yet.

But would that mean that this target could be a folder, a file, a VisualFilter, a Script, etc?
So that, if I enter "-ff" it would open Firefox, if I enter "-xy" it would open the XYplorer folder, and so on...

Would it be possible to implement the function "open in new tab"? E.g. by entering "--xy" instead of "-xy".

I think that would be so cool, that I couldn't resist to buy a license. ;-)
Welcome!

Everything would be possible, since the AB in XY is extremely powerful. The nickname would be replaced by any string you want (= you had previously defined) before processing proceeds as if you had entered that string directly.

Re: QuickGoto

Posted: 25 Oct 2008 15:49
by serendipity
admin wrote:Very nice indeed! Nicknames (aliases) have been wished since long. Now reading your code I suddenly have an idea how this could be implemented quite easily with only a few rules. Would work through the AB (and all other "location ports").

The whole task is to decide whether the entered string is a nickname or not (the replacing and managing via LM is trivial).

Idea 1: If there are only characters a-z then it's a nickname. This would only collide with browsing to folders relative to app path (and who would ever need this?) and if those folders have the same name as an existing nickname.

Idea 2: Same as Idea1 but start nicknames with a "-". Less collisions with relative folders, and more important: you'll get the MRU list in the AB showing all recent nicknames (all stuff starting with "-").

Anybody interested? This is a feature for AB maniacs...
I would be interested too. Especially since it will have LM, MRU. And I can get rid of my custom made input method :).

Code: Select all

   input $alias, "Enter your alias.", xm;
   load "MyScripts", $alias;
   

Re: QuickGoto

Posted: 25 Oct 2008 16:06
by j_c_hallgren
globuli wrote:I think that would be so cool, that I couldn't resist to buy a license. ;-)
Admin/Don has already said welcome, but I'll second that and thank you for your purchase! I'm sure that you'll find us a very friendly group here and your participation is encouraged.

Re topic: Isnt't this similar to the ability with some customized toolbars in IE/FF that recognize certain shortcuts in those AB's? Which can prove quite handy!

I agree that the use of a "-" prefix to trigger it, while making the overhead of one extra char, reduces chance of collisions with other options/choices/faetures.

Re: QuickGoto

Posted: 26 Oct 2008 23:03
by Pagat
Update to the script:

A few changes in the general structure of the script. And there is now a setting to define what to do in case a nickname does not exist yet: Add it, use input as "goto" parameter or do nothing.

@Don: Somehow i don't like a mandatory "-" before the alias/nickname. That slows down the input...

Re: QuickGoto

Posted: 26 Oct 2008 23:39
by Pagat
Update to the update:

Inspired by serendipity i also added the capability to define a label if a script is defined as "load" target. E.g.:

Code: Select all

ini=INI Tweaks, sec6
will load the script "INI Tweaks.xys" with the label "sec6".

I hope everything works as it should. Will test everything more thoroughly tomorow...

Re: QuickGoto

Posted: 27 Oct 2008 07:54
by admin
Pagat wrote:@Don: Somehow i don't like a mandatory "-" before the alias/nickname. That slows down the input...
Yep, agreed. Also I had a better idea in the meantime: There could be a special key in the AB (like F4 is special in the AB), say Ctrl+- or so, to open a dropdown with all defined nicknames/aliases. But I'd consider the dropdown thing as secondary, since the whole idea of nicknames is that you can quickly type them by heart, so a rather mousy interface like a list does not really cut it.

BTW, nicknames/aliases: which would be the better term in your opinion?

Re: QuickGoto

Posted: 27 Oct 2008 08:28
by j_c_hallgren
admin wrote:BTW, nicknames/aliases: which would be the better term in your opinion?
I believe that I've seen both terms used in this context, so either one would work for me.

Are there cases where by not using a special prefix would cause possible confusion as to what is intended? As having to use a non-Enter key to trigger it could be also hard to recall for occasional users.

Re: QuickGoto

Posted: 27 Oct 2008 08:52
by admin
j_c_hallgren wrote:
admin wrote:BTW, nicknames/aliases: which would be the better term in your opinion?
I believe that I've seen both terms used in this context, so either one would work for me.

Are there cases where by not using a special prefix would cause possible confusion as to what is intended? As having to use a non-Enter key to trigger it could be also hard to recall for occasional users.
In a standard XY installation, you have 3 subfolders in the app folder:
FindTemplates
NewItems
Scripts

If you use any of these as nicknames (including correct capitalization) there will be conflicts. Now I could additionally enforce a backslash to relative-path-browsing (so you'd have to enter "Scripts\" to browse to "<xypath>\Scripts\", then no conflicts would be possible at all.

I was not talking about a non-Enter key to trigger it, but to open a list of nicknames. The nicknames will be triggered by Enter.

Re: QuickGoto

Posted: 27 Oct 2008 09:17
by Pagat
admin wrote:BTW, nicknames/aliases: which would be the better term in your opinion?
Since i'm an Opera user and this feature is called "nickname" in the Opera-World, i'm more used to that term. That's also the reason why i called it that way in my script.

I'd also say that "nickname" is clearer for "beginners" than "alias" but i might be biased...