Input CSV coordinates into dialog box

Get help with using AutoHotkey and its commands and hotkeys
Posts: 2
Joined: 14 Nov 2017, 12:11

Input CSV coordinates into dialog box

14 Nov 2017, 12:31

I'm using an analysis software for my job that allows me to input several XYZ coordinates. Problem is, it only allows me to input them one at a time and it has no import feature. So I have to manually type in the same 40+ XYZ coordinates every time I do my setup.

I'd like to just type up a .txt file with CSV coordinates and use AutoHotkey to read from the CSV file and input the coordinates for me. Here's the basic setup:

CSV file:
(General format: Label,XCoord,YCoord,ZCoord)
[Line #] Line contents
[1] Inlet, 7.5,0,1.73
[2] Outlet, 14.5,0,1.73
[3] Zone 1, 12,0,1.73

Input steps (what I need AHK to do in the dialog box):
1. Type in XCoord, [Tab]
2. Type in YCoord, [Tab]
3. Type in ZCoord, [Tab]
4. Type in Label, [Enter]
5. [Shift+Tab] x 3
6. Repeat for each line in CSV file

I have no experience in AutoHotkey whatsoever, and it would take me a lot more time to figure out how to do this than I have right now. I was hoping someone who has time on their hands and enjoys using AHK would be willing to get this set up for me, or at least get me started. I'm willing to put in as much work myself as time allows, but any help you can provide to get me closer to a working script would be greatly appreciated.

Thank you.

Re: Input CSV coordinates into dialog box

14 Nov 2017, 12:49

Your psuedo code is half your script, you only need to wrap it in a loop and read the data. Below is a script that should work, try it with say two rows of CSV.
If you script goes haywire press Esc should stop it. You may get a lot better results if you can use ControlSend, right click on the AutoHotkey try icon to start the window spy to find the control names and try a small script - just one line to see if you can use ControlSend, that way your data is always sent to the correct field. The Spy should show you an ClassNN which is what you use in the 'control' parameter, the keys are the 'cells' below to send. That way you don't have to rely on tabs to navigate and quite possibly your program doesn't have to be active either to be able to input the data.

Also start with the to get an idea of the basics and read the documentation for each command/function below.

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus

Posts: 2
Joined: 14 Nov 2017, 12:11

Re: Input CSV coordinates into dialog box

14 Nov 2017, 15:10

You're a lifesaver. That was just the starting point I needed. I was able to play with that code and get it to do just what I needed. This will save me so much time. Thank you!

Return to “Ask For Help”

Who is online

Users browsing this forum: Freire, MannyKSoSo, Xtra and 55 guests