It's obvious I'am new here, but I'm using AHK for about 6 months (just basic stuff, nothing fancy). I came to a problem now I can't solve.
So I have 3 excel files open and i would like the script to operate on specific file from those 3 but when i minimize the window I want it to operate on, it automaticly goes to one of two left (I know it's ComObjACTIVE, but I don't want to use ObjComCreate, besause it shows the window after completing the script and I would like to have the window for script minimized and another one opened to work on it).
It would be great help for me if someone could at least point any direction to look at.
Here's the code I;ve got so far:
Code: Select all
^3::
;copying the folder name and spliting it
Send {F2}
Sleep 150
Send ^c{Esc}
Sleep 150
czlon := clipboard
czlon_array := StrSplit(czlon, [".", "-", "_", "/"])
Sleep 200
;opening excel application and putting values in cells to find if the name provided is already somewhere in excel (there are 'index' formulas and others)
Xl := ComObjActive("Excel.Application")
Xl.Range("C3").Value := czlon_array[1]
Xl.Range("D3").Value := czlon_array[2]
Xl.Range("F3").Value := czlon_array[4]
Xl.Range("E3").Value := czlon_array[3]
Xl.Range("C4:D4").Copy()
data := clipboard
Xl.Range("C5:D5").Copy()
asort := clipboard
Xl.Range("C6:D6").Copy()
wykon := clipboard
Xl.Range("C7:D7").Copy()
dz := clipboard
Xl.Range("B10").Copy()
bwb := clipboard
MsgBox %pos1%`n%pos2%`n%pos3%`n%dz%`n%bwb%
return
I've also tried this:
Code: Select all
^3::
;copying the folder name and spliting it
Send {F2}
Sleep 150
Send ^c{Esc}
Sleep 150
czlon := clipboard
czlon_array := StrSplit(czlon, [".", "-", "_", "/"])
Sleep 200
;opening excel application and putting values in cells to find if the name provided is already somewhere in excel (there are 'index' formulas and others)
Xl := ComObjActive("Excel.Application") ;is there a way to choose specific excel file from 3 open? i'd rather not use ObjComCreate as with using that, the excel shows at the end of script, which i dont want to happen.
Xl := ComObjGet("poprawny") ;here i've tried to choose specific sheet from all open excel files but it doesn't work, just dont know what to do here
Xl.ActiveSheet.Range("C3").Value := czlon_array[1]
Xl.ActiveSheet.Range("D3").Value := czlon_array[2]
Xl.ActiveSheet.Range("F3").Value := czlon_array[4]
Xl.ActiveSheet.Range("E3").Value := czlon_array[3]
Xl.ActiveSheet.Range("C4:D4").Copy()
pos1 := clipboard
Xl.ActiveSheet.Range("C5:D5").Copy()
pos2 := clipboard
Xl.ActiveSheet.Range("C6:D6").Copy()
pos3 := clipboard
Xl.ActiveSheet.Range("C7:D7").Copy()
dz := clipboard
Xl.ActiveSheet.Range("B10").Copy()
bwb := clipboard
MsgBox %pos1%`n%pos2%`n%pos3%`n%dz%`n%bwb%
return