Sign in to follow this  
Followers 0
Rad

Spaces...

7 posts in this topic

#1 ·  Posted (edited)

Trying to get my program to type what it says in the box in whatever window you have selected, this is how I've been doing it. I was it so it types it in, theres already a second way to use the Clipput and paste

$Next = "This is my string"
                For $i=0 to StringLen($Next)
                    Send("{" & StringMid($Next,$i,1) & "}")
                Next

This returns "Thisismystring" ... the spaces dont work. I tried modifying it a bit:

$Next = "This is my string"
                For $i=0 to StringLen($Next)
                    If StringMid("$next",$i,1) <> " " Then 
                        Send("{" & StringMid($Next,$i,1) & "}")
                    Else
                        Send("{SPACE}")
                    Endif
                Next

This returns "This__________" (with a bunch of spaces). For some reason the first time it hits a space it will do spaces after that even if it isnt :whistle:. I tried mixing it up, doing = " " then swapping the then/else around. Same thing occured.

I dont really know how to do this... spaces arent working! ><

Edited by Rad

Share this post


Link to post
Share on other sites



The curly braces have a special meaning to Send and is interfering with your output. You can use the optional parameter for Send to send raw characters to eliminate the problem.

As you see, no space problem here

$Next = "This is my string"
For $i = 1 to StringLen($Next)
    Send(StringMid($Next,$i,1))
Next
oÝ÷ Ù.­Ê{­mÚ«jg­z¸§IéÝjëh×6
$Next = "This is my string"
For $i=0 to StringLen($Next)
    Send("{" & StringMid($Next,$i,1) & "}", 1)
Next

:whistle:

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

As they say at little ceasers, thank you thank you! lol :whistle: it works

What about determining what GUICtrl you have active? :s

Edited by Rad

Share this post


Link to post
Share on other sites

Look in the Helpfile for GuiCtrlGetState

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

$GUI_FOCUS Control will be given input focus

That it? >_> or does that mean it will select it? either will work actually :whistle:

Another thing thats kinda wierd, I got a loop for the delay between messages, but they seem to stack up, and when you click "Stop" nothing happens, and "Stop" turns to start when you click it.

It queues when you push 'Stop', so when you push it more than once, when it catches up it will stop, then start, and repeat for each time u pushed it.

What should I do? I was thinking of splitting up the delay this is what its like:

If $Method = "Type" Then
                    For $i=0 to StringLen($Next)
                        Send(StringMid($Next,$i,1), 1)
                    Next
                    Send("{ENTER}")
                    [b]Sleep($Delay)[/b]
                Endif

and i was thinking like this:

If $Method = "Type" Then
                    For $i=0 to StringLen($Next)
                        Send(StringMid($Next,$i,1), 1)
                    Next
                    Send("{ENTER}")
                    [b]For $r=0 to 100
                    Sleep($Delay / 100)
                    Next[/b]
                Endif

I havent tried this yet, but think it will help clean it up? Any other suggestions?

BTW Splitting the delay I was hoping it would catch $msg = $InputStart inside the loop.. this correct?

Edited by Rad

Share this post


Link to post
Share on other sites

It is a Gui right?, so set the state of the gui disabled, do the action, and then re-enable the Gui. You could even just do the state of the control if suitable.

Look at:

GUISetState and/or GUICtrlSetState.

Share this post


Link to post
Share on other sites

Well I already disable the start/stop button, when you start theres a 3 second delay before it starts doing the command (so you can select your field before it starts), and I made it delay for 1500ms when u push Stop.

It still mashes it after the 1.5s delay though, and I have no idea why >_>

And the loop sleep didnt work, I guess I have to let it loop the entire thing to work. Ill mess with that a bit

Share this post


Link to post
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
Sign in to follow this  
Followers 0