{"id":4754,"date":"2021-02-03T09:22:30","date_gmt":"2021-02-03T14:22:30","guid":{"rendered":"https:\/\/blogs.mathworks.com\/videos\/?p=4754"},"modified":"2021-02-03T09:22:30","modified_gmt":"2021-02-03T14:22:30","slug":"autohotkey-shortcuts-for-the-matlab-editor","status":"publish","type":"post","link":"https:\/\/blogs.mathworks.com\/videos\/2021\/02\/03\/autohotkey-shortcuts-for-the-matlab-editor\/","title":{"rendered":"AutoHotkey Shortcuts for the MATLAB Editor"},"content":{"rendered":"<p>I created some <a href=\"https:\/\/www.autohotkey.com\/\">AutoHotkey <\/a>shortcuts to make it easier to execute arbitrary lines of code in the MATLAB Editor. They include:<\/p>\n<li><strong>Alt<\/strong>+<strong>Enter<\/strong>: Execute the line I am currently editing\/typing<\/li>\n<li><strong>Alt<\/strong>+<strong>Left Click<\/strong>: Execute the line just clicked<\/li>\n<li><strong>Alt<\/strong>+<strong>Mouse Select<\/strong>: Execute selected code<\/li>\n<p>Here, I&#8217;ll show you some examples of using them. AHK file is below.<\/p>\n<p><div class=\"row\"><div class=\"col-xs-12 containing-block\"><div class=\"bc-outer-container add_margin_20\"><videoplayer><div class=\"video-js-container\"><video data-video-id=\"6228318491001\" data-video-category=\"blog\" data-autostart=\"false\" data-account=\"62009828001\" data-omniture-account=\"mathwgbl\" data-player=\"rJ9XCz2Sx\" data-embed=\"default\" id=\"mathworks-brightcove-player\" class=\"video-js\" controls><\/video><script src=\"\/\/players.brightcove.net\/62009828001\/rJ9XCz2Sx_default\/index.min.js\"><\/script><script>if (typeof(playerLoaded) === 'undefined') {var playerLoaded = false;}(function isVideojsDefined() {if (typeof(videojs) !== 'undefined') {videojs(\"mathworks-brightcove-player\").on('loadedmetadata', function() {playerLoaded = true;});} else {setTimeout(isVideojsDefined, 10);}})();<\/script><\/div><\/videoplayer><\/div><\/div><\/div><\/p>\n<p>Play the video in full screen mode for a better viewing experience.\u00a0<\/p>\n<p>AutoHotkey  .ahk file is:<\/p>\n<pre>\r\n#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.\r\n#Warn  ; Enable warnings to assist with detecting common errors.\r\nSendMode Input  ; Recommended for new scripts due to its superior speed and reliability.\r\nSetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.\r\n#SingleInstance Force\r\n\r\n; Alt+Enter -> Execute current line of code using F9\r\n!Enter:: ; Alt+Enter\r\nSend, {End}\r\nSend, +{Home}\r\nSend, {F9}\r\nSend, {Home}\r\nreturn\r\n\r\n; Alt+Click, Alt+Click-Drag\/select -> Execute clicked line of code, or click-drag-selected lines of code using F9.\r\n~!LButton:: \r\n~!LButton Up:: ; Alt+Left Click Up (pass-through)\r\n\r\nif (A_TimeSincePriorHotkey<500){\r\n\t; Mouse click and drag-select\r\n\tSend, {End}\r\n\tSend, +{Home}\r\n\tSend, {F9}\r\n\tSend, {Home}\r\n} else {\r\n\t; Just Mouse click\r\n\tSend, {F9}\r\n}\r\nreturn\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<div class=\"thumbnail thumbnail_asset asset_overlay video\"><a href=\"https:\/\/blogs.mathworks.com\/videos\/2021\/02\/03\/autohotkey-shortcuts-for-the-matlab-editor\/?dir=autoplay\"><img decoding=\"async\" src=\"https:\/\/cf-images.us-east-1.prod.boltdns.net\/v1\/static\/62009828001\/7b449aa7-ce4c-470f-812f-ee50bb5949ce\/d077a6fb-dabf-40b1-82b7-0235b7ad8461\/1280x720\/match\/image.jpg\" onError=\"this.style.display ='none';\"\/><\/p>\n<div class=\"overlay_container\">\n      <span class=\"icon-video icon_color_null\"><time class=\"video_length\">11:49<\/time><\/span>\n      <\/div>\n<p>      <\/a><\/div>\n<p>I created some AutoHotkey shortcuts to make it easier to execute arbitrary lines of code in the MATLAB Editor. They include:<br \/>\nAlt+Enter: Execute the line I am currently editing\/typing<br \/>\nAlt+Left Click:&#8230; <a class=\"read-more\" href=\"https:\/\/blogs.mathworks.com\/videos\/2021\/02\/03\/autohotkey-shortcuts-for-the-matlab-editor\/\">read more >><\/a><\/p>\n","protected":false},"author":133,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[4],"tags":[],"_links":{"self":[{"href":"https:\/\/blogs.mathworks.com\/videos\/wp-json\/wp\/v2\/posts\/4754"}],"collection":[{"href":"https:\/\/blogs.mathworks.com\/videos\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.mathworks.com\/videos\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/videos\/wp-json\/wp\/v2\/users\/133"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/videos\/wp-json\/wp\/v2\/comments?post=4754"}],"version-history":[{"count":17,"href":"https:\/\/blogs.mathworks.com\/videos\/wp-json\/wp\/v2\/posts\/4754\/revisions"}],"predecessor-version":[{"id":4859,"href":"https:\/\/blogs.mathworks.com\/videos\/wp-json\/wp\/v2\/posts\/4754\/revisions\/4859"}],"wp:attachment":[{"href":"https:\/\/blogs.mathworks.com\/videos\/wp-json\/wp\/v2\/media?parent=4754"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/videos\/wp-json\/wp\/v2\/categories?post=4754"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/videos\/wp-json\/wp\/v2\/tags?post=4754"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}