Quantcast
Channel: AutoIt v3 - General Help and Support
Viewing all articles
Browse latest Browse all 12506

New to AutoIt, help with basic script!

$
0
0

Hi!
So I have this really short script I've written that doesn't work the way I want it to.
 

local $var=ClipGet() WinActivate("skjema.txt - Notisblokk") winwaitactive("skjema.txt - Notisblokk") send("^{end}+^{left}^c") if StringInStr($var, "asd")=0 Then    send("+{home}{delete}")    Else    send("testtest") EndIf

 
What I want the script to do:
1. Tab into my already active Notepad window
2. Go to end of pre-written text in notepad and copy the last word/character into the clipboard
3. If the copied text is "asd" then delete the whole row, if not send "testtest".
 
What script is doing:
1. Working
2. Working (I think)
3. ONLY WORKING after I've already done the script once before with the same last word in notepad

 

Problem: It seems that the script checks the last copied item in the clipboard and not the current, which would explain why I must run it twice before it works.

 

Example:

I type "hi" at end of notepad and run the script: replies with "testtest" ("asd" not found)

I now type "asd" at end of notepad and run the script: replies with "testtest" again (which I think is because the last item copied into the clipboard was "hi" from previous run)

This works both ways.

 

Sidequestion: Not sure how windows clipboard works, can it only hold 1 item at a time?

 

Thanks in advance!


Viewing all articles
Browse latest Browse all 12506

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>