Jump to content


Photo

[Solved] ControlGetText issue


  • Please log in to reply
3 replies to this topic

#1 darkphaux

darkphaux
  • Members
  • 3 posts

Posted 12 July 2012 - 06:31 PM

Hey guys, I am writing a script to handle error checking on another program I use. Essentially all the script does is monitor a status bar on the bottom of the program and then will carry out various actions based on the output of the status bar.

So to test things out, before getting carried away I made a smaller script to grab and compare the status bar line.
#IfWinActive, Lawson - Shipping Feedback (WH32.2) ; Accurate Wintitle
^T::
ControlGetText, Actmsg, STATIC_UNIV1
if (Actmsg = "Inquiry Complete")
msgbox worked
else
msgbox failed

This will produce a failed result every time. I at first thought ControlGetText was the culprit, so I ran this:

#IfWinActive, Lawson - Shipping Feedback (WH32.2)
^T::
ControlGetText, Actmsg, STATIC_UNIV1
msgbox %Actmsg%
The results of this are a msgbox containing the output of the status bar (As it should)

So, I thought maybe the conditional statement had a flaw, so I re wrote the script to grab and compare a line in notepad
#IfWinActive, Untitled - Notepad
^T::
ControlGetText, Actmsg, Edit1
if (Actmsg = "Inquiry Complete")
msgbox worked
else
msgbox failed

So I have tested both aspects of this and they both work individual of eachother, but I can't for the life of me get it to compare the stupid text from the stupid status bar.

Anyone see my error? This is driving me crazy.

#2 dylan904

dylan904
  • Members
  • 706 posts

Posted 12 July 2012 - 07:01 PM

Replace that MsgBox with this... MsgBox, "%ActMsg%"
If you happen to see a unwanted space in the quotes, the problem should be easily solved via putting this line immediately after your ControlGetText line... ActMsg := Trim(ActMsg)

#3 darkphaux

darkphaux
  • Members
  • 3 posts

Posted 12 July 2012 - 07:50 PM

Its always the stupid little things that trip me up. Thanks, this is solved.

#4 dylan904

dylan904
  • Members
  • 706 posts

Posted 12 July 2012 - 09:15 PM

Do us a favor and change the title of this post to [Solved] ControlGetText issue.