Sign in to follow this  
Followers 0
Scubbo

PID and visibility issues with "Run" and Chrome

4 posts in this topic

#1 ·  Posted (edited)

Greetings all,

First-time poster here and very inexperienced AutoIt coder (I'm marginally more comfortable with Python), so please be nice!

I'm having some problems with the Run command. Specifically, according to the help files, I expected the following code:

Run "C:\Users\Jack Jackson\AppData\Local\Google\Chrome\Application\chrome.exe" "http://www.facebook.com", , Hide, VarPID
MsgBox %VarPID%

to open an invisible Chrome window at the http://www.facebook.com, and then to display the PID of this process in a Message Box. This failed on two counts:

  • Instead, a new tab was opened in my existing Chrome window. Running the script with no active Chrome window started a new (visible) Chrome window.
  • The PID reflected in the MsgBox did not correspond to any Chrome process running, according to both the Windows Task Manage and Chrome's own internal manager.
This appears to be a problem with Chrome itself, as

Run notepad, , Hide, VarPID
MsgBox %VarPID%

runs exactly as expected.

As well as looking in the help files about the Run command, I tried googling various combinations of the words "AutoIt Run hide pid error", but generally that returned either standard help files about the Run command, or references to the UseErrorLevel option. The only useful link I found was the following: http://www.autoitscript.com/forum/index.php?showtopic=87931 , which prompted me to try the following code:

Run "C:\Users\Jack Jackson\AppData\Local\Google\Chrome\Application\chrome.exe" "http://www.facebook.com", , Hide, VarPID
WinWait, Facebook - Google Chrome
WinHide
MsgBox %VarPID%

This is still unsatisfactory - not only does the window pop up before being hidden (which would interrupt the game - see explanation below), but the PID is still incorrect according to both task managers.

I'd really appreciate a way to make this work - thanks in advance for any suggestions.

<explanation>

For those who want to know why exactly I'm doing this - there's an application on Facebook called "Steam Achievements", which posts to your Facebook wall when you accomplish certain achievements on Steam games. As yet there's no automatic update facility - you need to click a button on the application's page to make it manually check for new achievements. I'm wanting to write a script which will run in the background (without interrupting a game) and periodically log into Facebook, navigate to the correct page, click the button, and exit Facebook. I had a brief look at the Facebook API to see if there was a way to do it directly (i.e. not via a browser), but it seemed more complicated than using AutoIt.

</explanation>

Jack

Edited by Scubbo

Share this post


Link to post
Share on other sites



http://www.google.com/support/forum/p/Chrome/thread?tid=1eb2eb870ba29e97&hl=en - somebody else has the same scenario

http://www.chromeplugins.org/google/chrome-troubleshooting/tab-opening-new-window-140.html - a firm nope!

http://src.chromium.org/svn/trunk/src/chrome/common/chrome_switches.cc - list of switches for Chrome

Looks like you may have to (gulp) try another browser...

Share this post


Link to post
Share on other sites

Thank you for those informative links - I'll take this as a sign that I should try to persevere with the (objectively better) "direct" method of achieving the desired end result without going via a browser. If that fails, I'll try using Firefox or IE to replace Chrome.

Thank you for your swift reply!

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