brdude Posted February 13, 2006 Share Posted February 13, 2006 I am quoting this from another post but no one semed to answer me there so I thougth you guys migth in here.Here is the link to the original post Ok guys i was playing with crise's script and I hit a lil problem wich made me curious.... At first when I downloaded it his script ran fine. Then I swiched all the if statements in main.au3 to select (source included) then tried to run it again and it gave me and error in the Constants.au3 wich I had never edited. It was telling me that I was trying to change a cons variable ($JavaVer) and there was a if else statement there so I know that constants can't be changed so i took the const of and now it runs fine. Here is my question why did autoit acuse the error when i was running the the select statement but not the if statement? Does auto it compile the script as it goes or does it compile every part of it before running it? If it does compile it as it goes I have java instaled and so it should never have reached that error in eather case but it did. If it compiles the whole script before running should the error not have showed up when if was used also?Any ideas, explanetions, deductions on this would help quite a bit.PS: Sorry for the bad english.... Brain overload So guys any idea why this is happening? i'm extremely curious........ Link to comment Share on other sites More sharing options...
flaxcrack Posted February 13, 2006 Share Posted February 13, 2006 Okay, I'll help. Paste your code in here. I want to see how you rewrote it... Also did you put the Constants.au3 in your /include directory? [quote] Gilbertson's Law: Nothing is foolproof to a sufficiently talented fool.Sandro Alvares: Flaxcrack is please not noob! i can report you is stop stupid. The Post[/quote]I made this: FWD & MD5PWD() Link to comment Share on other sites More sharing options...
Developers Jos Posted February 13, 2006 Developers Share Posted February 13, 2006 Don't get any errors with the posted scripts....Okay, I'll help. Paste your code in here. I want to see how you rewrote it... Also did you put the Constants.au3 in your /include directory?No need to put it in the Include directory when it is stored in the script directory. SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
brdude Posted February 13, 2006 Author Share Posted February 13, 2006 Here is the script guys. expandcollapse popup; Script generated by AutoBuilder 0.6 Prototype #include <GuiConstants.au3> #include "constants.au3" #include <array.au3> #include <date.au3> ProgressOn("Please Wait...", "Gathering Information") $UsedSpace = DriveSpaceTotal(@HomeDrive) & "(MB)" $FreeSpace = DriveSpaceFree(@HomeDrive) & "(MB)" $FileSystem = DriveGetFileSystem(@HomeDrive) $DriveLabel = DriveGetLabel(@HomeDrive) $DriveSerial = DriveGetSerial(@HomeDrive) $DriveType = DriveGetType(@HomeDrive) $DriveStatus = DriveStatus(@HomeDrive) ProgressSet(100) Sleep(2000) ProgressOff() GUICreate("Computer Diagnostics", 657, 559, -1, -1, BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS)) $ProcessGroup = GUICtrlCreateGroup("Process Information", 6, 22, 360, 270) $ProcessList = GUICtrlCreateList("", 12, 67, 351, 110) $RunningProcessesLabel = GUICtrlCreateLabel("Running Processes", 118, 45, 115, 15) $ProcessDescLabel = GUICtrlCreateLabel("Process Description:", 14, 198, 119, 20) $ProcessDesc = GUICtrlCreateLabel("Description", 36, 221, 280, 49) $SystemInformationGroup = GUICtrlCreateGroup("System Information", 6, 304, 358, 243) $SoftwareInformationGroup = GUICtrlCreateGroup("Software Information", 371, 22, 283, 270) $MiscInfoGroup = GUICtrlCreateGroup("Misc. Information", 370, 303, 279, 244) ;System Information GUICtrlCreateLabel("Windows Version: " & " " & $WindowsVer, 50, 330) GUICtrlCreateLabel("Windows Build: " & " " & $BUILD, 50, 350) GUICtrlCreateLabel("Windows Service pack: " & " " & $ServicePack, 50, 370) GUICtrlCreateLabel("Windows Defualt Language: " & " " & _Language(), 50, 390) GUICtrlCreateLabel("Used Hard Drive Space: " & " " & $UsedSpace, 50, 410) GUICtrlCreateLabel("Free Hard Drive Space: " & " " & $FreeSpace, 50, 430) GUICtrlCreateLabel("Hard Drive Label: " & " " & $DriveLabel, 50, 450) GUICtrlCreateLabel("Hard Drive Serial: " & " " & $DriveSerial, 50, 470) GUICtrlCreateLabel("Hard Drive Type: " & " " & $DriveType, 50, 490) GUICtrlCreateLabel("Hard Drive Status: " & " " & $DriveStatus, 50, 510) ;Software Information GUICtrlCreateLabel("Java Version: " & $JavaVer, 380, 50) $CookiesSize = DirGetSize($CookiesDir) / 1024 & "(KB)" $TemPSize = DirGetSize($TempDir) / 1024 & "(KB)" $Cookie_Label = GUICtrlCreateLabel("Cookies Size: " & $CookiesSize, 380, 70) $TempLabel = GUICtrlCreateLabel("Temp Size: " & $TemPSize, 380, 90) $DelCookies = GUICtrlCreateButton("Delete Cookies", 380, 110, 100, -1) $DelTemp = GUICtrlCreateButton("Delete Temp", 480, 110, 100, -1) ;Misc. Information GUICtrlCreateLabel("Installed Fonts", 380, 320) $FontList = GUICtrlCreateList("", 380, 350, 250, 100) $Time = GUICtrlCreateLabel("System Time: ", 380, 500) $TimeObject = GUICtrlCreateLabel("", 490, 500, 100, 100) $Fonts = _FileListToArray (@HomeDrive & "\windows\fonts", "*.ttf", 1) For $i = 1 To $Fonts[0] GUICtrlSetData($FontList, $Fonts[$i]) Next GUISetState() $Process = ProcessList() For $i = 1 To $Process[0][0] GUICtrlSetData($ProcessList, $Process[$i][0]) Next While 1 GUICtrlSetData($TimeObject, _NowTime()) $DescData = GUICtrlRead($ProcessList) Select Case $DescData = "explorer.exe" $ProcData = "Microsoft Windows Explorer" Case $DescData = "alg.exe" $ProcData = "Microsoft Windows Application Layer Gateway Service" Case $DescData = "wscntfy.exe" $ProcData = "Windows Security Center" Case $DescData = "hkcmd.exe" $ProcData = "Intel Hotkey command activator" Case $DescData = "cidaemon.exe" $ProcData = "Microsoft Indexing Service" Case $DescData = "msnmsgr.exe" $ProcData = "MSN Messenger" Case $DescData = "igfxtray.exe" $ProcData = "Intel(R) Graphics Accelerator Helper" Case $DescData = "cisvc.exe" $ProcData = "Microsoft Index Service Helper" Case $DescData = "spoolsv.exe" $ProcData = "Microsoft Printer Spooler Service" Case $DescData = "svchost.exe" $ProcData = "Microsoft Service Host Process" Case $DescData = "mqtgsvc.exe" $ProcData = "Message Queuing Triggers Service" Case $DescData = "iexplore.exe" $ProcData = "Microsoft Internet Explorer" Case $DescData = "lsass.exe" $ProcData = "Local Security Authority Service" Case $DescData = "services.exe" $ProcData = "Windows Service Controller" Case $DescData = "winlogon.exe" $ProcData = "Microsoft Windows Logon Process" Case $DescData = "csrss.exe" $ProcData = "Microsoft Client/Server Runtime Server Subsystem" Case $DescData = "smss.exe" $ProcData = "Session Manager Subsystem" Case $DescData = "mqsvc.exe" $ProcData = "Microsoft Message Queue Server" Case $DescData = "taskmgr.exe" $ProcData = "Windows Task Manager" Case $DescData = "wdfmgr.exe" $ProcData = "Windows Driver Foundation Manager" Case $DescData = "[System Process]" $ProcData = "System Idle Process" Case Else $Files = StringSplit($DescData, ".") $ProcData = $Files[1] GUICtrlSetData($ProcessDesc, $ProcData) EndSelect $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $DelCookies DelCookies() Case $msg = $DelTemp DelTemp() EndSelect WEnd Func _Language() Select Case StringInStr("0413,0813", @OSLang) Return "Dutch" Case StringInStr("0409,0809,0c09,1009,1409,1809,1c09,2009, 2409,2809,2c09,3009,3409", @OSLang) Return "English" Case StringInStr("040c,080c,0c0c,100c,140c,180c", @OSLang) Return "French" Case StringInStr("0407,0807,0c07,1007,1407", @OSLang) Return "German" Case StringInStr("0410,0810", @OSLang) Return "Italian" Case StringInStr("0414,0814", @OSLang) Return "Norwegian" Case StringInStr("0415", @OSLang) Return "Polish" Case StringInStr("0416,0816", @OSLang) Return "Portuguese" Case StringInStr("040a,080a,0c0a,100a,140a,180a,1c0a,200a, 240a,280a,2c0a,300a,340a,380a,3c0a,400a, 440a,480a,4c0a,500a", @OSLang) Return "Spanish" Case StringInStr("041d,081d", @OSLang) Return "Swedish" Case Else Return "Other (can't determine with @OSLang directly)" EndSelect EndFunc ;==>_Language Func DelCookies() FileDelete(@HomeDrive & "\documents and settings\" & @UserName & "\cookies\*.*") MsgBox(0, "Complete!", "Completed Deleting Files!", 3) GUICtrlSetData($Cookie_Label, "Cookies Size: " & DirGetSize(@HomeDrive & "\Documents and Settings\" & @UserName & "\Cookies") / 1024 & "(KB)") EndFunc ;==>DelCookies Func DelTemp() ProgressOn("Deleting Temp", "please wait...") FileDelete(@HomeDrive & "windows\temp\*.*") ProgressSet(100) ProgressOff() MsgBox(0, "Complete!", "Files deleted successfuly!", 3) GUICtrlSetData($TempLabel, "Temp Size: " & DirGetSize(@HomeDrive & "\windows\temp\") / 1024 & "(KB)") EndFunc ;==>DelTemp Exit ; Global Constants #include <file.au3> ;Main Directories Global Const $SystemDir = @HomeDrive & "\windows\system32" Global Const $WinDir = @HomeDrive & "\windows" Global Const $DocumentSettingsDir = @HomeDrive & "\documents and settings" Global Const $CurUserDir = @HomeDrive & "\documents and settings\" & @UserName Global Const $CookiesDir = $CurUserDir & "\cookies" Global Const $TempDir = @HomeDrive & "\windows\temp" ;Get Java Version $java = _FileListToArray (@ProgramFilesDir & "\java\") If (IsArray($java)) Then Global Const $JavaVer = $java[1] Else $JavaVer = "Java Not Installed" EndIf ;Windows Version Global Const $WindowsVer = @OSTYPE Global Const $Build = @OSBuild Global Const $ServicePack = @OSServicePack Global Const $Language = @OSLang ;Processor Global Const $Processor = @ProcessorArch ;SystemDir ;WinDir ;DocumentSettingsDir ;CurUserDir ;CookiesDir ;TempDir ;JavaVer ;WindowsVer ;Build ;ServicePack ;Processor Ok I did include Constants.au3 and it was on the same directory. JdeB the script I posted on the original topic dosent have the const I had taken it out from the original to make it work. I am wondering why did the original using if them worked with Global Const $JavaVer and when i swiched the code to select it gave me the error... Link to comment Share on other sites More sharing options...
Developers Jos Posted February 13, 2006 Developers Share Posted February 13, 2006 (edited) If (IsArray($java)) Then Global Const $JavaVer = $java[1] Else $JavaVer = "Java Not Installed" EndIf Au3check doesn't agree with a Global const definition and then a couple of lines later you potentially set it again.... Yes i know that the logic says its not going to happen but Au3Check doesn't know that. You really should define a Global Const only one time. Something like: $java = _FileListToArray (@ProgramFilesDir & "\java\") If (IsArray($java)) Then Local $t_JavaVer = $java[1] Else Local $t_JavaVer = "Java Not Installed" EndIf Global Const $JavaVer = $t_JavaVer Edited February 13, 2006 by JdeB SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
brdude Posted February 13, 2006 Author Share Posted February 13, 2006 JdeB I don't think you quite get what i am saying here let me try to explain it again. I have included a couple files to help me with the explanation... Here run main1.au3 with the constants.au3 include you see I get no error... And for this on the main there is a bunch of if statements in the main1.au3. Now run main2.au3 with the same constants.au3 included. You see now i get and error and it is on constants.au3 as you said before autoit dosen't agree with global consts. But on the main2.au3 instead of using if I am using select. Now i want to know why I am getting the error with select but not if...... Thanks a lot for your patience.....Constants.au3Main1.au3 Link to comment Share on other sites More sharing options...
Developers Jos Posted February 13, 2006 Developers Share Posted February 13, 2006 (edited) JdeB I don't think you quite get what i am saying here let me try to explain it again. I have included a couple files to help me with the explanation... Here run main1.au3 with the constants.au3 include you see I get no error... And for this on the main there is a bunch of if statements in the main1.au3. Now run main2.au3 with the same constants.au3 included. You see now i get and error and it is on constants.au3 as you said before autoit dosen't agree with global consts. But on the main2.au3 instead of using if I am using select. Now i want to know why I am getting the error with select but not if...... Thanks a lot for your patience..... You are correct, It Looks like an Au3Check issue. I have stripped your script to the below lines and this will NOT give the error. When you remove/comment the If...EndIF for Level 21 it will give the error ... expandcollapse popup; Error defining a Const and trying to change the value Global Const $a = 1 $a = 2 ; When 21 level deep If's, AU3Check doesnt give an error for above lines $Level = 0 If $Level = 1 Then If $Level = 2 Then If $Level = 3 Then If $Level = 4 Then If $Level = 5 Then If $Level = 6 Then If $Level = 7 Then If $Level = 8 Then If $Level = 9 Then If $Level = 10 Then If $Level = 11 Then If $Level = 12 Then If $Level = 13 Then If $Level = 14 Then If $Level = 15 Then If $Level = 16 Then If $Level = 17 Then If $Level = 18 Then If $Level = 19 Then If $Level = 20 Then If $Level = 21 Then EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf Edited February 14, 2006 by JdeB SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
brdude Posted February 13, 2006 Author Share Posted February 13, 2006 K thank JdeB i thougth I was going nuts because i couldn't find the problem but this answers it. Again thanks for the patience.... Link to comment Share on other sites More sharing options...
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