Filestar*
  • File Types 1206
  • Blog
  • Pricing
  • Use Cases
Download
Convert any file with Autohotkey and Filestar

Convert any file with AutoHotkey and Filestar

Niels Bosma
Niels Bosma March 22, 2021

AutoHotkey is a popular automation tool for Windows and combined with the Filestar CLI you can convert files with a simple keystroke.

The following example shows how to setup a hotkey for converting any (applicable) file to the PNG-format by selected with file and then pressing CTRL+ENTER.

  1. Install AutoHotkey and Filestar.
  2. Create a .ahk (i.e. myhotkeys.ahk) file with the code listed below.
  3. Double click on the .ahk file. The shortcut is now active.
  4. Place a file (for example a .jpg file) on your desktop and single click it so it’s selected.
  5. Not press CTRL+ENTER.
  6. Filestar will now convert the file to a PNG and store it in the same folder.
^Enter::
    Backup := ClipboardAll
    Clipboard = 
    Send, ^c
    ClipWait, 1
    If FileExist(Clipboard)
    {
        Command := "C:\Program Files (x86)\Filestar\filestarcli.exe -i """ . Clipboard . """ -c ""convert to png"""
        Run, %Command%,,Min
    }
    Clipboard := Backup
return

How it works

  • ^Enter::...return specifies the hotkey, where ^ is Ctrl and Enter is Enter. Change if you want some other hotkey.
  • Backup := ClipboardAll backs up all data stored in the clipboard.
  • Clipboard = clears the clipboard.
  • Send, ^c simulates pressing the keys CTRL+C to copy the selected file to the clipboard.
  • ClipWait, 1 waits for up to one second for the clipboard to contain any data.
  • If Type = FileExist(Clipboard) check if the clipboard's content points to an actual file.
  • Command := "C:\\\\Program Files (x86)\\\\Filestar\\\\filestarcli.exe -i """ . Clipboard . """ -c ""convert to png""" is the filestarcli command line that is to be executed. Change the -c parameter for other commands. Also make sure the path to filestarcli.exe is where you have installed Filestar.
  • Run, %Command%,,Min runs the command line stored in the variable %Command%. Min means run minimized. Change this to Hide if you don't want to see the Filestar window at all.
  • Clipboard := Backup restores the inital clipboard data.
Filestar*
Filestar.com
  • Download
  • About
  • Contact
  • Blog
  • FAQ
  • Help
  • Terms and Conditions
  • Privacy Policy
Support
hello@filestar.com
Facebook
Twitter
LinkedIn
YouTube
Instagram

Made in Sweden by Filestar AB • Copyright 2018-2025 • SE559193368301