Jump to content

Spacer


Recommended Posts

Hi, I've made a tiny script to make spaced text and send it to notepad. How can I send it when I hit CTRL-SHIFT-S for example? It shouldn't only work in notepad you see. Here is my code...

$input = InputBox("Spacer", "Text to 'Space':")
Run("notepad.exe")
WinWaitActive("Untitled - Notepad")
WinSetState("Untitled - Notepad", "", @SW_MAXIMIZE)
Sleep(200)
space($input)
;------------------------
Func space(ByRef $input)
$len = StringLen($input)
For $i = 1 to $len
    Send(StringMid($input, $i, 1), 1)
    If $i <> $len Then
        Send("{SPACE}")
    EndIf
Next
EndFunc

I am new to AutoIt so could anyone help me with this? :"> Thanks

Edited by Scriptkiddi3

[-"Scriptkiddie, nice to meet you!"-]

Link to comment
Share on other sites

You would need to use HotKeySet to setup execution using CTRL-SHIFT-S but as I am a newbie I do not know how to make it work with other editors.

:whistle::dance:


Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

Link to comment
Share on other sites

Hi, I've maid a tiny script to make spaced text and send it to notepad. How can I send it when I hit CTRL-SHIFT-S for example? It shouldn't only work in notepad you see. Here is my code...

HotKeySet("^+S","space")
HotKeySet("{PAUSE}","GETOUT")

while 1
sleep(100)
WEnd

Func space()
$input = InputBox("Spacer", "Text to 'Space':")
$spaced = ""
for $i = 1 to StringLen($input)
    if  $i = 1 Then
        $spaced = $spaced & StringMid($input,$i,1)
    Else
        $spaced = $spaced & " " & StringMid($input,$i,1)
    EndIf
    
Next
Send($spaced)
EndFunc
Func GETOUT()
    Exit
EndFunc

i setup your hotkey, and one to exit (pause key) and now it just sends to the active window

***edit***

fixed logic error...

Edited by cameronsdad
Link to comment
Share on other sites

if you have your function explicitly run notepad (like it does)... it's just going to work in notepad...maybe try this...

HotKeySet("^+S","space")
HotKeySet("{PAUSE}","GETOUT")
while 1
sleep(100)
WEnd
Func space()
$input = InputBox("Spacer", "Text to 'Space':")
$spaced = ""
for $i = 1 to StringLen($input)
    if $i mod 2 = 1 Then
        $spaced = $spaced & StringMid($input,$i,1)
    Else
        $spaced = $spaced & " " & StringMid($input,$i,1)
    EndIf
Next
Send($spaced)
EndFunc
Func GETOUT()
    Exit
EndFunc

i setup your hotkey, and one to exit (pause key) and now it just sends to the active window

<{POST_SNAPBACK}>

Thanks I'll give it a try!

[-"Scriptkiddie, nice to meet you!"-]

Link to comment
Share on other sites

HotKeySet("^+S","space")
HotKeySet("{PAUSE}","GETOUT")

while 1
sleep(100)
WEnd

Func space()
$input = InputBox("Spacer", "Text to 'Space':")
$spaced = ""
for $i = 1 to StringLen($input)
    if  $i = 1 Then
        $spaced = $spaced & StringMid($input,$i,1)
    Else
        $spaced = $spaced & " " & StringMid($input,$i,1)
    EndIf
    
Next
Send($spaced, 1)
EndFunc
Func GETOUT()
    Exit
EndFunc

T H A N K S F O R Y O U R H E L P ! < s o l v e d >

[-"Scriptkiddie, nice to meet you!"-]

Link to comment
Share on other sites

HotKeySet("^+S","space")
HotKeySet("{PAUSE}","GETOUT")

while 1
sleep(100)
WEnd

Func space()
$input = InputBox("Spacer", "Text to 'Space':")
$spaced = ""
for $i = 1 to StringLen($input)
    if  $i = 1 Then
        $spaced = $spaced & StringMid($input,$i,1)
    Else
        $spaced = $spaced & " " & StringMid($input,$i,1)
    EndIf
    
Next
Send($spaced, 1)
EndFunc
Func GETOUT()
    Exit
EndFunc

T H A N K S  F O R  Y O U R  H E L P !  < s o l v e d >

<{POST_SNAPBACK}>

np, glad i could help
Link to comment
Share on other sites

HotKeySet("^S", "space")
HotKeySet("{PAUSE}", "closespacer")
While 1
    Sleep(100)
WEnd
;------------------------
Func space(ByRef $input)
$input = InputBox("Spacer", "Text to 'Space':")
$len = StringLen($input)
For $i = 1 to $len
    Send(StringMid($input, $i, 1), 1)
    If $i <> $len Then
        Send("{SPACE}")
    EndIf
Next
EndFunc
;------------------------
Func closespacer()
    Exit
EndFunc

Now i notice that i could make it my own. :whistle: Thanks for learning me the HotKeySet function!!!

[-"Scriptkiddie, nice to meet you!"-]

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...