Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 05/25/2012 in all areas

  1. Decipher

    Tweak Firefox

    Tweaks Firefox #include-once #AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w- 4 -w 5 -w 6 -w- 7 #include <File.au3> ; Only Needed if $TemporaryDirectory parameter is omitted. If File.au3 is included already in your main script then remove this line and specify the temporary directory parameter when calling the _Tweak_FF Function. #cs ---------------------------------------------------------------------------- AutoIt Version: 3.3.7.23 (beta) Author: Decipher Script Function: Tweak All Mozilla Firefox Profiles Prefs.js File for Network & Miscellanous Optimization. Functions: _Tweak_FF() Requires FFConfig.txt in script directory with correctly formatted configuration entries. Usage: _Tweak_FF($PromptTitle, $BackupLocation, $TemporaryDirectory, $PromptUser) $PromptTitle is Optional, Defaults to "" $BackupLocation is Optional, Defaults to Current User's Desktop Directory Name of Profile Directory, will create directory structure if it does not exist. $TemporaryDirectory is Optional, Defaults to temporary file. The file is guaranteed not to exist yet $PromptUser is Optional, Defaults to 1 = Yes Prompt User to Close Firefox, 0 = No Terminate Process Automatically Return 1 if no error occurred otherwise Returns 0 and sets @error and @extended macros. @extended: 1 = Error reading FFConfig.txt. 2 = User canceled prompt to close firefox. 3 = Error locating profile directories. 4 = Could not read profiles prefs.js file. 5 = Error opening temporary prefs.js file for writing. 6 = Error configuration entry in FFConfig.txt is incorrectly formatted. 7 = Error overwriting prefs.js file with the newly generated configuration file. 8 = Error a profile directory exists but does not contain a prefs.js file. 9 = Temporary files were not deleted. 10 = Some other error occured. Example: _Tweak_FF("Tweaking Firefox", @DesktopDir) Configuration Entries inside FFConfig.txt: user_pref("nglayout.initialpaint.delay", 0); user_pref("network.http.pipelining", true); user_pref("network.http.proxy.pipelining", true); user_pref("network.http.pipelining.maxrequests", 10); user_pref("network.dns.disableIPv6", false); user_pref("content.notify.backoffcount", 5); user_pref("plugin.expose_full_path", true); user_pref("ui.submenuDelay", 0); user_pref("config.trim_on_minimize", false); user_pref("browser.chrome.favicons", false); user_pref("browser.blink_allowed", false); user_pref("network.dns.disableIPv6", true); user_pref("network.dnsCacheEntries", 200); user_pref("network.dnsCacheExpiration", 240); user_pref("network.http.connect.timeout", 60); user_pref("network.http.keep-alive.timeout", 300); user_pref("network.http.max-connections-per-server", 16); user_pref("network.http.max-persistent-connections-per-proxy", 12); user_pref("layout.spellcheckDefault", 0); user_pref("browser.startup.homepage", "https://www.google.com/"); #ce ---------------------------------------------------------------------------- _Tweak_FF("Test", @DesktopDir & "BackupDirectory", "", 0) If @error Then MsgBox(0,"Test", @extended) Func _Tweak_FF($PromptTitle = "Tweaking Firefox", $BackupLocation = @DesktopDir, $TemporaryDirectory = "", $PromptUser = 1) If $TemporaryDirectory = "" Then $TemporaryDirectory = _TempFile() DirCreate($TemporaryDirectory) EndIf Local $FileWrite, $FileLine, $PrefsString, $FileContents, $ProfileDirectory, $PrefsFile, $ComparisonString, $Option, $StrPosition, $StrChars, $CharsDiff $FileContents = FileRead(@ScriptDir & "FFConfig.txt") If $FileContents = "" Then Return SetError(1, 1, 0) Local $FFTweak = StringSplit($FileContents, @CRLF, 3) $FileContents = "" If $PromptUser = 1 Then $Option = MsgBox(1 + 48 + 262144, $PromptTitle, "Firefox must be closed to apply tweaks correctly. You can close it manually or forcibly close Firefox's process by selecting continue. Firefox will be terminated automatically in 30 seconds.", 30) If $Option = 2 Then Return SetError(1, 2, 0) EndIf FileChangeDir(@AppDataDir & "MozillaFirefoxProfiles") Local $Profiles = FileFindFirstFile("*.*") If $Profiles = -1 Then Return SetError(1, 3, 0) While 1 $ProfileDirectory = FileFindNextFile($Profiles) If @error Then ExitLoop If $ProfileDirectory <> "" And FileExists(@AppDataDir & "MozillaFirefoxProfiles" & $ProfileDirectory & "prefs.js") Then Local $User_Prefs_File_Location = @AppDataDir & "MozillaFirefoxProfiles" & $ProfileDirectory & "prefs.js" If FileCopy($User_Prefs_File_Location, $BackupLocation & "" & $ProfileDirectory & "prefs.js", 9) Then $FileContents = FileRead($User_Prefs_File_Location) If $FileContents = "" Then Return SetError(1, 4, 0) $PrefsFile = FileOpen($TemporaryDirectory & "prefs.js", 10) If $PrefsFile = -1 Then Return SetError(1, 5, 0) $FileLine = StringSplit($FileContents, ";") For $i = 1 To $FileLine[0] $FileWrite = True For $index2 = 0 To UBound($FFTweak, 1) - 1 Step 1 $StrPosition = StringInStr($FFTweak[$index2], ",", 2, -1) If $StrPosition = 0 And StringIsSpace($FFTweak[$index2]) <> 0 Then Return SetError(1, 6, 0) $StrChars = StringLen($FFTweak[$index2]) $CharsDiff = $StrChars - $StrPosition $ComparisonString = StringTrimRight($FFTweak[$index2], $CharsDiff) If StringInStr($FileLine[$i], $ComparisonString, 2) Then $FileWrite = False ElseIf StringIsSpace($FileLine[$i]) Then $FileWrite = False EndIf Next $PrefsString = StringStripWS($FileLine[$i], 2) If $FileWrite = True Then FileWrite($PrefsFile, $PrefsString & ";") Next FileWrite($PrefsFile, @CRLF) For $i = 0 To UBound($FFTweak, 1) - 1 Step 1 If StringIsSpace($FileLine[$i]) = 0 Then FileWrite($PrefsFile, $FFTweak[$i] & @CRLF) Next FileClose($PrefsFile) While ProcessExists("firefox.exe") Or ProcessExists("plugin-container.exe") If ProcessClose("firefox.exe") <> 1 Then ProcessClose("plugin-container.exe") Sleep(50) WEnd If FileCopy($TemporaryDirectory & "prefs.js", $User_Prefs_File_Location, 9) <> 1 Then If DirRemove($TemporaryDirectory, 1) <> 1 Then Return SetError(1, 9, 0) Return SetError(1, 7, 1) EndIf Else If DirRemove($TemporaryDirectory, 1) <> 1 Then Return SetError(1, 9, 0) Return SetError(1, 8, 0) EndIf EndIf WEnd If DirRemove($TemporaryDirectory, 1) <> 1 Then Return SetError(1, 9, 0) If @error Then Return SetError(1, 10, 0) Return 1 EndFunc ;==>_Tweak_FFFFConfig.txt _Tweak_FF.au3
    1 point
  2. JScript

    Tweak Firefox

    Very nice, thanks 4 sharing!!! Regards, João Carlos.
    1 point
  3. The first one probably isn't working because you have quotes around your variable names, and you're not using them correctly regardless. You need to use GUICtrlRead to get the contents of the controls, not the variable assigned to it. The second one doesn't work because you are putting in the "[" and "]" around the parameters, those are only there in the help file to tell you that they're optional, you CAN NOT put them into the function. EDIT: Just noticed you're trying to open the event log using the _EventLog_Open command, and you're referencing a button control in the function call, not exactly sure you have read the help file. Suggestion: Read the help file for every command you're going to use, you need to know how they work before you can use them.
    1 point
  4. JohnOne

    Coding NOOB, need help

    Turn it into just this #include <ButtonConstants.au3>
    1 point
  5. Have used AutoIt for many, many year now. If in doubt I always ask a very good friend: The help file
    1 point
  6. How about$aResult = StringSplit($sString, "/")In $aResult[2] you will find the version number.
    1 point
  7. JohnOne

    Coding NOOB, need help

    WEnd$msg = $GUI_EVENT_CLOSE#include <ButtonConstants.au3> That looks like your problem at a glance
    1 point
  8. ZOMG FREE PASSWORDS! All your bases are belong to GUESTS
    1 point
  9. You either need a Sleep in there before the While loop, to give the BGInfo window time to open or use a WinWait with a timeout, before it to make sure the window is there when the script runs, if you run it right after running the program, the window may not exist yet, so the script ends.
    1 point
  10. Here's an example, of how to display the outputs of a DOS command to an edit box: #include <Constants.au3> #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #Include <GUIEdit.au3> #Include <ScrollBarConstants.au3> $Form1 = GUICreate("Form1", 625, 445, 192, 124) $Edit1 = GUICtrlCreateEdit("", 30, 30, 361, 341, BitOR($ES_AUTOVSCROLL,$ES_WANTRETURN,$WS_HSCROLL,$WS_VSCROLL,$ES_READONLY)) $Button1 = GUICtrlCreateButton("Start", 410, 70, 75, 25, $WS_GROUP) $Input1 = GUICtrlCreateInput("C:Windows", 410, 30, 121, 21) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 GUICtrlSetState($Button1, $GUI_DISABLE) GUICtrlSetState($Input1, $GUI_DISABLE) GUICtrlSetData($Edit1, "") $foo = Run(@ComSpec & " /c dir " & GUICtrlRead($Input1), @SystemDir, @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD) While 1 $line = StdoutRead($foo) If @error Then ExitLoop GUICtrlSetData($Edit1, GUICtrlRead($Edit1) & $line) Wend $iEnd = StringLen(GUICtrlRead($Edit1)) _GUICtrlEdit_SetSel($Edit1, $iEnd, $iEnd) _GUICtrlEdit_Scroll($Edit1, $SB_SCROLLCARET) GUICtrlSetState($Button1, $GUI_ENABLE) GUICtrlSetState($Input1, $GUI_ENABLE) EndSwitch WEnd
    1 point
  11. I'll try to explain the best I can in this script $Title = "BGInfo" While WinExists($Title) If WinExists($Title) Then WinActivate($Title) Send("{ESC}") Sleep(100) Else Exitloop EndIf WEndif the popup is not there yet when autoit runs, it will hit the else condition (because the win does not exist) and exit. So when it does pop up, autoit is already done and can't close it. for the 2nd part (it doesn't work if another window is on top of it) you may try control sending the esc to the window instead of just send, or you could use WinSetOnTop before the activate and send.
    1 point
  12. What exactly are you attempting to do with BGInfo that isn't working the way you want it to? I understand there's a popup window you're getting when you run it, which by the way doesn't happen for me if I use bginfo /taskbar. But what exactly is it doing that you don't want it to do?
    1 point
  13. The 'else' will never be true - right? You can also substitute the ExitLoop with an Exit statement.
    1 point
  14. $Title = "BGInfo" While WinExists($Title) If WinExists($Title) Then WinActivate($Title) Send("{ESC}") Sleep(100) Exitloop EndIf WEnd or alternatively: bginfo /nolicprompt
    1 point
×
×
  • Create New...