thuun Posted February 11, 2007 Share Posted February 11, 2007 (edited) I'm revising a little autoit script which sets a value in the registry. The value is the cache amount for a virtual file system, the number represents MB of RAM. I cannot seem to add a $Cmdline value which I'd like to use as an input option.example, this works...$memory = MemGetStats() $fbwfcache = ($memory[1] / 5 / 1024) RegWrite("HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\FBWF", "WinPECacheThreshold", "REG_DWORD", $fbwfcache) ExitThis doesn't...(??)Dim $p If $CmdLine[0] = 0 Then Exit $CmdLine[1] = $p $memory = MemGetStats() $fbwfcache = Round($memory[1] / $p / 1024) RegWrite("HKLM\SYSTEM\ControlSet001\Services\FBWF", "WinPECacheThreshold", "REG_DWORD", $fbwfcache) Exitwhen I put $cmdline in place of $p it produces a incorrect but noticable result.this is the issue... --> $fbwfcache = ($memory[1] / $p / 1024)When a real number is used it works.Perhaps someone could offer a suggestion, syntax or otherwise, on how to assign this variable with a cmd line switch. Thanks! Edited February 11, 2007 by thuun Link to comment Share on other sites More sharing options...
The Kandie Man Posted February 11, 2007 Share Posted February 11, 2007 I'm revising a little autoit script which sets a value in the registry. The value is the cache amount for a virtual file system, the number represents MB of RAM. I cannot seem to add a $Cmdline value which I'd like to use as an input option. example, this works... $memory = MemGetStats() $fbwfcache = ($memory[1] / 5 / 1024) RegWrite("HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\FBWF", "WinPECacheThreshold", "REG_DWORD", $fbwfcache) Exit This doesn't...(??) Dim $p If $CmdLine[0] = 0 Then Exit $CmdLine[1] = $p $memory = MemGetStats() $fbwfcache = Round($memory[1] / $p / 1024) RegWrite("HKLM\SYSTEM\ControlSet001\Services\FBWF", "WinPECacheThreshold", "REG_DWORD", $fbwfcache) Exit when I put $cmdline in place of $p it produces a incorrect but noticable result. this is the issue... --> $fbwfcache = ($memory[1] / $p / 1024) When a real number is used it works. Perhaps someone could offer a suggestion, syntax or otherwise, on how to assign this variable with a cmd line switch. Thanks!Just looking at that, $p should be equal to nothing because you didn't set it equal to anything, you did however set $CmdLine[1] equal to $p, which isn't equal to anything. You have to do it the other way around in the equal statement: Dim $p If $CmdLine[0] = 0 Then Exit $p = Number($CmdLine[1]);you had this backwards $memory = MemGetStats() $fbwfcache = Round($memory[1] / $p / 1024) RegWrite("HKLM\SYSTEM\ControlSet001\Services\FBWF", "WinPECacheThreshold", "REG_DWORD", $fbwfcache) Exit Try that. I also added the number function to convert the string to a numerical value. "So man has sown the wind and reaped the world. Perhaps in the next few hours there will no remembrance of the past and no hope for the future that might have been." & _"All the works of man will be consumed in the great fire after which he was created." & _"And if there is a future for man, insensitive as he is, proud and defiant in his pursuit of power, let him resolve to live it lovingly, for he knows well how to do so." & _"Then he may say once more, 'Truly the light is sweet, and what a pleasant thing it is for the eyes to see the sun.'" - The Day the Earth Caught Fire Link to comment Share on other sites More sharing options...
thuun Posted February 11, 2007 Author Share Posted February 11, 2007 (edited) Yes you are correct! thx!However, this is where this gets more interesting...Once corrected and compiled, It outputs much too large a result.((from before)...when I put $cmdline in place of $p it produces a incorrect but noticable result.)Given just:$fbwfcache = ($memory[1] / $Cmdline[1] / 1024)(adding Number func., no change)On a 1GB System, if $Cmdline is 10, result should be about 100MB. It is not. Instead it produces 4294762599 (MB.) as a result.If you persue a logical course, adding decimals to (the switch) reduce result, logic is not what you'll discover. It just goes haywire. \If $CmdLine[0] = 0 Then Exit $memory = MemGetStats() $fbwfcache = Round($memory[1] / Number($CmdLine[1]) / 1024) RegWrite("HKLM\SYSTEM\ControlSet001\Services\FBWF", "WinPECacheThreshold", "REG_DWORD", $fbwfcache) Exitalso malfunctionsI can't find an exmpl. to study,any thoughts are appreciated! Edited February 11, 2007 by thuun Link to comment Share on other sites More sharing options...
thuun Posted February 12, 2007 Author Share Posted February 12, 2007 too bad noone has a clue... Link to comment Share on other sites More sharing options...
The Kandie Man Posted February 12, 2007 Share Posted February 12, 2007 (edited) This works fine for me. What is the problem? I personally don't understand what the exact problem is that you are having. If $CmdLine[0] = 0 Then Exit $memory = MemGetStats() $fbwfcache = Round($memory[1] / Number($CmdLine[1]) / 1024) Msgbox(0,"Result:",$fbwfcache) Try this script above, tell me how much RAM you have, and tell me what the message box tells you. Edited February 12, 2007 by The Kandie Man "So man has sown the wind and reaped the world. Perhaps in the next few hours there will no remembrance of the past and no hope for the future that might have been." & _"All the works of man will be consumed in the great fire after which he was created." & _"And if there is a future for man, insensitive as he is, proud and defiant in his pursuit of power, let him resolve to live it lovingly, for he knows well how to do so." & _"Then he may say once more, 'Truly the light is sweet, and what a pleasant thing it is for the eyes to see the sun.'" - The Day the Earth Caught Fire Link to comment Share on other sites More sharing options...
thuun Posted February 13, 2007 Author Share Posted February 13, 2007 (edited) I believe using a dash in front of the number in the cmdline switch was causing the problem. Prompting the output made this clear, good idea. Hopefully that's that. Thx. Kandy Man! Edited February 13, 2007 by thuun 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