• Become a Power user Intro to AutoHotkey Intermediate AutoHotkey Intermediate Objects GUIs are Easy w/AutoHotkey Painlessly switch from V1 to V2

LaunchEditor: Easily launch and jump to a specific line in your favorite editor

This function allows you to launch a running script with the default editor and jump to a specific line on that script.
It does the same action as the “Edit Script” menu option but with the added benefit of jumping to where you want to edit.

Jump to Line in your favorite Editor
Jump to Line in your favorite Editor

The video demonstrates a method to automatically open and connect a running script to an editor, allowing users to easily jump to specific lines in the script, and recommends switching to V2 of the script.

  • 00:00 📝 The video demonstrates a method to automatically open and connect a running script to an editor, allowing users to easily jump to specific lines in the script.
  • 00:52 📝 A function was created to jump to a specific line in an editor, allowing for quick editing of scripts.
  • 02:14 📝 You can pass a handle (such as a GUI or window title) and a line number to jump to in your favorite editor, and it will automatically open and select that line.
  • 03:51 📝 Open your editor, jump to a specific line in a file, and select the line, which is useful for searching and editing files.
  • 05:06 📝 The speaker discusses the differences between V1 and V2 in a coding course, highlighting that while the codes may look similar, there are subtle differences that are explained in the V1 to V2 transition.
  • 05:58 📝 The use of quotation marks and percent signs in different parts of the code can affect the functionality and understanding of the script.
  • 07:26 💡 Everything is an expression in V2, so if you need text, you have to use quotation marks, making it simpler to follow along and avoid confusion.
  • 08:11 📝 The speaker recommends switching to V2 of the script as V1 is deprecated and no longer being developed.

Transcripts to Easily jump to specific line in your favorite editor

hey everyone Joe Glines and Isaias Baez here from the-Automator and today we’re demonstrating providing a URL so stick around if you want to get this download it’s pretty coolit allows you to have a running script and automatically connect that script and pop it open in one of at least I think we have three default editors and then if not it’ll just jump to the line is that right is as 5 number right different approaches yeah well in general it will open the so let me let me kind of like explain if you have a script here and you right
click on it and hit edit script it usually opens on your default AutoHotkey editor right yeah so yeah but what happens is we had a very special case a very special need in one of our scripts it was here we have AHKHotkeystringlookup tool and one of the things that we were doing is that for for each file that we found scripts on we also found which line thatHotkey was at and what we wanted to do is do the edit command but also jump to the line where that is so we created a little function this is the function that we have right here
um from that HK script lookup tool that grabbed the row on that list view that I showed yousend the edit command and so on and need then to your point we had different actions for different editors and if it was not one of those three editors it would do the general action of pressing Ctrl G and jumping to the line because most editors if you press Ctrl G it lets you jump to a specific line in your code that’s what it does so this is what it we we have this function when you double click on one of these guys it would just
go ahead and open it up in yAuto default script and as you can see just jump to the line and selected that line for me it allowed me to edit that script very quickly now what we did now is that we converted that to ourHotkey V2 and I modified it a little bit I modified the function a little bit so that it was not from a list view because that was my special case now what you have to do is pass the handle to the script that you want to edit and the line that you want to jump to in this instance I’m just creating a GUI
like this and just passing the GUI because in V2 you can pass a GUI to one of the send message commands or the win active commands to those kind of guys you just pass the GUI itself and it takes the handle of the GUI automatically for you but you can use a window title you can use the active window whatever you want you just have to make sure you pass a handle to my script that’s to the function it could be anything you want it could be a window title or a handle and then the line that you want to jump to in this
example I created a GUI so that this script has a handle and then I pass at line 21. if I run the script it would open the GUI and notice how it jumped to line 21 and selected it I could just click up here let’s do it again F9 and it would just jump to that line and select it funny thing though if I grab this exact code and put it in a differenteditor like this one here and I run it it would open it in a different editor or probably let me see let me try it let me see what it’s going to do right it opened it in vs code and it
jumped to that line if I had site open I noticed that if I had Side open like this let me save this and I run it it would open inside let me see if I do this run it would open inside and then jump to the line 21 and actually capture it inside so it doesn’t matter which editor you have it would just go ahead and open that editor and jump to that line and make it you know select the line when we were talking before we started recording I was like I would use this it was a very use case but then it dawned on me like I used
grepwin a lot for searching across files and giving a list of files and then I’ll see the content but then I I’m like oh it’s in that file and I’ll go to edit but then I have to go find that text in there after I jumped it but someone could use this you can use it yeah you can do that so if if Wing rep gives you the file name which is probably but here’s the thing this only works with running scripts though because it is sending the edit message to that script it could be adapted though it could be
adapted to actually read the file if that here is not a handle and it is a path if the file exists then it would just open that file in your editor and then just go ahead and jump to the line because that can still be done so in any case yeah that’s a very good use case hey that gives me the file underline number I have the two things then let’s pass the file and the line number and let’s make it just open that so yeah so yeah if you want to learn more about this kind of stuff I think that like the
V1 to V2 transition course is a good one to starthere we were talking I don’t know if you want to go into a little bit of the differences between V1 and V2 here butit’s interesting quite interesting yeah yeah I was just going to say it’s interesting because in this particular instance if you take a look at both of the codes the difference is not much I’m still sending a message you see the send message here I’m using the win-weight active you might find the win wait hereand so on so that if you see these if
statements they look almost the same as here so there the differences are not that hard that you cannot understand the code so but there are some very subtle differences that we goum we we talk about in the V1 to V2 transition like for example here when I’m using the send command notice that the Control G is in quotation marks the variable is not and the other part is in quotation marks in V1 is totally the opposite the Control G is not quoted but the variable has to be surrounded by percent signs it and the answer is not
so so there’s two probabilities that you have to use the window Snipping tool to grab that real quickly and then right just show it that would fix it and now I go herehere we go so yes this one here it’s a little bit harder to follow what is going on and if you miss the percent signs or if you don’t know what they are you might not understand why if you pass a script line it’s not actually giving you the number or whatever right in this case it is obvious that this is text this is not text and this is text it’s
actually kind of obvious and and yeah it’s not something that you will miss in this case you might miss itin some other instances like here you will notice that this here script line minus one this is an expression there so there’s math involved there but notice that this looks very similar to that right totally different this is an expression and this is not this actual text if you try to do math there it’s gonna fail that’s one of the things that V1 was very tricky one parameter was an
expression but the other one wasn’t here it’s not like that everything is an expression so if you want X you have to put the quotation marks to make sure that that is text and look how different they look this is text this is not text is very clear at the first glance of what is going on so those kind of subtleties we talk about them in in the V1 onto V2 transition and for us for me it’s a personal opinion the fact that it is more consistent everything is an expression if you need text you have to
put quotation marks wherever you are it makes it simpler to follow along and not know like oh this is an expression but this one isn’t and and why is it not failing oh you know those kind of things well and also in V2 if you had a single quote in your text you could just encapsulate the double or flip it but in V1 oh it’s so ugly yeah that’s right that’s right now we talk about those things in the hero group very often I guess yeah they ask about certain things that we go ahead and kind of like
explain regarding this all right so thanks everyone please like the video If you learned something here I’ll put the URL where you can get this this either version the V1 or V2 of the script we do highly recommend you switch to V2 it’syou know v1’s deprecated even though we’re leaving a lot of our stuff in it we’re not developing our new stuff in it so the new stuff goes into V2 leaving our old stuff in V1 but hope you enjoyed that thank you

You might be interested in:

AHK v1 to v2 Transition Course

$59.99

  All of our courses are sold with a 30 day Double your money back guarantee! If you are unhappy with the course for any reason within the first 30 days, you…

Continue reading

Functions, Objects, and Classes Course: For AHK V1 and V2

$99.99

Want 25% off? All of our courses are sold with a 30 day Double your money back guarantee! If you are unhappy with the course for any reason within the first 30…

Continue reading

AHK Hero Club

$15.99

  1 Month Trial – $1.99 AHK Heroes First off, thank you so much for watching our videos and joining our calls!  We love helping people automate the mundane!  Unfortunately,…

Continue reading

Comments are closed.