GetControlText> from Dialog?

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
rullbandspelare
Pro Scripter
Posts: 149
Joined: Tue Mar 23, 2004 9:11 pm

GetControlText> from Dialog?

Post by rullbandspelare » Fri Jul 03, 2009 1:20 pm

I tried to make a application that is controlable from another exe, with the command:
GetControlText>Register,Edit,1,Text
and
SetControlText>Register,Edit,1,%ID%

But when I do a dialog it does not work. I get ##NOSUCHOBJECT##
I have also tried with TEdit instead of Edit

Any ideas?

Code: Select all

Dialog>MyDialog
   Caption=Register
   Width=733
   Height=633
   Top=CENTER
   Left=CENTER
   Max=0
   Min=0
   Close=0
   Resize=0
   Edit=MyEdit,104,40,169,
   Button=OK,504,536,89,33,3
   Button=CANCEL,608,536,89,33,6
   Memo=msMemo1,88,248,305,137,test.
   Edit=Edit2,108,76,169,
   Edit=Edit3,108,108,169,
   Edit=Edit4,108,140,169,
   Edit=Edit5,108,172,169,
   Edit=Edit6,108,204,169,
   Button=M,444,87,75,25,0
   Button=F,449,138,75,25,0

EndDialog>MyDialog


User avatar
JRL
Automation Wizard
Posts: 3532
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Post by JRL » Sat Jul 04, 2009 5:12 am

I tried your script and I'm also not getting any text from the dialog text fields using GetControlText>. I compiled a script that contains your dialog. Using the "View System Windows" tool in Macro Scheduler to look at the dialog, no matter where I type in the dialog none of my typing shows up in the "Registry" window text controls.

On the other hand I have no trouble writing to an edit box of your dialog using SetControlText>. The following will write to the last edit box when you press "OK".

Code: Select all

Dialog>MyDialog
   Caption=Register
   Width=733
   Height=633
   Top=CENTER
   Left=CENTER
   Max=0
   Min=0
   Close=0
   Resize=0
   Edit=MyEdit,104,40,169,
   Button=OK,504,536,89,33,3
   Button=CANCEL,608,536,89,33,2
   Memo=msMemo1,88,248,305,137,test.
   Edit=Edit2,108,76,169,
   Edit=Edit3,108,108,169,
   Edit=Edit4,108,140,169,
   Edit=Edit5,108,172,169,
   Edit=Edit6,108,204,169,
   Button=M,444,87,75,25,0
   Button=F,449,138,75,25,0

EndDialog>MyDialog

Show>MyDialog

Label>Loop
  Wait>0.01
  GetDialogAction>MyDialog,res1
  If>res1=2
    Exit>0
  EndIF
  If>res1=3
  Let>ID=This is a test
    SetControlText>Register,TEdit,1,%ID%
  EndIf
Goto>Loop

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts