{"id":216,"date":"2024-10-16T08:39:51","date_gmt":"2024-10-16T08:39:51","guid":{"rendered":"https:\/\/www.woojin.help\/?p=216"},"modified":"2024-12-16T14:23:58","modified_gmt":"2024-12-16T14:23:58","slug":"macro-recorder-linux","status":"publish","type":"post","link":"https:\/\/www.woojin.help\/ko\/macro-recorder-linux\/","title":{"rendered":"\ub9e4\ud06c\ub85c \ub808\ucf54\ub354 \ub9ac\ub205\uc2a4"},"content":{"rendered":"<div class=\"pdfprnt-buttons pdfprnt-buttons-post pdfprnt-top-right\"><\/div>\n<h3 class=\"wp-block-heading\">Description:<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">GNU Xnee is a suite of programs that can record, replay, and distribute user actions under the X11 window system (Linux graphical user interface). We use this tool to set up and run click simulation macros on Linux images.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Installation<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Open a terminal window from the Desktop<\/li>\n\n\n\n<li>Update the system repositories:<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<pre class=\"wp-block-code has-background\" style=\"background-color:#0d0d0d\"><code>sudo apt update<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">(if promped for a password use 00000000)<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Install Xnee<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code has-background\" style=\"background-color:#0d0d0d\"><code>sudo apt install xnee<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Recording a mouse macro<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>connect a USB mouse to the system<\/li>\n\n\n\n<li>open the terminal <\/li>\n\n\n\n<li>open the visualisation and press <code><mark style=\"background-color:#424242\" class=\"has-inline-color has-ast-global-color-5-color\"> Alt + Tab <\/mark><\/code> to display the terminal window on top of it<\/li>\n\n\n\n<li>input the following command into the terminal and press <code><mark style=\"background-color:#424242\" class=\"has-inline-color has-ast-global-color-5-color\"> Enter <\/mark><\/code> to start recording<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code has-background\" style=\"background-color:#0d0d0d\"><code>cnee --record --mouse -o macro.xns<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li>once you are done recording your clicks press <code><mark style=\"background-color:#424242\" class=\"has-inline-color has-ast-global-color-5-color\"> Alt + Tab <\/mark><\/code> to switch back to the terminal<\/li>\n\n\n\n<li>press <code><mark style=\"background-color:#424242\" class=\"has-inline-color has-ast-global-color-5-color\"> Ctrl + C <\/mark><\/code> to stop the macro recording<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Now you have a file called <code><mark style=\"background-color:#424242\" class=\"has-inline-color has-ast-global-color-5-color\"> macro.xns <\/mark><\/code> that contains the recorded actions in the <code><mark style=\"background-color:#424242\" class=\"has-inline-color has-ast-global-color-5-color\"> \/home\/woojin <\/mark><\/code> directory.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Replaying the macro<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">To replay the we first need to set up a bash script. Follow the next steps to do this:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>open the <code><mark style=\"background-color:#424242\" class=\"has-inline-color has-ast-global-color-5-color\"> \/home\/woojin <\/mark><\/code> directory<\/li>\n\n\n\n<li>right click and select <code><mark style=\"background-color:#424242\" class=\"has-inline-color has-ast-global-color-5-color\"> Create New.. <\/mark> -> <mark style=\"background-color:#424242\" class=\"has-inline-color has-ast-global-color-5-color\"> Empty File <\/mark><\/code><\/li>\n\n\n\n<li>chose a name, for example <code><mark style=\"background-color:#424242\" class=\"has-inline-color has-ast-global-color-5-color\"> MacroLoop.sh <\/mark><\/code><\/li>\n\n\n\n<li>right click on the file and open it with Visual Studio Code<\/li>\n\n\n\n<li>write the following code inside and save the file:<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code has-background\" style=\"background-color:#0d0d0d\"><code>#!\/bin\/bash\n# Infinite loop to replay the macro\n\nkeep_running=1\n\nwhile &#91; $keep_running -eq 1 ]\ndo\n    cnee --replay --file macro.xnl --stop-key q\n    \n    if &#91; $? -ne 0 ]; then\n       keep_running=0\n       break\n    fi\n\n    sleep 5  \ndone<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li>make the script executable with the following command in terminal:<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code has-background\" style=\"background-color:#0d0d0d\"><code>chmod +x MacroLoop.sh<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li>open the terminal <\/li>\n\n\n\n<li>open the visualisation and press <code><mark style=\"background-color:#424242\" class=\"has-inline-color has-ast-global-color-5-color\"> Alt + Tab <\/mark><\/code> to display the terminal window on top of it<\/li>\n\n\n\n<li>input the following command into the terminal and press <code><mark style=\"background-color:#424242\" class=\"has-inline-color has-ast-global-color-5-color\"> Enter <\/mark><\/code> to start recording<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code has-background\" style=\"background-color:#0d0d0d\"><code>.\/MacroLoop.sh<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Stopping the macro<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">By defaul the macro will run in an endless loop. To stop the execution of the macro press <code><mark style=\"background-color:var(--ast-global-color-3)\" class=\"has-inline-color has-ast-global-color-5-color\">Q<\/mark><\/code> key. This will stop the execution for 5 seconds. In this time you can either press  <code><mark style=\"background-color:#424242\" class=\"has-inline-color has-ast-global-color-5-color\"> Alt + Tab <\/mark><\/code>  to display the terminal window again, and then stop the macro execution with  <code><mark style=\"background-color:#424242\" class=\"has-inline-color has-ast-global-color-5-color\"> Ctrl + C <\/mark><\/code> . If you don&#8217;t stop it in these 5 seconds window, the macro will be executed again.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>","protected":false},"excerpt":{"rendered":"<p>Description: GNU Xnee is a suite of programs that can record, replay, and distribute user actions under the X11 window [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[1],"tags":[],"class_list":["post-216","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/www.woojin.help\/ko\/wp-json\/wp\/v2\/posts\/216","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.woojin.help\/ko\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.woojin.help\/ko\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.woojin.help\/ko\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.woojin.help\/ko\/wp-json\/wp\/v2\/comments?post=216"}],"version-history":[{"count":3,"href":"https:\/\/www.woojin.help\/ko\/wp-json\/wp\/v2\/posts\/216\/revisions"}],"predecessor-version":[{"id":361,"href":"https:\/\/www.woojin.help\/ko\/wp-json\/wp\/v2\/posts\/216\/revisions\/361"}],"wp:attachment":[{"href":"https:\/\/www.woojin.help\/ko\/wp-json\/wp\/v2\/media?parent=216"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.woojin.help\/ko\/wp-json\/wp\/v2\/categories?post=216"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.woojin.help\/ko\/wp-json\/wp\/v2\/tags?post=216"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}