Jump to content

Problem with script [Picture inside(at end)]


Recommended Posts

Need someone to test script for errors.I want to know i am am only one who have errors on running it.

#include<GUIConstants.au3>
      #include<misc.au3>
      #include<GUIEdit.au3>
      #include<string.au3>
     
      ;~ $var =IniReadSection("install.ini","install")
     
      ;~    For $i = 1 To $var[0][0]
      ;~        MsgBox(4096, "", "Key: " & $var[$i][0] & @CRLF& "Value: " & $var[$i][1])
      ;~    Next
     
     
     
      global$currentprogram = ""
      global $ishide= IniRead(@ScriptDir&"\install.ini","general","HideGUI","def")
     
     
      $Form1 =GUICreate("Apt-get", 640, 480, 201, 116, BitOr($GUI_SS_DEFAULT_GUI,$WS_SIZEBOX))
      $MenuItem1 =GUICtrlCreateMenu("General")
      $MenuItem11 =GUICtrlCreateMenuItem("Copy text", $MenuItem1)
      $MenuItem12 =GUICtrlCreateMenuItem("Save text", $MenuItem1)
      $MenuItem13 =GUICtrlCreateMenuItem("Fullscreen", $MenuItem1)
      $MenuItem14 =GUICtrlCreateMenuItem("Hide", $MenuItem1)
      $MenuItem2 =GUICtrlCreateMenu("Help")
      $MenuItem21 =GUICtrlCreateMenuItem("About", $MenuItem2)
      $MenuItem22 =GUICtrlCreateMenuItem("Install.ini Commands", $MenuItem2)
      global $output= GUICtrlCreateedit ("",3,0,638,460,$ES_NOHIDESEL)
      WinActivate("Apt-get")
      Send("dfsd")
      GUICtrlSetBkColor(-1,0x000000)
      GUICtrlSetColor(-1,0xC0C0C0)
      GUICtrlSetFont(-1,10, 500, 0,"terminal")
      GUICtrlSetData($output,"Welcome to installer, made by Rain"&@crlf&'Toseeavaible commands click on help menu and then click on "Install.iniCommands"')
      $admin =IsAdmin ()
      If $admin = 0Then
      $oldoutput =GUICtrlRead($output)
      GUICtrlSetData($output,$oldoutput&@CRLF&"Sorry,you DO NOT have permission to install any programm, please exit now")
      EndIf
      _getlist ()
         
      GUISetState(@SW_SHOW)
     
      While 1
         $nMsg = GUIGetMsg()
         Switch $nMsg
             Case $GUI_EVENT_CLOSE
             Exit
         Case $MenuItem11
             $textcopy = GUICtrlRead($output)
             ClipPut ($textcopy)
         Case $MenuItem13
            WinMove("Apt-get","",0,0,@DesktopWidth,@DesktopHeight)
         case $MenuItem21
             msgbox (48,"Help","No helpavaible yet")
         case $MenuItem21
             msgbox (48,"Commands","No anycommands yet")
         case $MenuItem14
             $ishide = 1
             GUISetState(@SW_HIDE)
      EndSwitch
         WEnd
     
      Func _getlist ()
         $ProgramsToInstall = 0
         $var = IniReadSection("install.ini","install")
     
         For $i = 1 To $var[0][0]
      ;~        MsgBox(4096, "", "Key: " & $var[$i][0] & @CRLF& "Value: " & $var[$i][1])
         $ProgramName = $var[$i][1]
         $ProgramsToInstall =     $ProgramsToInstall +1
         Next
         $ProgramName = "Firefox"
         $oldoutput = GUICtrlRead($output)
         GUICtrlSetData($output,$oldoutput&@CRLF&""&@CRLF&"Number programs selected forinstalation:"&$ProgramsToInstall)
         $oldoutput = GUICtrlRead($output)
         GUICtrlSetData($output,$oldoutput&@CRLF&""&@CRLF&$ProgramName)
         $oldoutput = GUICtrlRead($output)
         GUICtrlSetData($output,$oldoutput&@CRLF&""&@CRLF&"Starting instalation")
         _firefoxask ()
      EndFunc   
     
      func_firefoxask ()
         If $ishide = 1 Then
             _firefox ()
         Else
             If $ishide = 0 Then
         $currentprogram    = "Firefox"
         $oldoutput = GUICtrlRead($output)
         GUICtrlSetData($output,$oldoutput&@CRLF&"Doyou want installfirefox? (If you answer no, it will be skipped)[yes;no]"&@crlf)    
      HotKeySet("{enter}","_check")
      EndIf
      EndIf
      EndFunc   
         
      Func _firefox ()
      FileDelete("firefox.htm")
      FileDelete("firefox.exe")
     
      InetGet("http://www.mozilla.com/en-US/firefox/","firefox.htm", 1, 1)
     
      While@InetGetActive
           $oldoutput = GUICtrlRead($output)
         GUICtrlSetData($output,$oldoutput&@CRLF&""&@CRLF&""&@CRLF&" "&@CRLF&"Dedecting lastestversion")
       Sleep(550)
      Wend
     
      $version =FileReadLine (@scriptdir&"\firefox.htm",98)
      $count=StringLeft($version,75)
      $count2=Stringright($count,8)
      $oldoutput =GUICtrlRead($output)
      GUICtrlSetData($output,$oldoutput&@CRLF&"Dedcted"&$count2)
      InetGet("ftp://releases.mozilla.org/pub/mozilla.org/firefox/releases/latest/win32/en-US/FirefoxSetup "&$count2&".exe", "firefox.exe", 1, 1)
     
       $oldoutput = GUICtrlRead($output)   
      While@InetGetActive
       $bytes = @InetGetBytesRead
       $size = $bytes&"B"
        If $bytes > 1024 Then
       $bytes = $bytes / 1024
       $rounded = round($bytes, -0)
       $size = $rounded&"KB"
        If$rounded > 1024 Then
       $rounded = $rounded / 1024
        $mb= Round ($rounded,1)
       $size = $mb&"MB"
        EndIf
        EndIf
       GUICtrlSetData($output,$oldoutput&@CRLF&"Downloadingfirefox "&$count2&" "&$size&" Isdownloaded")
       Sleep(250)
        If$ishide = 0 Then
       GUISetState(@SW_SHOW)
        EndIf
         Wend
         $oldoutput = GUICtrlRead($output)
         GUICtrlSetData($output,$oldoutput&@CRLF&"Downloadingfirefox"&$count2&" complete,Installingfirefox"&$count2)
         ShellExecute("firefox.exe","-ms")
       EndFunc
     
     
      func _check ()
     
         $line = _GUICtrlEdit_GetLineCount ($output) - 1
         $Input=_GUICtrlEdit_GetLine($output,$line)
         $command = StringTrimLeft ($Input,0)
         If $command = "no" Then
             $oldoutput =GUICtrlRead($output)
            GUICtrlSetData($output,$oldoutput&@CRLF&$currentprogram&"skipped")
             Else
         If $command = "yes" Then
             $oldoutput =GUICtrlRead($output)
            GUICtrlSetData($output,$oldoutput&@CRLF&"Willnow install "&$currentprogram)
         EndIf    
      EndIf
      _firefox ()
      EndFunc

I got errors:

>"C:\Program Files\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.exe" /run /prod /ErrorStdOut /in "C:\Documents and Settings\kasutaja\Desktop\firefox\install.au3" /autoit3dir "C:\Program Files\AutoIt3" /UserParams 
+>16:23:30 Starting AutoIt3Wrapper v.1.10.1.4   Environment(Language:0409  Keyboard:00000425  OS:WIN_XP/Service Pack 2  CPU:X86)
>Running AU3Check (1.54.10.0)  from:C:\Program Files\AutoIt3
C:\Documents and Settings\kasutaja\Desktop\firefox\install.au3(93,7) : ERROR: syntax error
      EndFunc
~~~~~~^
C:\Documents and Settings\kasutaja\Desktop\firefox\install.au3(79,23) : ERROR: _firefoxask(): undefined function.
         _firefoxask ()
~~~~~~~~~~~~~~~~~~~~~~^
C:\Documents and Settings\kasutaja\Desktop\firefox\install.au3(82,24) : ERROR: func_firefoxask(): undefined function.
      func_firefoxask ()
~~~~~~~~~~~~~~~~~~~~~~~^
C:\Documents and Settings\kasutaja\Desktop\firefox\install.au3(84,24) : ERROR: _firefox(): undefined function.
             _firefox ()
~~~~~~~~~~~~~~~~~~~~~~~^
C:\Documents and Settings\kasutaja\Desktop\firefox\install.au3(90,35) : ERROR: _check(): undefined function.
      HotKeySet("{enter}","_check")
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
C:\Documents and Settings\kasutaja\Desktop\firefox\install.au3 - 5 error(s), 0 warning(s)
!>16:23:31 AU3Check ended.rc:2
>Exit code: 0   Time: 4.725
Edited by au3scr
Link to comment
Share on other sites

The same here

[quote]Don't expect for a perfect life ... Expect a least troubles ones[/quote]Contact me : ass@kiss.toWhat I Have Done :Favorites Manager Mangage your favorite's folder, that's coolPC Waker For those who want to save stickersWebScipts Supporter For those who've just started with Web and WebScriptsTemporary Looker Simple but powerful to manage your Temporary folder, you know what you downloaded[UDF] _NumberFormat() Better performance on number display[UDF] _DirGet() What a folder contain [how many (hidden,normal,...) files], with one line of code[UDF] _IsPressEs() Just like _IsPress() but for a group of keys

Link to comment
Share on other sites

i see some other bug at

global$currentprogram = ""
If$rounded > 1024 Then
If$ishide = 0 Then

[quote]Don't expect for a perfect life ... Expect a least troubles ones[/quote]Contact me : ass@kiss.toWhat I Have Done :Favorites Manager Mangage your favorite's folder, that's coolPC Waker For those who want to save stickersWebScipts Supporter For those who've just started with Web and WebScriptsTemporary Looker Simple but powerful to manage your Temporary folder, you know what you downloaded[UDF] _NumberFormat() Better performance on number display[UDF] _DirGet() What a folder contain [how many (hidden,normal,...) files], with one line of code[UDF] _IsPressEs() Just like _IsPress() but for a group of keys

Link to comment
Share on other sites

global$currentprogram = "" - missing sppace between global and $. Line 14 ish

C:\Documents and Settings\steve.fisher\Desktop\t.au3 (36) : ==> Unable to parse line.:

If $admin = 0Then - space again!!!!!!!!!!

If $admin = ^ ERROR

Line 102 ish While@InetGetActive space again while @.....

Line 116 ish While@InetGetActive while {space} @............

Line 123 ish If$rounded > 1024 Then space between if & $

C:\Documents and Settings\steve.fisher\Desktop\t.au3 (131) : ==> Missing separator character after keyword.:

If$ishide = 0 Then space between if & $

If^ ERROR

C:\Documents and Settings\steve.fisher\Desktop\t.au3 (68) : ==> Subscript used with non-Array variable.:

For $i = 1 To $var[0][0]

For $i = 1 To $var^ ERROR

Thats all I have time for - time to go home!

Edited by xircon
Link to comment
Share on other sites

I didnt get it.

I cant understand it because at home it works perfectly...But now I am at computer class (at school) And now i have these errors.

Edited by au3scr
Link to comment
Share on other sites

I fixed it as you said but i still have that "undefined function." errors

Edit

Fixed, but now it show the following screen

Welcome to installer, made by Rain

Toseeavaible commands click on help menu and then click on "Install.iniCommands"

Number programs selected forinstalation:1

Firefox

Starting instalation

Dedecting lastestversion

Dedecting lastestversion

Dedecting lastestversion

Dedecting lastestversion

Dedecting lastestversion

Dedecting lastestversion

Dedcted2.0.0.14

Downloadingfirefox 2.0.0.14 0B Isdownloaded

Downloadingfirefox2.0.0.14 complete,Installingfirefox2.0.0.14

Here is fixed:

#include<GUIConstants.au3>
#include<misc.au3>
#include<GUIEdit.au3>
#include<string.au3>

;~ $var =IniReadSection("install.ini","install")

;~    For $i = 1 To $var[0][0]
;~        MsgBox(4096, "", "Key: " & $var[$i][0] & @CRLF& "Value: " & $var[$i][1])
;~    Next



      global $currentprogram = ""
Global $ishide = IniRead(@ScriptDir & "\install.ini", "general", "HideGUI", "def")


$Form1 = GUICreate("Apt-get", 640, 480, 201, 116)
$MenuItem1 = GUICtrlCreateMenu("General")
$MenuItem11 = GUICtrlCreateMenuItem("Copy text", $MenuItem1)
$MenuItem12 = GUICtrlCreateMenuItem("Save text", $MenuItem1)
$MenuItem13 = GUICtrlCreateMenuItem("Fullscreen", $MenuItem1)
$MenuItem14 = GUICtrlCreateMenuItem("Hide", $MenuItem1)
$MenuItem2 = GUICtrlCreateMenu("Help")
$MenuItem21 = GUICtrlCreateMenuItem("About", $MenuItem2)
$MenuItem22 = GUICtrlCreateMenuItem("Install.ini Commands", $MenuItem2)
Global $output = GUICtrlCreateEdit("", 3, 0, 638, 460, $ES_NOHIDESEL)
WinActivate("Apt-get")
Send("dfsd")
GUICtrlSetBkColor(-1, 0x000000)
GUICtrlSetColor(-1, 0xC0C0C0)
GUICtrlSetFont(-1, 10, 500, 0, "terminal")
GUICtrlSetData($output, "Welcome to installer, made by Rain" & @CRLF & 'Toseeavaible commands click on help menu and then click on "Install.iniCommands"')
$admin = IsAdmin()
If $admin = 0 Then
    $oldoutput = GUICtrlRead($output)
    GUICtrlSetData($output, $oldoutput & @CRLF & "Sorry,you DO NOT have permission to install any programm, please exit now")
EndIf
_getlist()

GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $MenuItem11
            $textcopy = GUICtrlRead($output)
            ClipPut($textcopy)
        Case $MenuItem13
            WinMove("Apt-get", "", 0, 0, @DesktopWidth, @DesktopHeight)
        Case $MenuItem21
            MsgBox(48, "Help", "No helpavaible yet")
        Case $MenuItem21
            MsgBox(48, "Commands", "No anycommands yet")
        Case $MenuItem14
            $ishide = 1
            GUISetState(@SW_HIDE)
    EndSwitch
WEnd

Func _getlist()
    $ProgramsToInstall = 0
    $var = IniReadSection("install.ini", "install")

    For $i = 1 To $var[0][0]
;~        MsgBox(4096, "", "Key: " & $var[$i][0] & @CRLF& "Value: " & $var[$i][1])
        $ProgramName = $var[$i][1]
        $ProgramsToInstall = $ProgramsToInstall + 1
    Next
    $ProgramName = "Firefox"
    $oldoutput = GUICtrlRead($output)
    GUICtrlSetData($output, $oldoutput & @CRLF & "" & @CRLF & "Number programs selected forinstalation:" & $ProgramsToInstall)
    $oldoutput = GUICtrlRead($output)
    GUICtrlSetData($output, $oldoutput & @CRLF & "" & @CRLF & $ProgramName)
    $oldoutput = GUICtrlRead($output)
    GUICtrlSetData($output, $oldoutput & @CRLF & "" & @CRLF & "Starting instalation")
    _firefoxask()
EndFunc   ;==>_getlist

func _firefoxask()
If $ishide = 1 Then
    _firefox()
Else
    If $ishide = 0 Then
        $currentprogram = "Firefox"
        $oldoutput = GUICtrlRead($output)
        GUICtrlSetData($output, $oldoutput & @CRLF & "Doyou want installfirefox? (If you answer no, it will be skipped)[yes;no]" & @CRLF)
        HotKeySet("{enter}", "_check")
    EndIf
EndIf
;### Tidy Error: next line creates a negative tablevel.
;### Tidy Error: next line creates a negative tablevel for the line after it.
EndFunc   ;==>_getlist

Func _firefox()
    FileDelete("firefox.htm")
    FileDelete("firefox.exe")

    InetGet("http://www.mozilla.com/en-US/firefox/", "firefox.htm", 1, 1)

    While @InetGetActive
        $oldoutput = GUICtrlRead($output)
        GUICtrlSetData($output, $oldoutput & @CRLF & "" & @CRLF & "" & @CRLF & " " & @CRLF & "Dedecting lastestversion")
        Sleep(550)
    WEnd

    $version = FileReadLine(@ScriptDir & "\firefox.htm", 98)
    $count = StringLeft($version, 75)
    $count2 = StringRight($count, 8)
    $oldoutput = GUICtrlRead($output)
    GUICtrlSetData($output, $oldoutput & @CRLF & "Dedcted" & $count2)
    InetGet("ftp://releases.mozilla.org/pub/mozilla.org/firefox/releases/latest/win32/en-US/FirefoxSetup " & $count2 & ".exe", "firefox.exe", 1, 1)

    $oldoutput = GUICtrlRead($output)
    While @InetGetActive
        $bytes = @InetGetBytesRead
        $size = $bytes & "B"
        If $bytes > 1024 Then
            $bytes = $bytes / 1024
            $rounded = Round($bytes, -0)
            $size = $rounded & "KB"
            If $rounded > 1024 Then
                $rounded = $rounded / 1024
                $mb = Round($rounded, 1)
                $size = $mb & "MB"
            EndIf
        EndIf
        GUICtrlSetData($output, $oldoutput & @CRLF & "Downloadingfirefox " & $count2 & " " & $size & " Isdownloaded")
        Sleep(250)
        If $ishide = 0 Then
            GUISetState(@SW_SHOW)
        EndIf
    WEnd
    $oldoutput = GUICtrlRead($output)
    GUICtrlSetData($output, $oldoutput & @CRLF & "Downloadingfirefox" & $count2 & " complete,Installingfirefox" & $count2)
    ShellExecute("firefox.exe", "-ms")
EndFunc   ;==>_firefox


Func _check()

    $line = _GUICtrlEdit_GetLineCount($output) - 1
    $Input = _GUICtrlEdit_GetLine($output, $line)
    $command = StringTrimLeft($Input, 0)
    If $command = "no" Then
        $oldoutput = GUICtrlRead($output)
        GUICtrlSetData($output, $oldoutput & @CRLF & $currentprogram & "skipped")
    Else
        If $command = "yes" Then
            $oldoutput = GUICtrlRead($output)
            GUICtrlSetData($output, $oldoutput & @CRLF & "Willnow install " & $currentprogram)
        EndIf
    EndIf
    _firefox()
EndFunc   ;==>_check
Edited by au3scr
Link to comment
Share on other sites

here is my current ini.

It works but not as needed

[general]
HideGUI=0

[install]
=firefox

Here is text that program gives

Welcome to installer, made by Rain

Toseeavaible commands click on help menu and then click on "Install.iniCommands"

Now, same working thing on other computer in computer class gets error

Number programs selected forinstalation:1

Firefox

Starting instalation

Doyou want installfirefox? (If you answer no, it will be skipped)[yes;no]

yes

Willnow install Firefox

Dedecting lastestversion

Dedecting lastestversion

Dedecting lastestversion

Dedecting lastestversion

Dedcted2.0.0.14

Downloadingfirefox 2.0.0.14 0B Isdownloaded

Downloadingfirefox2.0.0.14 complete,Installingfirefox2.0.0.14

I cant get why it dont download firefox, and it says downloading is complete but it even dont start with downloading.

And then it opens installed firefox.

It should start downloading firefox

Edited by au3scr
Link to comment
Share on other sites

line 14: global$currentprogram = "" missing space: global $current...

line 35: If $admin = 0Then missing space: ... 0 Then

line 82: func_firefoxask () missing space: func _firefoxask ()

line 122: If$rounded > 1024 Then missing space: If $rounded ...

line 130: If$ishide = 0 Then missing space: If $ishide ...

line 142: $line = _GUICtrlEdit_GetLineCount ($output) - 1 there must not be underline between Edit and Get

line 143: $Input=_GUICtrlEdit_GetLine($output,$line) there must not be underline between Edit and Get

I got some error on line 67 (Subscript used with non-Array variable), because I have no install.ini file - there should be some test, if @error=1 then show message box with error.

Be careful about spaces and underlines and everything should be better.

[right]Software is like sex - it's better when it's free. (Linus Torvalds)[/right]

Link to comment
Share on other sites

Why my scripts work at home, and at computer class i got errors.

I fixed script in current computer,then I went to another computer,copied fixed source there, and i got new errors.

Do some one know abut this?

How i can write standard source that work everywhere ?

Link to comment
Share on other sites

Why it happens so as on picture?

I have no idea whats wrong.Can some one tell it please?

How i can fix it? it might be dumb request, but can some one post here fixed version please?

Posted Image

I keep bumping until i get rid of bugs

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