Jump to content

[Resolved] Incorrect number of parameters in function call.


Recommended Posts

My script is stuck. Looking in help file and with new google trick haven't been able to figure out what's wrong. This is affected portion

$PATH = InputBox("Please enter path to the text file.","Path",""," ","450","125","700","150")
    $TxtFile = $PATH
    ClipPut(FileRead($TxtFile))
;-----------------------------------------------------------------------------------------------------------------------------------------------
;  1.  Prepare HTML file and save to desktop:
    $TempFILE = @DesktopDir & "\HTMLfile- Temporary.html"
    FileDelete($TempFILE)
    $TEXTdump = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">' & @CRLF & '<HTML><HEAD><TITLE>TITLE</TITLE>' & @CRLF & '<META content="text/html; charset=windows-1252" http-equiv=Content-Type>' & @CRLF & '<META content="MSHTML 5.00.2614.3500" name=GENERATOR></HEAD>' & @CRLF & '<BODY aLink=#ff9933 bgColor=#C8B89B link=#003399 text=#000000 vLink=#996633><A name=top></A>' & @CRLF & @CRLF & '<font color="#804040" face="times new roman"></font>' & @CRLF & @CRLF & '<a name="linkTop"><center><h1><b><u>Text File</u></b></h1></center><br>' & @CRLF & @CRLF & '<h4>' & ClipGet(FileRead($TxtFile)) & '</h4>' & @CRLF & '<center><img src="' & @CRLF & '" alt=""></center><br>' & @CRLF & '</CENTER></BODY></HTML>'
    FileWrite($TempFILE, $TEXTdump)

Error is this, where I've deleted the bulk, just showing where error is pointing to:

---------------------------
AutoIt Error
---------------------------
Line 21  (File "C:\Documents and Settings\ComputerMine\Desktop\HTML page, create.au3"):

$TEXTdump = ... '<h4>' & ClipGet(FileRead($TxtFile)) ...
$TEXTdump = ... '<h4>' & ^ ERROR ...

Error: Incorrect number of parameters in function call.
---------------------------
OK   
---------------------------

I'm quite new to the whole file read/write thing. I don't know how else to get the clipboard data but with the ClipGet. It does work to a degree - pasting from the clipboard does paste the contents of the file, it's just not getting dumped into the html code and I'm getting the error instead.

Thanks for any help.

Edited by Diana (Cda)
Link to comment
Share on other sites

My script is stuck. Looking in help file and with new google trick haven't been able to figure out what's wrong. This is affected portion

$PATH = InputBox("Please enter path to the text file.","Path",""," ","450","125","700","150")
    $TxtFile = $PATH
    ClipPut(FileRead($TxtFile))
;-----------------------------------------------------------------------------------------------------------------------------------------------
;  1.  Prepare HTML file and save to desktop:
    $TempFILE = @DesktopDir & "\HTMLfile- Temporary.html"
    FileDelete($TempFILE)
    $TEXTdump = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">' & @CRLF & '<HTML><HEAD><TITLE>TITLE</TITLE>' & @CRLF & '<META content="text/html; charset=windows-1252" http-equiv=Content-Type>' & @CRLF & '<META content="MSHTML 5.00.2614.3500" name=GENERATOR></HEAD>' & @CRLF & '<BODY aLink=#ff9933 bgColor=#C8B89B link=#003399 text=#000000 vLink=#996633><A name=top></A>' & @CRLF & @CRLF & '<font color="#804040" face="times new roman"></font>' & @CRLF & @CRLF & '<a name="linkTop"><center><h1><b><u>Text File</u></b></h1></center><br>' & @CRLF & @CRLF & '<h4>' & ClipGet(FileRead($TxtFile)) & '</h4>' & @CRLF & '<center><img src="' & @CRLF & '" alt=""></center><br>' & @CRLF & '</CENTER></BODY></HTML>'
    FileWrite($TempFILE, $TEXTdump)

Error is this, where I've deleted the bulk, just showing where error is pointing to:

---------------------------
AutoIt Error
---------------------------
Line 21  (File "C:\Documents and Settings\ComputerMine\Desktop\HTML page, create.au3"):

$TEXTdump = ... '<h4>' & ClipGet(FileRead($TxtFile)) ...
$TEXTdump = ... '<h4>' & ^ ERROR ...

Error: Incorrect number of parameters in function call.
---------------------------
OK   
---------------------------

I'm quite new to the whole file read/write thing. I don't know how else to get the clipboard data but with the ClipGet. It does work to a degree - pasting from the clipboard does paste the contents of the file, it's just not getting dumped into the html code and I'm getting the error instead.

Thanks for any help.

Diana, the error told you that there were the wrong number of parameters in ClipGet. Presumably you didn't believe that but if you look in the help it tells you that ClipGet has no parameters. I hope you can understand that I don't understand why you need to post a question so that someone can tell you what your post says.

I don't want you to think that I'm gettoing at you, (even though I am :mellow:).

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

At $TEXTdump replaced ClipGet(FileRead($TxtFile)) for ClipGet().

Ah, geez. Something so simple was tripping me up. I didn't realize, since I'd not be able to get plain, old ClipGet to work before the other time I tried using it that it _will_ work without parameters. Sorry about that. Thanks.

The trees get in the way of the forest sometimes <lol>

Cheers. <g>

Link to comment
Share on other sites

Diana, the error told you that there were the wrong number of parameters in ClipGet. Presumably you didn't believe that but if you look in the help it tells you that ClipGet has no parameters. I hope you can understand that I don't understand why you need to post a question so that someone can tell you what your post says.

I don't want you to think that I'm gettoing at you, (even though I am :mellow:).

? You lost me.

As for the rest, nah, s'all right. As long as people are kind, no worries. I realize that I have a long way to go. But I've come so very, very far. I just lack a ton of experience still <lol>.

I've been collecting research that I continuously access as well as update/append to all the time. All these years I've not had an easy way to get print output of anything without it being too labour intensive esp. as workload has increased. With this new script, I'll only have to do the searching of my research folders and then will produce the printouts with only about 5-10 mouseclicks and maybe 10-15 seconds of time, each, once the needed files are found! (Never ceases to amaze me how awesome AutoIt is!)

Once this is done, I'll have revolutionized how I work with my entire group of research folders. I grab snippets of text from websites from all over and pictures. I do this during lunch or at end of day at work whenever I need to, at home or at the library. The purpose of the TEXT TO HTML script is so that I don't have to start massively combining text and images to a word processed or PDF format, saving me a ton of work and hdd space. Yet whenever needed, I can get a text+image printout.

It'll keep my folders small since the text files and graphics are tiny in size, as is. As many of you know, put them together in a doct. and size increases enormously. Here's an example that I'm taking straight out of one of my folders:

Text file #1 = 2 kb

Graphic for above = 21 kb (total of both = ±23 kb)

RTF doct made with both above = 1402 kb (granted pdf much smaller but difficult to do edits)

One of my folders has 979 files in it currently at 33.1 megs which would be enormously bigger if I had to convert them. As it is, once I finish this TXT-2-HTML project, 18 megs of that I'll be able to get rid of!

Anyway, thanks to Danny35d for earlier pointing out what may seem very obvious to anyone with less experience than you guys! <g>

Also, again, thanks to everyone, esp. those who have enough patience to be kind! <g> That is a priceless gift. We all have different levels and abilities. I realize it must be tough for experienced users to come up with patience and for those of you who manage it and manage it with grace day-in, day-out, my deepest gratitude! I know it must be tough! <g>

Edited by Diana (Cda)
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...