Writing to text box

Need help with a macro you are writing? Ask here!

Moderator: MacroQuest Developers

guest_01
a ghoul
a ghoul
Posts: 115
Joined: Thu Apr 22, 2004 5:15 am

Post by guest_01 » Fri May 14, 2004 3:10 pm

Lax wrote:The problem if you're using DoCommand from a plugin is that only one command will be executed per frame. So if you have a string of 60 characters, and are getting 30fps, it will take 2 seconds
I thought that may have been be what was happening
Lax wrote:I'll do some testing on this later, dont have time right now
Thanks Lax =P

ebs2002
a lesser mummy
a lesser mummy
Posts: 72
Joined: Mon Apr 18, 2005 7:17 pm

Post by ebs2002 » Fri Oct 14, 2005 12:17 pm

I'm bumping this instead of making a new topic because it's relevant.

I'm working on a macro that will make a customizable item through the new tradeskill window, and am trying to figure out how to type the item name.

This seems to work:

Code: Select all

/notify TradeSkillWnd COMBW_ItemNameTextBox leftmouseup
/keypress T chat
/keypress u chat
/keypress n chat
/keypress a chat
/keypress space chat
/keypress M chat
/keypress e chat
/keypress l chat
/keypress t chat
/notify TradeSkillWnd COMBW_SearchBtn leftmouseup
(I admit I havent tested this because it would be tedious to code. I also know that the window fields are probably wrong, I haven't bothered to look them up just yet)

That being said, is there an easier way to do this? ie, a way to send a string to a text field in the tradeskill window

Agripa
a ghoul
a ghoul
Posts: 97
Joined: Tue Nov 23, 2004 10:16 pm

Post by Agripa » Fri Oct 14, 2005 9:51 pm

Here is the code I use to get coin out of the bank through the QuantityWnd. It does the same thing you are looking at with entering text.

Code: Select all

      /for I 1 to 2
         /varset J ${Window[QuantityWnd].Child[QTYW_SliderInput].Text.Length}
         /echo  ${Window[QuantityWnd].Child[QTYW_SliderInput].Text} ${J}
         /if ( ${J} > 0 ) {
            /keypress backspace chat
            /delay 3s ( ${Window[QuantityWnd].Child[QTYW_SliderInput].Text.Length} < ${J} )
            /varset I 1
         } else {
            /varset I 2
         }
      /next I

      /for I 1 to ${item_count.Length}
         /keypress ${item_count.Mid[${I},1]} chat
         /delay 3s ( ${Window[QuantityWnd].Child[QTYW_SliderInput].Text.Length} == ${I} )
      /next I

      /nomodkey /notify QuantityWnd QTYW_Accept_Button leftmouseup
      /delay 3s ( !${Window[QuantityWnd].Open} )

ebs2002
a lesser mummy
a lesser mummy
Posts: 72
Joined: Mon Apr 18, 2005 7:17 pm

Post by ebs2002 » Sat Oct 15, 2005 12:18 am

So it's as simple as:

Code: Select all


/sub TypeInTextBox(string Text, window WindowName, string ChildName, string Text)
   /declare Char int inner
   /notify ${WindowName} ${Child} leftmouseup
   /delay 2
   /for Char 1 to ${Text.Length}
      /keypress ${Text.Mid[${Char},1} chat
      /delay 3s ${Window[${WindowName}].Child[${ChildName}.Text.Length}==${Char}
   /next Char
/return

Agripa
a ghoul
a ghoul
Posts: 97
Joined: Tue Nov 23, 2004 10:16 pm

Post by Agripa » Sat Oct 15, 2005 9:05 am

That looks correct. From what I understand, there used to be an easier way to enter text using the /window command but I was never able to get it to work. Note that the text box must be currently selected or the /keypress text will not go where you want. With the QuantityWnd this has not been a problem but you may need to do something extra.