Scriptkiddi3 Posted August 16, 2005 Share Posted August 16, 2005 (edited) 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 August 17, 2005 by Scriptkiddi3 [-"Scriptkiddie, nice to meet you!"-] Link to comment Share on other sites More sharing options...
BigDod Posted August 16, 2005 Share Posted August 16, 2005 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. 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 More sharing options...
seandisanti Posted August 16, 2005 Share Posted August 16, 2005 (edited) 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 EndFunci setup your hotkey, and one to exit (pause key) and now it just sends to the active window***edit***fixed logic error... Edited August 16, 2005 by cameronsdad Link to comment Share on other sites More sharing options...
Scriptkiddi3 Posted August 16, 2005 Author Share Posted August 16, 2005 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. <{POST_SNAPBACK}>Anyway, thanks for your reply! [-"Scriptkiddie, nice to meet you!"-] Link to comment Share on other sites More sharing options...
Scriptkiddi3 Posted August 16, 2005 Author Share Posted August 16, 2005 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 EndFunci 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 More sharing options...
seandisanti Posted August 16, 2005 Share Posted August 16, 2005 Thanks I'll give it a try!<{POST_SNAPBACK}>i fixed a little logic error, updated the code in original post Link to comment Share on other sites More sharing options...
Scriptkiddi3 Posted August 16, 2005 Author Share Posted August 16, 2005 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 More sharing options...
seandisanti Posted August 16, 2005 Share Posted August 16, 2005 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 EndFuncT 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 More sharing options...
Scriptkiddi3 Posted August 16, 2005 Author Share Posted August 16, 2005 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. Thanks for learning me the HotKeySet function!!! [-"Scriptkiddie, nice to meet you!"-] Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now