ct253704 Posted December 17, 2015 Share Posted December 17, 2015 I'm having some issues converting a batch file to be used in a script of mine. The batch file was pulled from Stack Overflow with small modifications and works by itself, but when I convert to AutoIT it gets about halfway through and then gives the error "Cannot find the path specified". All it does is set the firefox homepage, though i'd like to expand the settings altered in the prefs.js file if I can get this to work.Batch File:cd /D "%APPDATA%\Mozilla\Firefox\Profiles"cd *.default*set ffile=%cd%cd %ffile%echo user_pref("browser.startup.homepage", "https://www.google.com");>>"%ffile%\prefs.js"set ffile=cd %windir%AutoIT CodeRunWait(@ComSpec & ' /k ' & 'cd /D "%APPDATA%\Mozilla\Firefox\Profiles"&&cd *.default*&&set ffile=%cd%&&cd %ffile%&&echo user_pref("browser.startup.homepage", "https://www.google.com");>>"%ffile%\prefs.js"&&set ffile=&&cd %windir%')Also to note the batch file doesn't work if each line is ran individually via command prompt. Maybe I should change one of the && in the code? Link to comment Share on other sites More sharing options...
Danyfirex Posted December 17, 2015 Share Posted December 17, 2015 (edited) I made this. Local $sprefsPath=_FireFoxprefsPath() Local $sString='user_pref("browser.startup.homepage", "https://www.google.com");' FileWriteLine($sprefsPath, @Crlf & $sString) Func _FireFoxprefsPath() Local $sPath = @AppDataDir & "\Mozilla\Firefox\" Return ($sPath & IniRead($sPath & "profiles.ini", "Profile0", "Path", "") & "\" & "prefs.js") EndFuncSaludos Edited December 17, 2015 by Danyfirex ct253704 1 Danysys.com AutoIt... UDFs: VirusTotal API 2.0 UDF - libZPlay UDF - Apps: Guitar Tab Tester - VirusTotal Hash Checker Examples: Text-to-Speech ISpVoice Interface - Get installed applications - Enable/Disable Network connection PrintHookProc - WINTRUST - Mute Microphone Level - Get Connected NetWorks - Create NetWork Connection ShortCut Link to comment Share on other sites More sharing options...
ct253704 Posted December 17, 2015 Author Share Posted December 17, 2015 Bonus! That's a clever way to return the filepath. I'll test that out. May I ask what the @CRLF will do in this case, exactly? I've never used that macro. Does it just ensure that the "user pref" portion is put in a line of its own? Link to comment Share on other sites More sharing options...
Danyfirex Posted December 17, 2015 Share Posted December 17, 2015 just for wirting in next line. look help file or do a google search.Saludos Danysys.com AutoIt... UDFs: VirusTotal API 2.0 UDF - libZPlay UDF - Apps: Guitar Tab Tester - VirusTotal Hash Checker Examples: Text-to-Speech ISpVoice Interface - Get installed applications - Enable/Disable Network connection PrintHookProc - WINTRUST - Mute Microphone Level - Get Connected NetWorks - Create NetWork Connection ShortCut 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