Jump to content

Sending things off a list in order.


Recommended Posts

I have this example script that I wrote up real quick so there won't be a whole lot of cludder.

What I am trying to do is get it to do ControlSend or just Send the items in the list in order from top to bottom.

Like if the list start with 1 then 2 then 3 I want it to send out 1 then 2 then 3 automatically.

I've been looking around and I can't seem to find anything to make this work. (I look in the help file  :graduated: )

Here's the code.

$gui = GUICreate("Example",300,200)
$input = GUICtrlCreateInput("",0,0,100,25)
$list = GUICtrlCreateList("",100,0,200,200)
$send = GUICtrlCreateButton("Send to list",0,25,100,25)
GUISetState()
while 1
   $msg = GUIGetMsg(1)
   Switch $msg[1]
   Case $gui
      Switch $msg[0]
      Case -3
         Exit
      Case $send
         $read_input = GUICtrlRead($input)
         GUICtrlSetData($list,$read_input)
         GUICtrlSetData($input,"")
      EndSwitch
   EndSwitch
WEnd

Thanks.

Link to comment
Share on other sites

I changed up the script some so now if you press start it'll send the text to the input under the start button.

And to answer your statement GordonFreeman I want to send them in multiple lines.

Eg: Type "1" then click Send, Then type "2" then click Send etc... and have it send out 1,2,... line by line.

Right now it's only sending out the selected text. I tried messing around with some of the _GUICtrlLIstBox_ stuff but I couldn't find one that worked.

Here's the code.

#include<misc.au3>
#include<guiconstants.au3>
$gui = GUICreate("Example",300,200)
$input = GUICtrlCreateInput("",0,0,100,25)
$list = GUICtrlCreateList("",100,0,200,200)
$send = GUICtrlCreateButton("Send to list",0,25,100,25)
$input_2 = GUICtrlCreateInput("",0,125,100,25,$ES_MULTILINE)
$start = GUICtrlCreateButton("Start",0,50,100,25)
GUISetState()
while 1
   $msg = GUIGetMsg(1)
   Switch $msg[1]
   Case $gui
      Switch $msg[0]
      Case -3
         Exit
      Case $send
         $read_input = GUICtrlRead($input)
         GUICtrlSetData($list,$read_input)
         GUICtrlSetData($input,"")
      Case $start
         $read_list = GUICtrlRead($list)
         while 1
            Sleep(500)
         GUICtrlSetData($input_2,$read_list&" "&GUICtrlRead($input_2))
         If _IsPressed("25") Then Exit
            WEnd
      EndSwitch
   EndSwitch
WEnd

Thanks for replying though Gordon.

Link to comment
Share on other sites

I feel dumb now  :ermm:

Thanks I'll use this a lot I bet.

Edit: Quick question. Why is it putting them in alphabetical order and numerical order? When i press the Send button it sends it to the list but it sends it 1-9 then A-Z I just want it to send it in the order I put it.

Edited by gottygolly
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...