Sign in to follow this  
Followers 0
xuzo

How to run application in hidden or silent mode?

9 posts in this topic

#1 ·  Posted (edited)

I want to make a script to change IE options and firefox ect...

Instead of having the client's browser open up, can I make the script run things "hidden"?

For Example let's say the script changes the Homepage, there will be a series of Sends, not sure if clear or not. Can provide and example later on.

Something like this but without opening IE

#include
Local $oIE_basic = _IE_Example("basic")
Sleep("500")
Send("{ALTDOWN}t{ALTUP}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{ENTER}")
Edited by xuzo

Share this post


Link to post
Share on other sites



If you're changing the home page for the current user, you shouldn't be doing it with a lot of Send commands, you should go to the registry setting for that parameter and change it there. It's a lot more reliable, and it's also less chancy that things will change in the number of Tabs and Enters etc. you'll need to keep track of.

The home page setting is located in:

HKCU\Software\Microsoft\Internet Explorer\Main

and the key to change is "Start Page", as long as IE isn't open at the time it will be changed the next time it's opened.


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites

Hi Brewman,

That sounds good but I need this task to work for IE, Firefox, Chrome and Safari, and some of them might be portable....

Share this post


Link to post
Share on other sites

Hi Brewman,

How can I do this, what function or command to use? Is there a way to open the registry in on step or do I need to use Send commands to run?

HKCUSoftwareMicrosoftInternet ExplorerMain

and the key to change is "Start Page", as long as IE isn't open at the time it will be changed the next time it's opened.

Thanks

Share this post


Link to post
Share on other sites

RegWrite is what you want. (Figure out where all the values that you wan't to changes and use RegWrite to make those changes.)

; Write a single REG_SZ value

RegWrite("HKEY_CURRENT_USERSoftwareTest", "TestKey", "REG_SZ", "Hello this is a test")

; Write the REG_MULTI_SZ value of "line1" and "line2"

RegWrite("HKEY_CURRENT_USERSoftwareTest", "TestKey1", "REG_MULTI_SZ", "line1" & @LF & "line2")

; Write the REG_MULTI_SZ value of "line1"

RegWrite("HKEY_CURRENT_USERSoftwareTest", "TestKey2", "REG_MULTI_SZ", "line1")

; always add and extra null string

RegWrite("HKEY_CURRENT_USERSoftwareTest", "TestKey3", "REG_MULTI_SZ", "line1" & @LF & "line2" & @LF)

RegWrite("HKEY_CURRENT_USERSoftwareTest", "TestKey4", "REG_MULTI_SZ", "line1" & @LF & @LF & "line2" & @LF)

; empty REG_MULTI_SZ

RegWrite("HKEY_CURRENT_USERSoftwareTest", "TestKey5", "REG_MULTI_SZ", "")

; create just the key

RegWrite("HKEY_CURRENT_USERSoftwareTest1")

Be aware that there can be Group Policies in place that will override your settings.

Paul

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

Hi Paul,

Thanks, now I understand!

So send command might be unreliable...

And registry might not work depending on permissions...

So what would be my solution to create a task that will work on multiple browsers?

Edited by xuzo

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

Chrome stores it's home page in the file

"C:Documents and Settings<username>Local SettingsApplication DataGoogleChromeUser DataDefaultPreferences "

No idea where Firefox stores its settings I don't use it myself.

Edited by BrewManNH

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0