Help: How to send text to a search field in a window?

Need some help with that macro you're working on or aren't quite sure how to get your macro to do something? Ask here!

Moderator: MacroQuest Developers

BrainDeath
a ghoul
a ghoul
Posts: 86
Joined: Sun Mar 07, 2004 5:00 pm

Help: How to send text to a search field in a window?

Post by BrainDeath » Thu Apr 22, 2004 3:43 pm

I know I'm a bit impatient, but I have one macro left that I haven't been able to convert to the new system and it's the one I use the most.

No one has responded to my original post: http://macroquest2.com/phpBB2/viewtopic.php?t=6426

So let me ask the main question that's hanging me up.

How do I send a string of text to the search field in the new tradeskill window?

Before I was using /press, and I can't figure out a way to do this using /keypress and I have tried the chat parameter.

Thanks in advance for your help.

Lax
We're not worthy!
We're not worthy!
Posts: 3524
Joined: Thu Oct 17, 2002 1:01 pm
Location: ISBoxer
Contact:

Post by Lax » Thu Apr 22, 2004 3:52 pm

it is indeed using /keypress with the chat parameter, can you be more specific as to what you have tried?
Lax Lacks
Master of MQ2 Disaster
Purveyor of premium, EULA-safe MMORPG Multiboxing Software
* Multiboxing with ISBoxer: Quick Start Video
* EQPlayNice, WinEQ 2.0

BrainDeath
a ghoul
a ghoul
Posts: 86
Joined: Sun Mar 07, 2004 5:00 pm

Post by BrainDeath » Fri Apr 23, 2004 9:30 am

Thanks for responding Lax.

Here is some test code. I run it with the new tradeskill interface already open and of course since I'm using mouse coordinates for the /click it's only valid for my screen setup. If you can tell me how to get the cursor into the search field using /notify that would be really helpful also.

When the code executes, the cursor is placed in the search field, you can see it flashing there. The keystrokes appear to be sent to the user interface rather than the search box, for example the i in the test string "Recipe" closes the inventory window, the c attempts to con the target, etc.

Code: Select all

#turbo

Sub Main
   /click left 240 160
   /delay 5
   /call Type "Recipe"
/return 

Sub Type(InStr)
   /declare char local
   /declare loopctr local
   /for loopctr 1 to ${String[@InStr].Length}
      /varset char ${String[@InStr].Mid[@loopctr,1]}
      /if (${String[@char].Equal[ ]}) {
         /keypress space [chat]
      } else {
         /keypress @char [chat]
      }
   /next loopctr
/return

ml2517
a grimling bloodguard
a grimling bloodguard
Posts: 1216
Joined: Wed Nov 12, 2003 1:12 am

Post by ml2517 » Fri Apr 23, 2004 10:21 am

When you look at a syntax explanation you will typically surround optional parameters with brackets like this:

Code: Select all

/keypress space [chat] 
So what you most likely need to do is this in your code:

Code: Select all

/keypress space chat

BrainDeath
a ghoul
a ghoul
Posts: 86
Joined: Sun Mar 07, 2004 5:00 pm

Post by BrainDeath » Fri Apr 23, 2004 10:49 am

Thanks and yes, I'm aware of the way the brackets are used in the docs. However in testing at the command line, without the brackets, it did nothing at all. Went back and modified the code as suggested and it works. I'm feeling pretty embarassed now.

Also found that spaces weren't being handled properly. The below change to the sub fixes that.

Code: Select all

| Type out the input string.  Only non-alphabetic character
| currently handled is space.
Sub Type(InStr)
   /declare char local
   /declare loopctr local
   /for loopctr 1 to ${String[@InStr].Length}
      /varset char ${String[@InStr].Mid[@loopctr,1]}
      /if (!${String[@char].Length}) {
         /keypress space chat
      } else {
         /keypress @char chat
      }
   /next loopctr
/return
So now if I can just figure out how to get the cursor into the search field using /notify I'll be in good shape.

Thanks for the help.

BrainDeath
a ghoul
a ghoul
Posts: 86
Joined: Sun Mar 07, 2004 5:00 pm

Post by BrainDeath » Fri Apr 23, 2004 4:52 pm

OK, I think I almost have it. I have everything working except the part where it selects the first item in the search list. My test code is below. The line that isn't working is:
/notify TradeskillWnd RecipeList leftmouseup

What I am trying to do is select the first item in the list returned after pressing search.

Once again, any help would be appreciated.

Code: Select all

#turbo 
Sub Main
   /notify TradeskillWnd SearchTextEdit leftmouseup
   /delay 5
   /call Type "steel boning"
   /delay 40
   /notify TradeskillWnd SearchButton leftmouseup
   /delay 20
   /notify TradeskillWnd RecipeList leftmouseup
/return 

| Type out the input string.  Only non-alphabetic character
| currently handled is space.
Sub Type(InStr)
   /declare char local
   /declare loopctr local
   /for loopctr 1 to ${String[@InStr].Length}
      /varset char ${String[@InStr].Mid[@loopctr,1]}
      /if (!${String[@char].Length}) {
         /keypress space chat
      } else {
         /keypress @char chat
      }
   /next loopctr
/return

Lax
We're not worthy!
We're not worthy!
Posts: 3524
Joined: Thu Oct 17, 2002 1:01 pm
Location: ISBoxer
Contact:

Post by Lax » Fri Apr 23, 2004 6:57 pm

Try this:

Code: Select all

/notify TradeskillWnd RecipeList newvalue 1
If that's not it I'll attach a debugger and find it for you ;)
Lax Lacks
Master of MQ2 Disaster
Purveyor of premium, EULA-safe MMORPG Multiboxing Software
* Multiboxing with ISBoxer: Quick Start Video
* EQPlayNice, WinEQ 2.0

BrainDeath
a ghoul
a ghoul
Posts: 86
Joined: Sun Mar 07, 2004 5:00 pm

Post by BrainDeath » Fri Apr 23, 2004 8:15 pm

I really appreciate all the help Lax - you rock!

I gave your suggested code a try but it didn't work. Tried a few other values besides 1 as well. Please let me know what you figure out.

Thanks a lot.

Lax
We're not worthy!
We're not worthy!
Posts: 3524
Joined: Thu Oct 17, 2002 1:01 pm
Location: ISBoxer
Contact:

Post by Lax » Fri Apr 23, 2004 8:51 pm

Okay, getting in deep here. This will take a new command or something :roll: but I will get it for you.
Lax Lacks
Master of MQ2 Disaster
Purveyor of premium, EULA-safe MMORPG Multiboxing Software
* Multiboxing with ISBoxer: Quick Start Video
* EQPlayNice, WinEQ 2.0

Lax
We're not worthy!
We're not worthy!
Posts: 3524
Joined: Thu Oct 17, 2002 1:01 pm
Location: ISBoxer
Contact:

Post by Lax » Fri Apr 23, 2004 9:06 pm

ok, next zip this is tested and working:


/notify tradeskillwnd RecipeList listselect 1

1 is the top item in the list
0 is to select nothing

for the recipe list, 1-100 are possible (it stops the list after 100 entries)
Lax Lacks
Master of MQ2 Disaster
Purveyor of premium, EULA-safe MMORPG Multiboxing Software
* Multiboxing with ISBoxer: Quick Start Video
* EQPlayNice, WinEQ 2.0

Lax
We're not worthy!
We're not worthy!
Posts: 3524
Joined: Thu Oct 17, 2002 1:01 pm
Location: ISBoxer
Contact:

Post by Lax » Fri Apr 23, 2004 9:38 pm

/notify TradeskillWnd RecipeList listselect ${Window[TradeskillWnd].Child[RecipeList].List[=Inky Shadow Silk]}

that'll work next zip too
string window.List[n]: Get the first-column text for the nth item in a list box. Example: ${Window[TradeskillWnd].Child[RecipeList].List[1]}
int window.List[text]: Find an item in a list box by partial match (use window.List[=text] for exact) Example: ${Window[TradeskillWnd].Child[RecipeList].List[=Inky Shadow Silk]}

:)
Lax Lacks
Master of MQ2 Disaster
Purveyor of premium, EULA-safe MMORPG Multiboxing Software
* Multiboxing with ISBoxer: Quick Start Video
* EQPlayNice, WinEQ 2.0

Dulapore
a lesser mummy
a lesser mummy
Posts: 67
Joined: Thu Feb 26, 2004 4:39 am

Post by Dulapore » Fri Apr 23, 2004 9:58 pm

Sweet

BrainDeath
a ghoul
a ghoul
Posts: 86
Joined: Sun Mar 07, 2004 5:00 pm

Post by BrainDeath » Sat Apr 24, 2004 2:47 pm

Thanks a lot Lax. I really appreciate it.