Assistance with Functions
Posted: 03 Jan 2018, 09:50
Morning all,
I stumbled accross a thread last night that suggested using functions throught scripts in place of goto, or gosub.
I thought I would give it a try, I am still learning functions, so I thought I would learn as I go and see if I can replace some subs in a script I have.
The script takes basic variables and inputs them into IE. When I use the gosub, this script works flawlessly. When I changed it to a function, it doesn't use COM.
none of the code is pushed to IE. If i switch this back to a label, and gosub to it, it works flawless. What am I missing?
I stumbled accross a thread last night that suggested using functions throught scripts in place of goto, or gosub.
I thought I would give it a try, I am still learning functions, so I thought I would learn as I go and see if I can replace some subs in a script I have.
The script takes basic variables and inputs them into IE. When I use the gosub, this script works flawlessly. When I changed it to a function, it doesn't use COM.
Code: Select all
oneline: ;this is called by gui button
condition := 1
tech()
;GoSub, buttonContinue ; debug
return
tech()
{
msgbox debug ; this shows up, so it is entering function properly
wb := IEget()
getFrame()
myFrame.querySelectorAll("select")[0].value := "Other"
Sleep, 100
myFrame.parentWindow.execScript("enterTechId(market)")
Sleep, 100
myFrame.querySelectorAll("INPUT")[52].value := "0768"
Sleep,100
myFrame.querySelectorAll("select")[1].selectedIndex := 1
Sleep, 100
WinActivate, C5584 - HANOVER CHRYSLER DODGE JEEP DealerCONNECT - Internet Explorer
;Run %A_ScriptDir%\Close Pop-up.ahk
myFrame.querySelectorAll("A")[11].click()
Sleep,1500
;GoSub, closepopup ;comment out for debug, and it enters the gosub when active, so it is reaching bottom of function
return
}