sastowe
14 years agoSuper Contributor
Basic noob question about addressing an object
I am writing some reusable scripts for use across several projects. Our app has the ability to auto login or not, configurable by the user. Loverly. I want my script to check for the existence of the login form. If present, I want the script to login.
It fails sometimes to do the login.
if Aliases.MyProcessName.imMainForm.MDIClient.imdbLogonForm.Exists Then
Aliases.MyProcessName.imMainForm.MDIClient.imdbLogonForm.ControlContainer_3.useridText.Text = IM_ADMIN
Aliases.MyProcessName.imMainForm.MDIClient.imdbLogonForm.LogonCommand.Click()
end if
This script executes immediately after the app is opened. So perhaps the form is not present yet. I wanted to change it to
set mainForm = Aliases.MyProcessName.imMainForm.MDIClient
if mainForm.WaitVBObject(imdbLogonForm, 5000) Then
The line for set mainForm is reporting in watch window as Exists = false
I can SEE it in my object browser....
If I address mainForm with the full name of the object, not the mapped name, then the object exists.
Then when I get to
if mainForm.WaitVBObject("imdbLogonForm", 5000) Then
It is evaluating false though the object is visible there and reported in the object browser.
Can someone help me understand what I am seeing here?
It fails sometimes to do the login.
if Aliases.MyProcessName.imMainForm.MDIClient.imdbLogonForm.Exists Then
Aliases.MyProcessName.imMainForm.MDIClient.imdbLogonForm.ControlContainer_3.useridText.Text = IM_ADMIN
Aliases.MyProcessName.imMainForm.MDIClient.imdbLogonForm.LogonCommand.Click()
end if
This script executes immediately after the app is opened. So perhaps the form is not present yet. I wanted to change it to
set mainForm = Aliases.MyProcessName.imMainForm.MDIClient
if mainForm.WaitVBObject(imdbLogonForm, 5000) Then
The line for set mainForm is reporting in watch window as Exists = false
I can SEE it in my object browser....
If I address mainForm with the full name of the object, not the mapped name, then the object exists.
Then when I get to
if mainForm.WaitVBObject("imdbLogonForm", 5000) Then
It is evaluating false though the object is visible there and reported in the object browser.
Can someone help me understand what I am seeing here?