Extracting multiple consecutive values from excel sheet

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
cryptxc
Posts: 2
Joined: 15 Sep 2022, 23:10

Extracting multiple consecutive values from excel sheet

Post by cryptxc » 15 Sep 2022, 23:26

Hello all!

I am new to the Autohotkey community and quite frankly have no idea what I'm doing. Here's my dilemma: I am trying to rename multiple clips in Pro Tools by copying and pasting file names from an excel sheet (one column, over 200 rows of file names). I know all the commands to copy/paste/rename, but I am unaware of how to write a script that 1) references an excel sheet to pull values from, and 2) goes down each row and copies/pastes each value consecutively. Does this make sense? As an example, let's say I have an excel sheet that has the following file names listed in a single column:

voice0001
voice0002
voice0003

How do I select "voice0001," copy it, paste it, then select "voice0002," copy it, paste it, and so on? Is there a way to do that? Any tips or scripts would be much appreciated! Thank you!

skyth540
Posts: 72
Joined: 24 Aug 2022, 10:07

Re: Extracting multiple consecutive values from excel sheet

Post by skyth540 » 29 Sep 2022, 11:14

Hey there, welcome to AHK. something to consider is using Pulover's as a start to your AHK experience. It has a dynamic script generator as you build in a GUI

It sounds like you would basically need to record yourself copying from excel, alt+tab ing to pro tools, fiddling in there and pasting, tabing back to excel, arrow down. and then having a clean loop from that


it will be a lot easier if you can manage a way to navigate pro tools with the tab key, enter, and space - rather than the mouse


also, is there a batch rename tool in pro tools? I have no idea what that is but gathering from context and a quick google it sounds like a music library tool

User avatar
flyingDman
Posts: 2791
Joined: 29 Sep 2013, 19:01

Re: Extracting multiple consecutive values from excel sheet

Post by flyingDman » 30 Sep 2022, 11:57

The forum has many examples of how to do this. Typically COM is used to interface with Excel and extract data.
In the simple example below, the sheet is limited to one column and usedrange is used to copy it and put the content of each cell in an array. Repeatedly pressing the hotkey will then send the content of each cell. There are several other ways (using COM) to do this (or using ADODB).
Open an existing 1 column spreadsheet and run the script:

Code: Select all

xl := ComObjActive("Excel.Application")
xl.activesheet.usedrange.copy		;xl.activesheet.usedrange.columns(1).copy for the 1st col in a multi column sheet
arr := strsplit(clipboard, "`n","`r")

#\::
send % arr.RemoveAt(1)
return
14.3 & 1.3.7

Post Reply

Return to “Ask for Help (v1)”