Need little help with "WinActivate" (or something similar..)

Get help with using AutoHotkey and its commands and hotkeys
Posts: 233
Joined: 21 Sep 2014, 14:38
Location: CH

Need little help with "WinActivate" (or something similar..)

24 Sep 2018, 08:47


I have a small and simple code which works fine. It ...

1) checks if UltraEdit is active
2) if yes, copy the current selection to clipboard
3) check if AutoCAD exits
4) if yes, jump to AutoCAD and paste the clipboard into in

Here is the code:

Code: Select all

; Belegung der Taste "Ctrl+ü".
; Codetest: Markierten Text in Zwischenablage, im AutoCAD Textfenster einfügen und mit Enter auslösen
SetTitleMatchMode, 2

IfWinActive, UltraEdit 64-bit
    SetTitleMatchMode, 1
    AutoTrim Off  ; Retain any leading and trailing whitespace on the clipboard.
    Clipboard =  ; Must start off blank for detection to work.
    Send ^c
    ClipWait 1
    ifWinExist, AutoCAD-Textfenster
        WinActivate, AutoCAD-Textfenster
        WinActivate, Autodesk AutoCAD
        Send (textscr){enter}
        Sleep, 100
    ;    msgbox "Fenster fehlt"
    ;    Return
    ifWinExist, AutoCAD-Textfenster
        Send ^V
        sleep, 100
        send {enter}
TrayTip , clip2acad.ahk, Aufruf vom falschen Programm, 1, 33

Now I want to a simple, last step:

5) Jump back to UltraEdit

I tried something with WinActivate and so on, but nothing happens. The cursor keeps active in AutoCAD. What's wrong?

Peter (AHK Beginner) / Win 7 x64, AHK Version v1.1.22.xx

Return to “Ask For Help”

Who is online

Users browsing this forum: Bing [Bot], FredOoo, Gangrel, just me, MannyKSoSo, Odlanir, Portwolf and 195 guests