Jump to content

Problem with a simple Script.


Recommended Posts

Hello, all. How are you all today?

Well, I seem to be having a problem:

I want to make an AutoIt Script Application that, when I press Control and SpaceBar together (^{SPACE}), the Script should be told to Paste from Clipboard and then press enter, or if I send Shift and SpaceBar (+{SPACE}), It should tell it to send "{ENTER}", "{Paste from Clipboard}", "{Enter}"... But something's just not letting it work right, and it's definately an operator error (An error on behalf of myself).

Well, here's the script, or at least the parts of it needed to understand my problem.. ANY comments and/or suggestions are asked of you all.

Global  $WinEx = 0, $Var = 0, $SpammerA = 0, $SpammerB = 0, $Clip = ClipGet() ;My Variables -- you should note only $SpammerA, $SpammerB, $Clip


HotKeySet("{PAUSE}", "RunWC3BL")  ;You don't need these
HotKeySet("^{TAB}", "RunApps")    ;You don't need these
HotKeySet("^{SPACE}", "Spammer1") ;This is one of them
HotKeySet("+{SPACE}", "Spammer2") ;This is one of them
HotKeySet("^+{SPACE}", "EndSpam") ;This is one of them

Func Spammer1() ;When (^{SPACE}) [or Ctrl and Space] are pressed
$SpammerA = 1   ;Set $SpammerA equal to 1
EndFunc               ;End Function Command


Func Spammer2() ;When (+{SPACE}) [or Shift and Space] are pressed
$SpammerB = 1   ;Set $SpammerB equal to 1
EndFunc               ;End Function Command


Func EndSpam()    ;For Ending $Spammer2 and $Spammer1 Function Commands--That's all you need to know
    $SpammerA = 0
    $SpammerB = 0
EndFunc


While $SpammerA = 1 ;While $SpammerA is active [After Func Spammer1 has been issued]
    Send("$Clip")      ;paste from the Clipboard [Remember, $Clip = ClipPut()]
    Send("{Enter}")  ;Send {ENTER} Key.
WEnd ;End While Command


While $SpammerB = 1 ;While $SpammerB is active [After Func Spammer2 has been issued]
    Send("{Enter}")  ;Send {ENTER}
    Send("$Clip")      ;paste from the Clipboard [Remember, $Clip = ClipPut()]
    Send("{ENTER}") ;Send {ENTER}
WEnd ;End While Command

If anyone could possibly help me fix this problem, I'd appreciate it greatly.

I thank you all so very much just for taking the time to read my post, but, please, help me out here? Thanks.

DirtyWhyte

Jacob Black

Link to comment
Share on other sites

Hello

Your question is not exact and you didn't stated where exactly problem is.

So here are two possible solutions:

first version - On hotkey Send() is processed only once

HotKeySet("^{SPACE}", "Spammer1") 
HotKeySet("+{SPACE}", "Spammer2") 
HotKeySet("^+{SPACE}", "EndSpam") 

Func Spammer1() 
    Send(ClipGet(),1)      
    Send("{Enter}")  
EndFunc              

Func Spammer2() 
    Send("{Enter}") 
    Send(ClipGet(),1)      
    Send("{ENTER}") 
EndFunc             

Func EndSpam() 
    HotKeySet("^{SPACE}") 
    HotKeySet("+{SPACE}") 
    HotKeySet("^+{SPACE}") 
    Exit
EndFunc              

While 1
    Sleep(100)
WEnd 
oÝ÷ ÚÇ¢woz»"¢s§d{$ج¦ºzËv·©y«^vºÚ"µÍÛØ[   ÌÍÔÜ[[YHH   ÌÍÔÜ[[YHÝÙ^]
    ][Ý×ÔÔPÑ_I][ÝË   ][ÝÔÜ[[YI][ÝÊHÝÙ^]
    ][ÝÊÞÔÔPÑ_I][ÝË ][ÝÔÜ[[Y][ÝÊHÝÙ^]
    ][Ý×ÞÔÔPÑ_I][ÝË ][ÝÑ[Ü[I][ÝÊH[ÈÜ[[YJ
HIÌÍÔÜ[[YHHH[[È[ÈÜ[[Y
HIÌÍÔÜ[[YHH[[È[È[Ü[J
H   ÌÍÔÜ[[YHH   ÌÍÔÜ[[YH[[ÂÚ[HBRY ÌÍÔÜ[[YHHH[BTÙ[
ÛÙ]

KJBBTÙ[
    ][ÝÞÑ[I][ÝÊHQ[YBRY ÌÍÔÜ[[YHH[BTÙ[
    ][ÝÞÑ[I][ÝÊHBTÙ[
ÛÙ]

KJBBTÙ[
    ][ÝÞÑSTI][ÝÊHQ[YBTÛY
L
BÑ[
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...