Post by garry » 02 Jul 2018, 06:53
Beispiel, notepad startet nur einmal
Code: Select all
#warn
#NoEnv
setworkingdir,%a_scriptdir%
pr=notepad.exe
sc=ahk_exe notepad.exe
clipboard=
aa=
(ltrim join`r`n
Line-1
Line-2
)
Gui,2: Show , x10 y10 w430 h200, Titel_02
Gui,2: add, Edit , x10 y10 w400 h140 vInput,%aa%
Gui,2: Add, Button, x10 y160 w100 h27 gButton_01, Start
Gui,2: Add, Button, x130 y160 w100 h27 gClear,Clear
Return
2Guiclose:
exitapp
clear:
GuiControl,2:,input,
Guicontrol,2:Focus,input
return
Button_01:
Gui,2:submit,nohide
IfWinNotExist,%sc%
{
Run, %pr%,,,pid1
scx:= "ahk_pid " . PID1
WinWait,%scx%
}
IfWinNotActive ,%scx%,,WinActivate,%scx%
WinWaitActive,%scx%
stringreplace,input,input,`n,`r`n,all
clipboard=%input%
send,^v
clipboard=
return
Beispiel, notepad startet nur einmal
[code]
#warn
#NoEnv
setworkingdir,%a_scriptdir%
pr=notepad.exe
sc=ahk_exe notepad.exe
clipboard=
aa=
(ltrim join`r`n
Line-1
Line-2
)
Gui,2: Show , x10 y10 w430 h200, Titel_02
Gui,2: add, Edit , x10 y10 w400 h140 vInput,%aa%
Gui,2: Add, Button, x10 y160 w100 h27 gButton_01, Start
Gui,2: Add, Button, x130 y160 w100 h27 gClear,Clear
Return
2Guiclose:
exitapp
clear:
GuiControl,2:,input,
Guicontrol,2:Focus,input
return
Button_01:
Gui,2:submit,nohide
IfWinNotExist,%sc%
{
Run, %pr%,,,pid1
scx:= "ahk_pid " . PID1
WinWait,%scx%
}
IfWinNotActive ,%scx%,,WinActivate,%scx%
WinWaitActive,%scx%
stringreplace,input,input,`n,`r`n,all
clipboard=%input%
send,^v
clipboard=
return
[/code]