Jump to content

Bug Or Something?


Recommended Posts

Hey, i think i've founded an error in the Include file...

while running the 'Beta Run' in sciTE it'll say:

C:\Program Files\AutoIt3\Include\String.au3(16,59) : ERROR: $strHex already declared as parameter
Local $strChar, $aryHex, $i, $iDec, $Char, $file, $strHex,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
C:\Program Files\AutoIt3\Include\String.au3(60,112) : ERROR: $i_Encrypt

..Any way to fix this?

EDIT: Huh weird, i found more bugs... so it isn't the include file, but it's me that's wrong..

here's the errors... any help?

C:\Program Files\AutoIt3\Include\String.au3(16,59) : ERROR: $strHex already declared as parameter
    Local $strChar, $aryHex, $i, $iDec, $Char, $file, $strHex,
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
C:\Program Files\AutoIt3\Include\String.au3(60,112) : ERROR: $i_EncryptLevel already declared as parameter
      If Number($i_EncryptLevel) <= 0 Or Int($i_EncryptLevel) <> $i_EncryptLevel Then Local $i_EncryptLevel = 1
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~^
C:\Documents and Settings\Administrator\Desktop\New MyGUI\File Converter.au3(67,35) : ERROR: syntax error
        FileWrite(@WorkingDir&$file_map&,
        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^

-ImMenSe

Edited by Immense
Link to comment
Share on other sites

I'm not sure, bu I sometimes get similar error's when a file which I'm including, includes another file in it that I've included myself too, meaning it's double included.

Edited by marfdaman

Don't take my pic to serious...~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~You Looked, but you did not see!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Link to comment
Share on other sites

You can't delcare a variable in a Local call if it's already declared as a variable in the call to that function, like:

Func Anyfunc ($Variable)

Local $Variable

EndFunc

That will produce the same error you got. If you did this, remove the Local call for it.

Also, Delcaring the $Variable elsewhere before a Local call might do this too. Like:

$Variable = w/e

or

Global $Variable

Eliminate these possibilities and try your script again. If you don't post the entire source it is hard to tell, so if you still get the error, post the entire script.

Nomad :D

Link to comment
Share on other sites

  • Moderators

Remove the variable from the "Local" part and it will work properly (any variable that is a parameter that is). What beta version are you running?

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.

Link to comment
Share on other sites

hey,

I couldn't find the things you said, soo....

;;      .Au3 Includes       ;;
#include <GUIConstants.au3>
#include <String.au3>
#include <File.au3>

;;      Setup       ;;
Global $width   =   @DesktopWidth/2
Global $height  =   @DesktopHeight/2
Global $title   =   "File Converter Program"
Global $handle  =   GUICreate($title,$width,$height)

Global $file_data   =   "feed.dat"
Global $file_map    =   "Files"

;;      Menu's Create       ;;
$menu_file  =   GUICtrlCreateMenu("File")

;;      Menu File Items     ;;
$menu_file_add  =   GUICtrlCreateMenuitem("Add File",$menu_file)

If (FileExists($file_data)) Then
    If (_FileCountLines($file_data)>0) Then
        $menu_file_load =   GUICtrlCreateMenu("Load File",$menu_file)
    EndIf
Else
    _FileCreate($file_data)
EndIf

$menu_file_exit =   GUICtrlCreateMenuitem("Exit",$menu_file)


GUISetState(@SW_SHOW,$handle)

While 1
    $event  =   GUIGetMsg()
    
    Select
        Case $event = $GUI_EVENT_CLOSE Or $event = $menu_file_exit
            Exit
            
        Case $event = $menu_file_add
            func_add_file()
    EndSelect
WEnd

Exit

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

Func func_add_file()
    $fileOpen   =   FileOpenDialog("Add a file",@WorkingDir,"All Files (*.*)",1+2)
    
    If @error = 0 Then
        $fileGet    =   StringSplit($fileOpen,"\")
        $fileName   =   $fileGet[$fileGet[0]]
        $fileType   =   StringRight($fileName,3)
        
        FileWrite(@ScriptDir&"/"&$file_data&"/",$fileType&" | "&$fileOpen&@CRLF)
        
        $string     =   FileRead($fileOpen,FileGetSize($fileOpen))
        
        $stringLeft =   StringLeft($string,30)
        $stringLeft =   _StringReverse($stringLeft)

        $string     =   $stringLeft & StringTrimLeft($string,30)

        FileWrite(@WorkingDir&$file_map&,$string)
    EndIf
EndFunc

Hope you or someone else find the bug :D

-ImMenSe

Link to comment
Share on other sites

  • Moderators

Im running V 3.1.1.125

It shows your using the "Release" version in your example (No beta), try running it with Alt+F5 from SciTe and see if you still get the same error. I don't have the Released version on my computer to check.

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.

Link to comment
Share on other sites

It shows your using the "Release" version in your example (No beta), try running it with Alt+F5 from SciTe and see if you still get the same error. I don't have the Released version on my computer to check.

I am using the beta...

And Nomad asked for the includes.. so i've put them below:

String.au3

That's the newest AutoIt... Also on my other version (non beta) also causes the bug..

Link to comment
Share on other sites

  • Moderators

I am using the beta...

And Nomad asked for the includes.. so i've put them below:

String.au3

That's the newest AutoIt... Also on my other version (non beta) also causes the bug..

I'm sorry, but your not using beta:

C:\Program Files\AutoIt3\Include\String.au3(16,59) : ERROR: $strHex already declared as parameter
    Local $strChar, $aryHex, $i, $iDec, $Char, $file, $strHex,
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
C:\Program Files\AutoIt3\Include\String.au3(60,112) : ERROR: $i_EncryptLevel already declared as parameter
      If Number($i_EncryptLevel) <= 0 Or Int($i_EncryptLevel) <> $i_EncryptLevel Then Local $i_EncryptLevel = 1
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~^
C:\Documents and Settings\Administrator\Desktop\New MyGUI\File Converter.au3(67,35) : ERROR: syntax error
        FileWrite(@WorkingDir&$file_map&,
        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
It doesn't say anywhere that it is beta... but it does show

C:\Program Files\AutoIt3\Include\String.au3

That it isn't beta.

Edit:

I don't see an error with parameters in that include file either (that is the beta include) that your showing in your posted errors.

Edited by SmOke_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.

Link to comment
Share on other sites

I think you misunderstood me. I didn't mean for you to put the $Variables in the Func ($Variable), like that. I meant that you can't do that AND declare the same variable as a variable.

Also, your FileWrite at the bottom of your main script is clearly the wrong syntax, take a closer look. If you still don't see it compare it with the FileWrite example in the help menu. I'll look over the script some more and see if I can see any more errors.

Here is a good example:

Func _StringEncrypt($i_Encrypt, $s_EncryptText, $s_EncryptPassword, $i_EncryptLevel = 1)
    If $i_Encrypt <> 0 And $i_Encrypt <> 1 Then
        SetError(1)
        Return ''
    ElseIf $s_EncryptText = '' Or $s_EncryptPassword = '' Then
        SetError(1)
        Return ''

you can't put $i_Encrypt in the func parameter like :

Func _StringEncrypt($i_Encrypt

and use it within the function.

Edited by Nomad
Link to comment
Share on other sites

  • Moderators

I think you misunderstood me. I didn't mean for you to put the $Variables in the Func ($Variable), like that. I meant that you can't do that AND declare the same variable as a variable.

Also, your FileWrite at the bottom of your main script is clearly the wrong syntax, take a closer look. If you still don't see it compare it with the FileWrite example in the help menu. I'll look over the script some more and see if I can see any more errors.

Here is a good example:

Func _StringEncrypt($i_Encrypt, $s_EncryptText, $s_EncryptPassword, $i_EncryptLevel = 1)
    If $i_Encrypt <> 0 And $i_Encrypt <> 1 Then
        SetError(1)
        Return ''
    ElseIf $s_EncryptText = '' Or $s_EncryptPassword = '' Then
        SetError(1)
        Return ''

you can't put $i_Encrypt in the func parameter like :

Func _StringEncrypt($i_Encrypt

and use it within the function.

That's more confusing I think... You can use the parameters in the function like that, you just can't declare them as Local/Global/Dim because they are already defined parameters.

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.

Link to comment
Share on other sites

hmm, I'll have to try that. I thought I got an error when I tried to do that not too long ago.

Ack, my bad. Smoke is right, you just can't declare it with a Local/Global/Dim...

But fix your FileWrite syntax here:

FileWrite(@WorkingDir&$file_map&,$string)

and try it again and post what errors you get.

Edited by Nomad
Link to comment
Share on other sites

Eh?..... I didn't do anything with the include you know.. :D And the code on the end of my script is wrong?

i'll check it now...

Func func_add_file()
    $fileOpen   =   FileOpenDialog("Add a file",@WorkingDir,"All Files (*.*)",1+2)
    
    If @error = 0 Then
        $fileGet    =   StringSplit($fileOpen,"\")
        $fileName   =   $fileGet[0]
        $fileType   =   StringRight($fileName,3)
        
        $filePath   =   @ScriptDir&"/"&$file_data&"/"
        $fileStr    =   $fileType&" | "&$fileOpen&@CRLF
        
        FileWrite($filePath,$fileStr)
        
        $string     =   FileRead($fileOpen,FileGetSize($fileOpen))
        
        $stringLeft =   StringLeft($string,30)
        $stringLeft =   _StringReverse($stringLeft)

        $string     =   $stringLeft & StringTrimLeft($string,30)

        $fileSName  =   StringLeft($fileName, StringLen($fileName)-4)
        $filePath   =   @ScriptDir&"/"&$file_map&"/"&$fileSName&".fls"
        FileWrite($filePath,$string)
    EndIf
EndFunc

Changed it a bit... dunno if syntax is alright or everything else :D

- ImMenSe

EDIT:

Oh yeah forgot to say, that it still say something.. I've saw a lost &...I've removed it and i also changed some things..

It now says:

C:\Program Files\AutoIt3\Include\String.au3(16,59) : ERROR: $strHex already declared as parameter
    Local $strChar, $aryHex, $i, $iDec, $Char, $file, $strHex,
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
C:\Program Files\AutoIt3\Include\String.au3(60,112) : ERROR: $i_EncryptLevel already declared as parameter
      If Number($i_EncryptLevel) <= 0 Or Int($i_EncryptLevel) <> $i_EncryptLevel Then Local $i_EncryptLevel = 1
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~^
Edited by Immense
Link to comment
Share on other sites

Eh?..... I didn't do anything with the include you know.. :D And the code on the end of my script is wrong?

i'll check it now...

Func func_add_file()
    $fileOpen   =   FileOpenDialog("Add a file",@WorkingDir,"All Files (*.*)",1+2)
    
    If @error = 0 Then
        $fileGet    =   StringSplit($fileOpen,"\")
        $fileName   =   $fileGet[0]
        $fileType   =   StringRight($fileName,3)
        
        $filePath   =   @ScriptDir&"/"&$file_data&"/"
        $fileStr    =   $fileType&" | "&$fileOpen&@CRLF
        
        FileWrite($filePath,$fileStr)
        
        $string     =   FileRead($fileOpen,FileGetSize($fileOpen))
        
        $stringLeft =   StringLeft($string,30)
        $stringLeft =   _StringReverse($stringLeft)

        $string     =   $stringLeft & StringTrimLeft($string,30)

        $fileSName  =   StringLeft($fileName, StringLen($fileName)-4)
        $filePath   =   @ScriptDir&"/"&$file_map&"/"&$fileSName&".fls"
        FileWrite($filePath,$string)
    EndIf
EndFunc

Changed it a bit... dunno if syntax is alright or everything else :D

- ImMenSe

EDIT:

Oh yeah forgot to say, that it still say something.. I've saw a lost &...I've removed it and i also changed some things..

It now says:

C:\Program Files\AutoIt3\Include\String.au3(16,59) : ERROR: $strHex already declared as parameter
    Local $strChar, $aryHex, $i, $iDec, $Char, $file, $strHex,
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
C:\Program Files\AutoIt3\Include\String.au3(60,112) : ERROR: $i_EncryptLevel already declared as parameter
      If Number($i_EncryptLevel) <= 0 Or Int($i_EncryptLevel) <> $i_EncryptLevel Then Local $i_EncryptLevel = 1
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~^
That's because both of those variables are declared as parameters in the func definition, like:

Func AnyFunc ($strHex)

then when you try to use $strHex in the Local like:

Local $strHex

it throws an error. remove it from the Local for all variables which you do that with and try again

Link to comment
Share on other sites

  • Moderators

UGH!!...

When you run your script... Use Alt+F5 from SciTe (or use Beta Run in the Tools area from SciTe)... You're still not using the Beta Include that you posted here.

Edited by SmOke_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.

Link to comment
Share on other sites

Regardless of that, he is still declaring a variable as a parameter within the function and then declaring it as a Local variable within the same function. Whether he is using beta or not that is going to give him an error. He needs to fix the syntax before it will run with beta or not.

Link to comment
Share on other sites

UGH!!...

When you run your script... Use Alt+F5 from SciTe (or use Beta Run in the Tools area from SciTe)... You're still not using the Beta Include that you posted here.

I always do that ;)..soo....it still give this error, and also when i press F5 normally, let's try toggle..

same... :D:D:P

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...