@
Angelscry is it possible to stack normal executable launchers in the same way that we can stack files launchers? ie: Program {Version 1}.exe and Program {Version 2}.exe so that when adding the launcher a menu would pop up allowing us to choose which version of the program we want to launch?
The reason I'm asking is because I'm trying to write scripts with autoit that launch the windows 8 netflix app with different DNS settings depending on which version of the script is executed. So far everything works fine if I make an explorer.exe files launcher which launches the script, but only if I also have the DNS addresses and the absolute path of the Netflix.lnk (created with Oblitile) defined in the script itself. However, the problem I'm having is that I would like to write the script in such a way that the DNS addresses are define outside of the program itself with a config.ini file. This is so that I don't have to modify and re-compile the scripts every time I need to update the DNS addresses. The problem is though that when using a explorer.exe files launcher the working directory becomes the C:\System32\ making it impossible to read the config.ini parameters. Everything works fine if I run the script manually without using an explorer.exe files launcher, but then Advanced Launcher doesn't stack the executables, sort of defeating the purpose haha. A possible workaround of course would be to add a user definable path to Netflix.lnk inside config.ini and then placing this file inside the working folder that explorer.exe changes to, however if possible I would like to avoid having to place files inside system folders in order to make the scripts portable. Also, I've found that the explorer working folder is different from machine to machine...(System32 on my media center and SysWOW64 on my laptop). However, if there was a way that we could stack executable launchers in the same way as file launchers none of this would be a problem as the working folder would be the same as the location of the scripts haha. This is my code if my explanation wasn't very clear:
Code:
#RequireAdmin
#include <Process.au3>
HotKeySet("{ESC}", "KillTask")
Opt("WinTitleMatchMode", 2)
$networkAdapter = IniRead("config.ini", "NetworkAdapter", "Active", "0")
$primaryLocalDNS = IniRead("config.ini", "LocalDNS", "Primary", "0")
$secondaryLocalDNS = IniRead("config.ini", "LocalDNS", "Secondary", "0")
$primaryForeignDNS = IniRead("config.ini", "ForeignDNS", "Primary", "0")
$secondaryForeignDNS = IniRead("config.ini", "ForeignDNS", "Secondary", "0")
RunWait(@ComSpec & " /c netsh interface ip set dns " & $networkAdapter & " static " & $primaryForeignDNS & "", "", @SW_HIDE)
RunWait(@ComSpec & " /c netsh interface ip add dns " & $networkAdapter & " addr= " & $secondaryForeignDNS & " index=2", "", @SW_HIDE)
;RunWait(@ComSpec & " /c ipconfig /flushdns", "", @SW_HIDE)
ShellExecute("Netflix.lnk")
While 1
Sleep(100)
WEnd
Func KillTask()
Send ( "!{F4}")
RunWait(@ComSpec & " /c netsh interface ip set dns " & $networkAdapter & " static " & $primaryLocalDNS & "", "", @SW_HIDE)
RunWait(@ComSpec & " /c netsh interface ip add dns " & $networkAdapter & " addr= " & $secondaryLocalDNS & " index=2", "", @SW_HIDE)
;RunWait(@ComSpec & " /c ipconfig /flushdns", "", @SW_HIDE)
WinActivate("XBMC")
Exit 0
EndFunc
With a config.ini file containing the following:
Code:
[NetworkAdapter]
Active="Ethernet"
[LocalDNS]
Primary="8.8.8.8"
Secondary="8.8.4.4"
[ForeignDNS]
Primary="109.74.12.20"
Secondary="213.5.182.117"
Thanks, hope you can help!
EDIT: also, if it wasn't obvious there is a second script that just launches Netflix normally without changing the DNS addresses. So I have Netflix {Canadian}.exe as well as Netflix {American}.exe. The code I posted above is for Netflix {American}.exe which ideally would stack with the canadian one. And both scripts read from config.ini