use strict; use warnings; use Tk; use Win32::Process; use Tk::Schedule; my ($EntryMan, $TL); my $RefEntryMan = \$EntryMan; my $mw = MainWindow->new; $mw->title("MainWindow"); $mw->Entry(-textvariable=>\$EntryMan)->pack(); $mw->Button(-text=>"Schedule",-command=>\&doTopLevel)->pack(); MainLoop; sub doTopLevel { if(!Exists($TL)) { $TL=$mw->Toplevel(); $TL->title("Schedule-Modul"); $TL->Schedule( -interval => 30, -repeat => "once", -command =>[\&getProcess, $RefEntryMan], -comment => "Do an activity")->pack(); } else { $TL->deiconify(); $TL->raise(); } } sub getProcess { my $Process; my $Inherit = 0; my $Dir = "."; my $Command = "C:\\Perl\\bin\\perl.exe"; my ($GetProcess) = @_; my $FwdProcess = ${$GetProcess}; my $MyArg = "perl test.pl -a $FwdProcess"; Win32::Process::Create($Process, $Command, $MyArg, $Inherit, NORMAL_PRIORITY_CLASS, $Dir) or die Win32::FormatMessage(Win32::GetLastError()); }