HoRus Posted June 11, 2007 Posted June 11, 2007 I try to get the functions FileSaveDialog() and FileCopy() to work with the following code:____ RunWait("C:\Program Files\Internet Explorer\iexplore.exe http://www.westbrabantsevwg.nl/waarneminge...ries.log") WinWait("entries[1].log - Kladblok") WinActivate("entries[1].log - Kladblok") $Padnaam="H:\WebBeheer\Waarnemingen\Gewoon\" $Lognaam=@YEAR & @MON & @MDAY & "_entries.txt" $X=FileSaveDialog ( "Opslaan", $Padnaam, "Text files (*.txt)", 16, $Lognaam ) MsgBox( 1, $X,"")----When I run this script, the file entries[1].log is opened and the save dialog opens correctly with the right path and filename.Then when I click the Save button the dialog closes but no file is saved.The same occurs for the function FileCopy with the script:________ $Padnaam="H:\WebBeheer\Waarnemingen\Gewoon\" $Lognaam=@YEAR & @MON & @MDAY & "_entries.txt" If FileExists($Padnaam & "entries.log") Then MsgBox( 1, "Yes","") Else MsgBox( 1, "No","") EndIf If FileCopy($Padnaam & "entries.log", $Padnaam & $Lognaam,1)=1 Then MsgBox( 1, "OK","") Else MsgBox( 1, "WRONG","") EndIf---------In both cases the result is OK (i.e. Yes and OK) but no new file is written.What do I wrong and how do I get these function to work?Piet
poisonkiller Posted June 11, 2007 Posted June 11, 2007 First piece of code: If I understand correctly, you are trying to save a file from internet. FileSaveDialog doesn't save anything, it only lets you to browse, where to save your file. $Padnaam="H:\WebBeheer\Waarnemingen\Gewoon\" $Lognaam=@YEAR & @MON & @MDAY & "_entries.txt" $X=FileSaveDialog ( "Opslaan", $Padnaam, "Text files (*.txt)", 16, $Lognaam ) InetGet("http://www.westbrabantsevwg.nl/waarnemingen/waarn-reg/entry-logs/entries.log", $X) MsgBox( 1, $X,"")oÝ÷ Ù'¢wiç¡÷(uäëÉÈZ§Øb±Êy«¢+Ù%¥± ½Áä ÀÌØíA¹´µÀìÅÕ½Ðí¹Ñɥ̹±½ÅÕ½Ðì°ÀÌØíA¹´µÀìÀÌØí1½¹´°Ä¤ôÄQ¡¸oÝ÷ ÚÚ-+ºÚ"µÍÌÍØÛÜHH[PÛÜJ ÌÍÔYX[H [È ][ÝÙ[YËÙÉ][ÝË ÌÍÔYX[H [È ÌÍÓÙÛX[KJBY ÌÍØÛÜHHH[
HoRus Posted June 11, 2007 Author Posted June 11, 2007 First piece of code: If I understand correctly, you are trying to save a file from internet. FileSaveDialog doesn't save anything, it only lets you to browse, where to save your file. $X=FileSaveDialog ( "Opslaan", $Padnaam, "Text files (*.txt)", 16, $Lognaam ) InetGet("http://www.westbrabantsevwg.nl/waarnemingen/waarn-reg/entry-logs/entries.log", $X) This works for saving A file with that name, but it is a null-file. So, it is empty..... The point is that the logfile is opened (in notepad) from internet and my intention is to save this open file. Preferably without interaction like a dialog. Second piece of code: Try changing this code: If FileCopy($Padnaam & "entries.log", $Padnaam & $Lognaam,1)=1 ThenoÝ÷ ÚÚ-+ºÚ"µÍÌÍØÛÜHH[PÛÜJ ÌÍÔYX[H [È ][ÝÙ[YËÙÉ][ÝË ÌÍÔYX[H [È ÌÍÓÙÛX[KJBY ÌÍØÛÜHHH[ A local file will copy, but not the file directly from internet, not even with added Uname:Pword. The logfile is in the internet cache, but if I try: FileExist("Z:\Tijdelijke Internet-bestanden\entries.log") I get a false result (Not 1) ('Tijdelijke Internetbestanden' means: Tempory internet files) Piet
poisonkiller Posted June 11, 2007 Posted June 11, 2007 This works for saving A file with that name, but it is a null-file. So, it is empty.....The point is that the logfile is opened (in notepad) from internet and my intention is to save this open file. Preferably without interaction like a dialog.For doing that try to use ControlGetText to get text from Notepad window and FileWrite to save that text.
HoRus Posted June 11, 2007 Author Posted June 11, 2007 I solved the problem bij sending keyboard strokes with Send() to save the open logfile to a specific location and file. It is just a script to make a backup copy every day. Thanks for your help. Piet
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now