Generate 100+ scripts for a Elgato Stream Deck Soundpad

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Ordinary_Jeff
Posts: 2
Joined: 17 Jul 2018, 15:02

Generate 100+ scripts for a Elgato Stream Deck Soundpad

17 Jul 2018, 15:51

I'll try to explain as precisely as I can.

I bought the Elgato Stream Deck and if you know about it you might also know that it does not support macros, unfortunately. So I'm in a bit of a pickle, cause I want to be able to use it with my SoundPad software where on that I have it set up to play different sounds when I hold Alt and then types the number that corresponds with a song on the numpad. And that seems to be impossible using only the Elgato Stream Deck software.

So! I decided to turn to Autohotkey, and my thought process is to create a folder with a lot of scripts with 1-100+ as names and having the actual script being alt+1, alt+10, alt+35 and so on for each script and then have the Stream Deck to open these files when I press a button. This would be an extremely tedious and time-consuming task to do manually (cause I have so many damn sound clips) so I'm asking, is there a way to automate this process?

PS: If anyone knows a better/simpler way with the same result, I would really appreciate it if you could share that idea.
Freire
Posts: 16
Joined: 10 Dec 2017, 11:30

Re: Generate 100+ scripts for a Elgato Stream Deck Soundpad

17 Jul 2018, 19:55

I don't know if your approach is the best one.

Making lots of files and writing into them would be easy enought with AHK, but the hotkeys you need would not be so easy to implement.

Lets say you have file on song1 (Alt + Numpad1), also the file song11 (Alt + Numpad1 + Numpad1)?

This would not work as you would imagine.

This is a simple code that goes along with your current thinking just to prove the file concept:

Code: Select all

Loop, 99 ;Or the number of scripts you want...
{
  If (A_Index>=10){
    first_digit:=SubStr(A_Index, 1, 1)
    second_digit:=SubStr(A_Index, 2, 1)
    text_script =
    (
      #if GetKeyState("Numpad%first_digit%", "P")
      !Numpad%second_digit%::
        Run, song%A_Index%.mp3 ;Or the command you need for each hotkey here.    
    )
  } Else {
    text_script =
    (
      !Numpad%A_Index%::
        Run, song%A_Index%.mp3 ;Or the command you need for each hotkey here.    
    )
  }
  FileAppend, %text_script%, alt+%A_Index%.ahk
}
Ordinary_Jeff
Posts: 2
Joined: 17 Jul 2018, 15:02

Re: Generate 100+ scripts for a Elgato Stream Deck Soundpad

18 Jul 2018, 09:00

Freire wrote:I don't know if your approach is the best one.

Making lots of files and writing into them would be easy enought with AHK, but the hotkeys you need would not be so easy to implement.

Lets say you have file on song1 (Alt + Numpad1), also the file song11 (Alt + Numpad1 + Numpad1)?

This would not work as you would imagine.

This is a simple code that goes along with your current thinking just to prove the file concept:

Code: Select all

Loop, 99 ;Or the number of scripts you want...
{
  If (A_Index>=10){
    first_digit:=SubStr(A_Index, 1, 1)
    second_digit:=SubStr(A_Index, 2, 1)
    text_script =
    (
      #if GetKeyState("Numpad%first_digit%", "P")
      !Numpad%second_digit%::
        Run, song%A_Index%.mp3 ;Or the command you need for each hotkey here.    
    )
  } Else {
    text_script =
    (
      !Numpad%A_Index%::
        Run, song%A_Index%.mp3 ;Or the command you need for each hotkey here.    
    )
  }
  FileAppend, %text_script%, alt+%A_Index%.ahk
}
Wow that code looks way to complex for me, haha. I think you misunderstood me though (I wasn't clear enough). Here's how the soundpad software I use looks like
Spoiler
and when I hold Alt and then press 1+2 and then release Alt it plays the 12th sound on the list so I need a workaround the stream decks strict hotkeys only method by having it open the ahk files instead which then does the alt+1+2-alt "macro" to play a sound.
Freire
Posts: 16
Joined: 10 Dec 2017, 11:30

Re: Generate 100+ scripts for a Elgato Stream Deck Soundpad

23 Jul 2018, 11:19

For Future Reference:

Code: Select all

Loop, 100 ;Or the number of scripts you want...
{
  If (A_Index>=100){
    first_digit:=SubStr(A_Index, 1, 1)
    second_digit:=SubStr(A_Index, 2, 1)
    third_digit:=SubStr(A_Index, 3, 1)
    text_script =
    (
      SetKeyDelay, 100
      Send, {Alt Down}{Numpad%first_digit%}{Numpad%second_digit%}{Numpad%third_digit%}{Alt Up}    
    )
  } Else If (A_Index>=10){
    first_digit:=SubStr(A_Index, 1, 1)
    second_digit:=SubStr(A_Index, 2, 1)
    text_script =
    (
      SetKeyDelay, 100
      Send, {Alt Down}{Numpad%first_digit%}{Numpad%second_digit%}{Alt Up}    
    )
  } Else {
    text_script =
    (
      SetKeyDelay, 100
      Send, {Alt Down}{Numpad%A_Index%}{Alt Up}    
    )
  }
  FileAppend, %text_script%, %A_Index%.ahk
}

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: No registered users and 248 guests