Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re: Re: Re: Re: Problems executing a copy command on win32

by DaWolf (Curate)
on Jan 14, 2004 at 22:43 UTC ( [id://321413]=note: print w/replies, xml ) Need Help??


in reply to Re: Re: Re: Problems executing a copy command on win32
in thread Problems executing a copy command on win32

Here it dies:

1 file(s) copied.
Unable to copy abc.xls. Error: No such file or directory

my ($author_nickname, $author_email) = ("DaWolf","erabbott\@terra.com.br") if ($author_name eq "Er Galvão Abbott");
  • Comment on Re: Re: Re: Re: Problems executing a copy command on win32

Replies are listed 'Best First'.
Re: Re: Re: Re: Re: Problems executing a copy command on win32
by BrowserUk (Patriarch) on Jan 14, 2004 at 22:48 UTC

    Where does that error message come from? It isn't a standard error message.

    How about showing the command you used to generate it, plus a dir of the source?


    Examine what is said, not who speaks.
    "Efficiency is intelligent laziness." -David Dunham
    "Think for yourself!" - Abigail
    Timing (and a little luck) are everything!

      The "Unable..." message is my die alternative to system (take a look at the first post). The "1 file copied..." and "No such file..." messages are standard DOS messages (I've just translated them from my native language, portuguese). Here's the source code who generated the two files, sorry I couldn't translate the portuguese messages, but you should understand the code (I've putted some comments tough...). Thanks a lot for your help.
      #!/usr/bin/perl -w use strict; use Win32::OLE; use Tk; use Tk::DialogBox; my $mw = MainWindow->new( -width => 350, -title => 'Gerenciador de Planilhas', -height => 50 ); my $Frame0 = $mw->Frame(); $Frame0->place( -x => 0, -y => 8, -height => 54, -width => 352); #the following button activates the sub that generates the document my $Button1 = $mw->Button( -text => "Criar Planilha", -relief => "raised", -command => \&geraNova ); $Button1->place( -x => 9, -y => 14, -height => 25, -width => 74); my $Button2 = $mw->Button( -text => "Sobre...", -relief => "raised", -command => \&onAbout ); $Button2->place( -x => 203, -y => 14, -height => 25, -width => 64); my $Button3 = $mw->Button( -text => "Sair", -relief => "raised", -command => sub{exit 0} ); $Button3->place( -x => 270, -y => 14, -height => 25, -width => 64); $mw->geometry('350x50'); MainLoop; # Below is the sub that creates the doc sub geraNova { my $ctrl = './control.dat'; open(CTR, "+>>$ctrl") || die "Não foi posspivel abrir o arquivo. E +rro: $!"; flock(CTR, 2); my $id = <CTR>; flock(CTR, 8); close(CTR); $id = $id + 1; unlink $ctrl; open(CTR, "+>>$ctrl"); flock(CTR, 2); print CTR $id; flock(CTR, 8); close(CTR); $id = addZeros($id); #I've renamed the file after it was created and after this app was + closed my $file = 'C:\foo\path1\test'.$id.'.xls'; my $Excel = Win32::OLE->GetActiveObject('Excel.Application') || Wi +n32::OLE->new('Excel.Application'); # I've tested with the alerts enabled and there was no error $Excel->{DisplayAlerts} = 0; $Excel->{Visible} = 1; my $Book = $Excel->Workbooks->Add(); $Book->SaveAs($file); my $ActBook = $Excel->Workbooks->Open("$file") || die "Não foi pos +sível abrir a planilha. Erro: $!"; undef $Excel; undef $Book; undef $ActBook; } sub addZeros { my $num = $_[0]; while(length($num) < 6) { $num = "0".$num; } return $num; } sub onAbout { my $about = $mw->DialogBox( -title=>"Sobre...", -buttons=>["OK"] ); $about->add('Label', -anchor => 'w', -justify => 'center', -text => qq( Excel Controller 1.0 by Er Galvão Abbott -Dúvidas, Bugs ou sugestões: galvao\@galvao.eti.br - Visite meu site em: http://www.galvao.eti.br/ ) )->pack; $about->Show(); }
      my ($author_nickname, $author_email) = ("DaWolf","erabbott\@terra.com.br") if ($author_name eq "Er Galvão Abbott");

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://321413]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (3)
As of 2024-04-24 05:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found