# Open a folder or run a file with an action using Autohotkey

**URL:** https://community.mp3tag.de/t/open-a-folder-or-run-a-file-with-an-action-using-autohotkey/58256
**Category:** General Discussion
**Created:** [August 21, 2022, 1:01am UTC](https://community.mp3tag.de/t/open-a-folder-or-run-a-file-with-an-action-using-autohotkey/58256 "2022-08-21T01:01:20Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![Stem75](https://community.mp3tag.de/user_avatar/community.mp3tag.de/stem75/32/5007_2.png) [@Stem75](https://community.mp3tag.de/u/Stem75)
#### Post date: [August 21, 2022, 1:01am UTC](https://community.mp3tag.de/t/open-a-folder-or-run-a-file-with-an-action-using-autohotkey/58256/1 "2022-08-21T01:01:20Z")

</div>

My solution for opening a folder or running a file without touching anything from inside mp3tag when i need it with the help of Autohotkey

------------------------------ EXAMPLE ------------------------------

Create a folder C:\Test

* * *

Create ( Open folder.bat ) file and enter this:

start "" "C:\Test"  
del "C:\Test\Blank.txt"

* * *

Go to mp3tag:

```
File - Options - export

and create a new export configuration and name it ( Blank )

enter this:

$filename(C:\Test\Blank.txt,utf-8)

```

Then go to actions and create a new action group:

```
Temp

inside Temp create a new action type:

Export

and select the newly created export configuration ( Blank )

```

* * *

Create an ( Open folder.ahk ) file in the same folder C:\Test

and enter this:

> #SingleInstance  
> #Persistent  
> SetTimer, Launch, 1000  
> return
> 
> Launch:  
> ifExist, C:\Test\Blank.txt  
> {  
> run, C:\Test\Open folder.bat  
> SetTimer, Launch, Off  
> SetTimer, Relaunch, 1000  
> }
> 
> Relaunch:  
> ifNotExist, C:\Test\Blank.txt  
> {  
> SetTimer, Launch, 1000  
> }

You can make it an exe and have it run automatically when windows start

The script is not mine

Now if you go to Actions and select/run the Temp action the folder will open up

---

<div class="post-metadata">

### Author: ![ohrenkino](https://community.mp3tag.de/user_avatar/community.mp3tag.de/ohrenkino/32/4843_2.png) [@ohrenkino](https://community.mp3tag.de/u/ohrenkino)
#### Post date: [August 21, 2022, 7:33am UTC](https://community.mp3tag.de/t/open-a-folder-or-run-a-file-with-an-action-using-autohotkey/58256/2 "2022-08-21T07:33:48Z")

</div>

> [@Stem75](#):
>
> opening a folder or running a file ...when i need it

Did you know that there is a function in the file list context menu "Open containing folder" ...  
I honestly do not have any idea when a function like the one that you described should be more useful than the built-in function in MP3tag or the keyboard shortcut Windows-Key E to open the Windows explorer in its start folder.

---

<div class="post-metadata">

### Author: ![Stem75](https://community.mp3tag.de/user_avatar/community.mp3tag.de/stem75/32/5007_2.png) [@Stem75](https://community.mp3tag.de/u/Stem75)
#### Post date: [August 21, 2022, 7:51am UTC](https://community.mp3tag.de/t/open-a-folder-or-run-a-file-with-an-action-using-autohotkey/58256/3 "2022-08-21T07:51:15Z")

</div>

Do you mean:

right click - tools - open in explorer

---

<div class="post-metadata">

### Author: ![ohrenkino](https://community.mp3tag.de/user_avatar/community.mp3tag.de/ohrenkino/32/4843_2.png) [@ohrenkino](https://community.mp3tag.de/u/ohrenkino)
#### Post date: [August 21, 2022, 7:55am UTC](https://community.mp3tag.de/t/open-a-folder-or-run-a-file-with-an-action-using-autohotkey/58256/4 "2022-08-21T07:55:55Z")

</div>

No,  
Right-click on a file in the file list,  
then for me it is the second function from the top: "Open in Explorer".

This function has been introduced in 2021:  
[2021-12-07] NEW: added option to open files in Explorer via 'File \> Open in Explorer' or context menu.

---

<div class="post-metadata">

### Author: ![Stem75](https://community.mp3tag.de/user_avatar/community.mp3tag.de/stem75/32/5007_2.png) [@Stem75](https://community.mp3tag.de/u/Stem75)
#### Post date: [August 21, 2022, 8:23am UTC](https://community.mp3tag.de/t/open-a-folder-or-run-a-file-with-an-action-using-autohotkey/58256/5 "2022-08-21T08:23:22Z")

</div>

OK. I was using v3.11 version. I updated it and now it's there.  
But obviously this is not what i want to do.

My post is just an example.

As another example i want to do this:

Select the files  
run only one action to:  
export a text list to a specific folder ( other than the working dir )  
open that folder  
run a AHK script to modify that file  
and after that open the text file to view it.

---

<div class="post-metadata">

### Author: ![ohrenkino](https://community.mp3tag.de/user_avatar/community.mp3tag.de/ohrenkino/32/4843_2.png) [@ohrenkino](https://community.mp3tag.de/u/ohrenkino)
#### Post date: [August 21, 2022, 8:37am UTC](https://community.mp3tag.de/t/open-a-folder-or-run-a-file-with-an-action-using-autohotkey/58256/6 "2022-08-21T08:37:15Z")

</div>

> [@Stem75](#):
>
> export a text list to a specific folder ( other than the working dir )

You can set the target folder in the filename specification of the export script ... this could be a constant path or one with field variables or a combination of both.  
If you run the export from the UI and you set the message event "Show export", then the resulting exported text file will be opened in the assigned default editing application.

---

<div class="post-metadata">

### Author: ![Stem75](https://community.mp3tag.de/user_avatar/community.mp3tag.de/stem75/32/5007_2.png) [@Stem75](https://community.mp3tag.de/u/Stem75)
#### Post date: [August 21, 2022, 8:54am UTC](https://community.mp3tag.de/t/open-a-folder-or-run-a-file-with-an-action-using-autohotkey/58256/7 "2022-08-21T08:54:56Z")

</div>

Sorry for my ignorance but,  
can you give me an example for:

field variables  
message event "Show export"

because i don't understanding it.

What i need to change here:

$filename(C:\Test\test.txt,utf-8)  
$loop(%\_path%)%artist% - %title%  
$loopend()

the other options are:  
append data  
one file per directory

Probably i am missing something.

---

<div class="post-metadata">

### Author: ![ohrenkino](https://community.mp3tag.de/user_avatar/community.mp3tag.de/ohrenkino/32/4843_2.png) [@ohrenkino](https://community.mp3tag.de/u/ohrenkino)
#### Post date: [August 21, 2022, 9:15am UTC](https://community.mp3tag.de/t/open-a-folder-or-run-a-file-with-an-action-using-autohotkey/58256/8 "2022-08-21T09:15:39Z")

</div>

> [@Stem75](#):
>
> $filename(C:\Test\test.txt,utf-8)

This would be an absolute path for the filename defintion.  
But you could also set one with field variables like  
$filename(C:\Test%artist%\test.txt,utf-8)

In File\>Options\>Messages you find a setting "at exportings tags" which produces a message box which asks you whether you want to open the resulting export file now.

---

<div class="post-metadata">

### Author: ![Stem75](https://community.mp3tag.de/user_avatar/community.mp3tag.de/stem75/32/5007_2.png) [@Stem75](https://community.mp3tag.de/u/Stem75)
#### Post date: [August 21, 2022, 11:52am UTC](https://community.mp3tag.de/t/open-a-folder-or-run-a-file-with-an-action-using-autohotkey/58256/9 "2022-08-21T11:52:18Z")

</div>

OK thanks.  
But as i originally thought is a one time move and i can't see how you can run a .bat file for example, or deleting files or open multiple folders without exporting files everywhere or moving files or creating folders or executing programs etc.  
Anyway i don't know if it is useful for anyone else or if they are happy the way things work but i thought i had to post it here as a dirty solution to a problem that i have in the way i work.
