Jump to content

radix

Member
  • Posts

    755
  • Joined

  • Last visited

  • Donations

    0.00 USD 
  • Country

    Romania

Posts posted by radix

  1. AutoIt approach:

    #Include <Array.au3>
    #Include <File.au3>

    ; Check if Mozilla Firefox x86 version is installed
    If @OSArch = "X86" Then
    $MozillaFirefoxCurrentVersion = RegRead("HKLM\SOFTWARE\Mozilla\Mozilla Firefox", "CurrentVersion")
    $MozillaFirefoxInstallDirectory = RegRead("HKLM\SOFTWARE\Mozilla\Mozilla Firefox\" & $MozillaFirefoxCurrentVersion & "\Main", "Install Directory")
    EndIf
    If @OSArch = "X64" Then
    $MozillaFirefoxCurrentVersion = RegRead("HKLM\SOFTWARE\Wow6432Node\Mozilla\Mozilla Firefox", "CurrentVersion")
    $MozillaFirefoxInstallDirectory = RegRead("HKLM\SOFTWARE\Wow6432Node\Mozilla\Mozilla Firefox\" & $MozillaFirefoxCurrentVersion & "\Main", "Install Directory")
    EndIf
    $MozillaFirefoxExecutableFile = FileExists($MozillaFirefoxInstallDirectory & "\firefox.exe")
    If $MozillaFirefoxExecutableFile = 0 Then
    MsgBox(0x40010, @ScriptName, "Mozilla Firefox is not installed! Please install it and then run this script!", 4)
    Exit
    EndIf

    ; Find Mozilla Firefox profile folder
    If FileExists(@AppDataDir & "\Mozilla\Firefox\profiles.ini") Then
    $Mozilla_Firefox_profile_folder = IniRead(@AppDataDir & "\Mozilla\Firefox\profiles.ini", "Profile0", "Path", "")
    $Mozilla_Firefox_profile_folder = StringReplace($Mozilla_Firefox_profile_folder, "/", "\")
    EndIf

    ; EDIT MOZILLA FIREFOX PREFERENCES FILE
    $InputFile = @AppDataDir & "\Mozilla\Firefox\" & $Mozilla_Firefox_profile_folder & "\prefs.js"
    ; String to find
    $StringToFind = '"browser.startup.homepage"'
    ; New home page address
    $HomePageAddress = "" ; write the desired home page address (inside quotes), for example: http://www.google.com/
    ; Delete the current home page address
    Global $Array
    _FileReadToArray ($InputFile, $Array)
    $Array = _DeleteHomePageAddress ($Array, $StringToFind)
    _FileWriteFromArray ($InputFile, $Array, 1)
    ; Write a new home page address
    $File = FileOpen($InputFile, 257) ; UTF8 encoding without BOM
    FileWriteLine($File, 'user_pref("browser.startup.homepage", ' & '"' & $HomePageAddress & '"' & ');')
    FileClose($File)

    Func _DeleteHomePageAddress ($Array, $StringToFind)
    Local $Item
    For $Element In $Array
    If StringInstr ($Element, $StringToFind) <> 0 Then
    _ArrayDelete ($Array, $Item)
    Else
    $Item+=1
    EndIf
    Next
    Return ($Array)
    EndFunc

  2. Instead of moving the script or the reg files around to get everything in @ScriptDir

    You are better of to use FileChangDir()

    #Include <File.au3> 
    #Include <Array.au3>
    $sPath = "c:\somepath\containing\regfiles"
    FileChangeDir($sPath)
    $RegList = _FileListToArray($sPath, "*.reg", 1)
    If IsArray($RegList) Then
    For $i = 1 to $RegList[0]
    RunWait('regedit.exe' & ' /s' & ' "' & $RegList[$i] & '"')
    Next
    EndIf

    Also I can't remember if it's okay to put the "/s" switch after the file name or not (for RegEdit) but if it is then instead of RunWait() use ShellExecuteWait()

    ShellExecuteWait($RegList[$i], "/s")

    I've thought about using the script during windows installation (in this case another instance will run the compiled file and it's easy to copy and run from the reg files folder).

    Regarding the switch: it's tested and working.

  3. It works. Thanks. I found a vbs script which can move all files (more than one level recursive) from a folder to another folder (can be the same folder too).

    Dim objFSO, ofolder, objStream
    Set objShell = CreateObject("WScript.Shell")
    Set objFSO = CreateObject("scripting.filesystemobject")
    Set objNet = CreateObject("WScript.NetWork")
    Set FSO = CreateObject("Scripting.FileSystemObject")
    '=====Source folder=====
    SPath = "C:\Source\"
    ShowSubfolders FSO.GetFolder(spath)
    Sub ShowSubFolders(Folder)
    For Each Subfolder in Folder.SubFolders
    CheckFolder(subfolder)
    ShowSubFolders Subfolder
    Next
    End Sub
    Sub CheckFolder(objCurrentFolder)
    Dim strTempL, strTempR, strSearchL, strSearchR, objNewFolder, objFile
    Const OverwriteExisting = TRUE
    For Each objFile In objCurrentFolder.Files
    FileName = objFile
    '=====Destination folder=====
    objFSO.MoveFile FileName, "C:\Destination\"
    Next
    End Sub

  4. I have a cmd script who can move all files from subdirs of current dir into current dir. This script work only if subdirs don't have spaces in their names.

    @echo off
    for /f "tokens=5* skip=2" %%i in ('dir ^| findstr "DIR"
    ') do (
    move %%i\*.* .
    )

    Can you help with a vbs script if cmd can't do this task ? I can do this easy with AutoIt recursively in subfolders. It's for someone who don't want suspicious exe files :D

  5. In the manual file (BWMeter.chm) in Installation & Uninstallation section is stated that:

    Unattended setup: if you want to install BWMeter automatically, without user  interface, please include the installation path as a command line parameter.  Also, any file included in the command line will be copied to the installation  path by the setup program. Here is an example:

    BMSetup.exe "C:\Program Files\BWMeter" License.dlc

    This command line will install BWMeter to the default installation path and copy the license file "License.dlc" to the installation path. "License.dlc" must be in the same folder as "BMSetup.exe" so that the setup program can find it.

    After unattended setup, a text file "BMSetup.log" will be created. It contains the result of the installation.


    Sorry for bumping a 5 year old thread.

  6. Universal Extractor 1.6 incorrectly identifies self extracting disk image files (.imz) as 7z archives adding the following to check7z() corrects the issue and allows these files to be expanded.

    Thanks for the report and code. However, I don't have any .imz files to test and validate this. Can you (or anyone else) please provide a couple examples?

    U.E. 1.6.1 can extract files from .imz and .ima image files, but can't extract files from winimage sfx archives (upx compressed).

    I've uploaded an example:

    http://www.filefacto...b/n/wwwwwww.exe

    or

    http://hotfile.com/d...wwwwww.exe.html

  7. And another one: support for extracting zip sfx archive (only WinZip can extract this type).

    I can use WinZip because it can't be freely redistributed. If you can provide some example files, though, I'll look for an alternative way to support the files.

    WinZIP sfx example: http://download.winz...om/wzipse40.exe

    Tried already with winrar, 7-zip and Universal Extractor 1.6.1.

    Thanks for the update.:thumbup

    Edit: 7-Zip 9.13 beta works with winzip sfx archives.

  8. If you insist to unpack those cab files, install InstallShield, and use InstallShield Cabinet File Viewer (open from start menu).

    Extract a file from a cabinet file

    Extract a file from a cabinet fileThe Extract File from Media option allows you to decompress a file contained in your cabinet. To extract a file:

    1. From the View menu, select Components, or click the Display Components button on the toolbar.
    2. Double-click the File Groups icon.
    3. Double-click the folder that contains the file you want to extract.
    4. In the right pane, select the name of the file you wish to extract.
    5. From the Tools menu, select Extract File, or click the Extract File from Media button on the toolbar,or double-click the selected file name.
    6. A Save dialog box appears. Browse to the folder in which you wish to save the file.
    7. Click Save. Components may be password protected. Follow the previous link for more information

×
×
  • Create New...