herewasplato 2 Posted May 1, 2006 1. Create a variable (or string)$var = ""2. Prompt the user to type in a Serial Number. But if the user wants to exit, then the end the script. But if they want to continue to be able to. {Address this later or did you mean this as part of step 3.}$var = InputBox("....3. Verify if [a file with] that serial number [as part of the name] exist, if exist to prompt to over-write or to continue if it does not exist.If FileExists("V:" & "\" & $var & ".log") Then......{Let's say that the file did not exist, the script will continue to step 4.}4. Take the serial number and create a file either .log or .txtr with that serial number. $file = FileOpen("V:" & "\" & ($var) & ".log", 2) FileClose($file){Okay, so at this point, the script has created a file - but it is empty - nothing to print.}5. Then find the file and either open it with a notepad application, or send it directly to the printer.$print = _FilePrint("V:" & "\" & $var & ".log") If $print Then MsgBox(0, "Print", "The file was printed.") Else MsgBox(0, "Print", "Error: " & @error & @CRLF & "The file was not printed.") EndIf{It does not use Notepad - but it was the direction other members pointed you in. I've never used the UDF named _FilePrint and cannot test it right now. If you really want to use Notepad - (that will at least give you a page with the file title on it & file title contains serial number) ...if you want to do that, then post back and others can help with that.}Add the FileClose($file) and the code below step 5 to the other code that I posted and see if it works as you desire.I did not mean to criticize... just question. [size="1"][font="Arial"].[u].[/u][/font][/size] Share this post Link to post Share on other sites
meetrix 0 Posted May 1, 2006 Don't worry about it. Everything is good. Now, The _FilePrint does not work. It gives me the following error: Error: _FilePrit () : undefined fucntion. Any ideas. Let me know. Thanks everyone. Take care. 1. Create a variable (or string) $var = "" 2. Prompt the user to type in a Serial Number. But if the user wants to exit, then the end the script. But if they want to continue to be able to. {Address this later or did you mean this as part of step 3.} $var = InputBox(".... 3. Verify if [a file with] that serial number [as part of the name] exist, if exist to prompt to over-write or to continue if it does not exist. If FileExists("V:" & "\" & $var & ".log") Then......{Let's say that the file did not exist, the script will continue to step 4.} 4. Take the serial number and create a file either .log or .txtr with that serial number. $file = FileOpen("V:" & "\" & ($var) & ".log", 2) FileClose($file){Okay, so at this point, the script has created a file - but it is empty - nothing to print.} 5. Then find the file and either open it with a notepad application, or send it directly to the printer. $print = _FilePrint("V:" & "\" & $var & ".log") If $print Then MsgBox(0, "Print", "The file was printed.") Else MsgBox(0, "Print", "Error: " & @error & @CRLF & "The file was not printed.") EndIf{It does not use Notepad - but it was the direction other members pointed you in. I've never used the UDF named _FilePrint and cannot test it right now. If you really want to use Notepad - (that will at least give you a page with the file title on it & file title contains serial number) ...if you want to do that, then post back and others can help with that.} Add the FileClose($file) and the code below step 5 to the other code that I posted and see if it works as you desire. I did not mean to criticize... just question. Share this post Link to post Share on other sites
SmOke_N 210 Posted May 1, 2006 You spelled _FilePrint() as _FilePrit() (forgot the 'n') Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Share this post Link to post Share on other sites
meetrix 0 Posted May 1, 2006 In the script the command is typed correctly. I was just typing the error message from the status window.Don't worry about it. Everything is good.Now,The _FilePrint does not work. It gives me the following error: Error: _FilePrit () : undefined fucntion. Any ideas. Let me know.Thanks everyone. Take care. Share this post Link to post Share on other sites
herewasplato 2 Posted May 1, 2006 (edited) ...I was just typing...Copy and paste when you can. Use the AutoIt Window Info tool if need be. @Others, I'm not in a place where I can check, but is this fileprint UDF only in beta? (The system that I'm on has beta and production includes mixed up.) Edit: ;=============================================================================== ; Function Name: _FilePrint() ; Description: Prints a plain text file. ; Syntax: _FilePrint ( $s_File [, $i_Show] ) ; ; Parameter(s): $s_File = The file to print. ; $i_Show = The state of the window. (default = @SW_HIDE) ; ; Requirement(s): External: = shell32.dll (it's already in system32). ; Internal: = None. ; ; Return Value(s): On Success: = Returns 1. ; On Failure: = Returns 0 and sets @error according to the global constants list. ; ; Author(s): erifash <erifash [at] gmail [dot] com> ; ; Note(s): Uses the ShellExecute function of shell32.dll. ; ; Example(s): ; _FilePrint("C:\file.txt") ;=============================================================================== Func _FilePrint($s_File, $i_Show = @SW_HIDE) Local $a_Ret = DllCall("shell32.dll", "long", "ShellExecute", _ "hwnd", 0, _ "string", "print", _ "string", $s_File, _ "string", "", _ "string", "", _ "int", $i_Show) If $a_Ret[0] > 32 And Not @error Then Return 1 Else SetError($a_Ret[0]) Return 0 EndIf EndFunc ;==>_FilePrintinclude that near the bottom of your script Edit2: If you include the func shown above, remove #include <file.au3> from the top part of your script. Edited May 1, 2006 by herewasplato [size="1"][font="Arial"].[u].[/u][/font][/size] Share this post Link to post Share on other sites
meetrix 0 Posted May 2, 2006 I have tried the print function at home and it's working. It wouldn't work, but I notice that the $s_file was the wrong string. I changed it to $file and it worked. The final test will be done at work. Everyone Thank you very much for putting up with and my crazy ideas and all the questions. I have learned so much and having a support group like this, is what makes someone proud and delighted. Thank you all and have a great night. I need to merge two scripts and make it work. I will let you know how it goes. Meetrix Copy and paste when you can. Use the AutoIt Window Info tool if need be. @Others, I'm not in a place where I can check, but is this fileprint UDF only in beta? (The system that I'm on has beta and production includes mixed up.) Edit: ;=============================================================================== ; Function Name: _FilePrint() ; Description: Prints a plain text file. ; Syntax: _FilePrint ( $s_File [, $i_Show] ) ; ; Parameter(s): $s_File = The file to print. ; $i_Show = The state of the window. (default = @SW_HIDE) ; ; Requirement(s): External: = shell32.dll (it's already in system32). ; Internal: = None. ; ; Return Value(s): On Success: = Returns 1. ; On Failure: = Returns 0 and sets @error according to the global constants list. ; ; Author(s): erifash <erifash [at] gmail [dot] com> ; ; Note(s): Uses the ShellExecute function of shell32.dll. ; ; Example(s): ; _FilePrint("C:\file.txt") ;=============================================================================== Func _FilePrint($s_File, $i_Show = @SW_HIDE) Local $a_Ret = DllCall("shell32.dll", "long", "ShellExecute", _ "hwnd", 0, _ "string", "print", _ "string", $s_File, _ "string", "", _ "string", "", _ "int", $i_Show) If $a_Ret[0] > 32 And Not @error Then Return 1 Else SetError($a_Ret[0]) Return 0 EndIf EndFunc;==>_FilePrintinclude that near the bottom of your script Edit2: If you include the func shown above, remove #include <file.au3> from the top part of your script. Share this post Link to post Share on other sites