For now I got it to do most of the first tasks using imagesearch. I did this just to get it into testing stages quickly. I wont want the final version to rely on the imagesearch because I wont have the image of those file names. Instead what I need it to do is start a GUI with a multi line input, ask for the files names, and store those names for later use. then instead of using the image of the file it will go through and get the name from the user input. it will run the program then go to the next file name from the user input. I want it to continue until it has opened all files the user put into the box. Some times it might be 3, sometimes it might be 15.
I have a stand alone GUI already with a multi line input for testing outside of the main script. I got it from stackexchange so it is not my work. I think it is working correctly though, except I will need to store the data it collects and get it back later. here is that GUI.
Code: Select all
f1::
MsgBox % MultiLineInputBox("Please Enter the file names you want to export tables from.", "", "Eclypse Drawing Table Export Utility")
return
MultiLineInputBox(Text:="", Default:="", Caption:="Multi Line Input Box"){
static
ButtonOK:=ButtonCancel:= false
if !MultiLineInputBoxGui{
Gui, MultiLineInputBox: add, Text, r1 w600 , % Text
Gui, MultiLineInputBox: add, Edit, r10 w600 vMultiLineInputBox, % Default
Gui, MultiLineInputBox: add, Button, w60 gMultiLineInputBoxOK , &OK
Gui, MultiLineInputBox: add, Button, w60 x+10 gMultiLineInputBoxCancel, &Cancel
MultiLineInputBoxGui := true
}
GuiControl,MultiLineInputBox:, MultiLineInputBox, % Default
Gui, MultiLineInputBox: Show,, % Caption
SendMessage, 0xB1, 0, -1, Edit1, A
while !(ButtonOK||ButtonCancel)
continue
if ButtonCancel
return
Gui, MultiLineInputBox: Submit, NoHide
Gui, MultiLineInputBox: Cancel
return MultiLineInputBox
;----------------------
MultiLineInputBoxOK:
ButtonOK:= true
return
;----------------------
MultiLineInputBoxGuiEscape:
MultiLineInputBoxCancel:
ButtonCancel:= true
Gui, MultiLineInputBox: Cancel
return
}
Code: Select all
Mousemove, 1240, 262
sleep 500
MouseClick, left
sleep 200
MouseClick, left
;WinWait Creo Parametric ahk_class HCS16139P ahk_exe xtop.exe
;winactivate, Creo Parametric
;winwaitactive,
;Mousemove, 124, 26
sleep 15000
winactivate, Creo Parametric
;return
SetDirectory:
{
ImageSearch, imageX, imageY, 0, 0, %a_ScreenWidth%, %A_ScreenHeight%, *24 C:\Users\smoore\Desktop\select directory.png
If Errorlevel = 0
{
EnvAdd, Found, 1
MouseClick, left, %imageX%, %imageY%
Sleep 500
}
{
ImageSearch, imageX, imageY, 0, 0, %a_ScreenWidth%, %A_ScreenHeight%, *24 C:\Users\smoore\Desktop\c.png
If Errorlevel = 0
{
EnvAdd, Found, 1
MouseClick, left, %imageX%, %imageY%
Sleep 500
}
}
{
ImageSearch, imageX, imageY, 0, 0, %a_ScreenWidth%, %A_ScreenHeight%, *24 C:\Users\smoore\Desktop\working directory.png
If Errorlevel = 0
{
EnvAdd, Found, 1
MouseClick, left, %imageX%, %imageY%
Sleep 500
}
}
{
ImageSearch, imageX, imageY, 0, 0, %a_ScreenWidth%, %A_ScreenHeight%, *24 C:\Users\smoore\Desktop\ok.png
If Errorlevel = 0
{
EnvAdd, Found, 1
MouseClick, left, %imageX%, %imageY%
Sleep 500
}
}
}
gosub, openfile
return
openfile:
{
ImageSearch, imageX, imageY, 0, 0, %a_ScreenWidth%, %A_ScreenHeight%, *24 C:\Users\smoore\Desktop\open.png
If Errorlevel = 0
{
EnvAdd, Found, 1
MouseClick, left, %imageX%, %imageY%
Sleep 500
}
send 4055as4601_c.drw
;{
;ImageSearch, imageX, imageY, 0, 0, %a_ScreenWidth%, %A_ScreenHeight%, *24 C:\Users\smoore\Desktop\as4601.png
;If Errorlevel = 0
;{
;EnvAdd, Found, 1
;MouseClick, left, %imageX%, %imageY%
Sleep 500
;}
;}
{
ImageSearch, imageX, imageY, 0, 0, %a_ScreenWidth%, %A_ScreenHeight%, *24 C:\Users\smoore\Desktop\open-1.png
If Errorlevel = 0
{
EnvAdd, Found, 1
MouseClick, left, %imageX%, %imageY%
Sleep 500
}
}
}
gosub, savepl
return
Code: Select all
openfile:
{
ImageSearch, imageX, imageY, 0, 0, %a_ScreenWidth%, %A_ScreenHeight%, *24 C:\Users\smoore\Desktop\open.png
If Errorlevel = 0
{
EnvAdd, Found, 1
MouseClick, left, %imageX%, %imageY%
Sleep 500
}
send 4055as4601_c.drw
;{
;ImageSearch, imageX, imageY, 0, 0, %a_ScreenWidth%, %A_ScreenHeight%, *24 C:\Users\smoore\Desktop\as4601.png
;If Errorlevel = 0
;{
;EnvAdd, Found, 1
;MouseClick, left, %imageX%, %imageY%
I mentioned that I needed to also use that data elsewhere. so when I am saving the tables as .csv files, right now it is working because I am using
send 4055AS4061_wl1 then the next one I say send 4055AS4061_wl2 ect. what I need to do is replace "4055AS4061" with what ever file name it is working on at the time, and I would prefer to change the "wl1" "wl2" ect... input to have the number at the end increase by 1 each time it is saved. i think this would be cleaner. I think I remember how to do that and I think I can clean up most of this, but I do need help with the getting the data from the user, storing it for later use then recalling it when needed. I have done some of this a few years ago, but I have not used AHK for for a few years, and even when I was using it a lot, I was not really good with it.
Thanks in advance for the help. I am open to ideas and suggestions for doing this.