00pontiac Posted January 1, 2013 Share Posted January 1, 2013 (edited) Trying to create a script that will add a new tab to firefox if it's open. And if it's not open to simply run a new instance. This is what I have so far If ProcessExists("1448") Then WinActivate("[CLASS:MozillaWindowClass]") Send("^t") Exit Else Run("C:\Program Files (x86)\Mozilla Firefox\firefox.exe") EndIf It's creating my new tabs, in the first three lines. And it's running firefox in the last part. For some reason (I could just be tired) can't get them to work together. I feel like I should apologise for being a noob, I've done a lot of scripts with autoit (yep! working ones too) but it always takes me forever. been working on this one for longer than I'm willing to admit There's a lot more planned with this script, but I hope not to bother again. Thanks for at least taking a look here! Edited January 1, 2013 by 00pontiac Link to comment Share on other sites More sharing options...
GordonFreeman Posted January 1, 2013 Share Posted January 1, 2013 (edited) If ProcessExists("Firefox.exe") Then WinActivate("[CLASS:MozillaWindowClass]") Send("^t") Exit Else Run("C:\Program Files (x86)\Mozilla Firefox\firefox.exe") EndIf I do not know where you got 1448. Edited January 1, 2013 by GordonFreeman Frabjous Installation Link to comment Share on other sites More sharing options...
00pontiac Posted January 1, 2013 Author Share Posted January 1, 2013 (edited) from getting the process id took out of helpfile. that parts works lol Edit : Oh! now it all works! TYVM! missed your code at first. Definitely tired..... much apreciated Edited January 1, 2013 by 00pontiac Link to comment Share on other sites More sharing options...
GordonFreeman Posted January 1, 2013 Share Posted January 1, 2013 (edited) from getting the process id took out of helpfile. that parts works lolEdit : Oh! now it all works! TYVM! missed your code at first. Definitely tired.....much apreciatedAhh. okay. But the PID changes every time you close and open again. I've never used this function with PID Edited January 1, 2013 by GordonFreeman Frabjous Installation Link to comment Share on other sites More sharing options...
00pontiac Posted January 1, 2013 Author Share Posted January 1, 2013 you know I thought that the PID probly WOULD change, but it stayed the same all nite that I was working on this. why I started using it was largely due to inexperience. so thanks for clearing that up to Link to comment Share on other sites More sharing options...
GordonFreeman Posted January 1, 2013 Share Posted January 1, 2013 It may even be useful if you use pid of a function. And not something fixed how 1448. Example: $PID = WinGetProcess("AutoIt Help") $PID_2 = ProcessExists($PID) If $PID = $PID_2 Then MsgBox(0, "", "Process Exists") EndIf Any doubts. Do not hesitate to ask Frabjous Installation Link to comment Share on other sites More sharing options...
00pontiac Posted January 1, 2013 Author Share Posted January 1, 2013 (edited) I overlooked Firefox being Minimised, so I figure the last step in this part of my script would be to show the FireFox window in that case....-----------------------------------------------------------------Edit : Removed me being an idiot on a public forum!-----------------------------------------------------------------Was having a simple problem with naming my windows my working script :If ProcessExists("firefox.exe") Then WinActivate("[CLASS:MozillaWindowClass]") WinSetState("* - Mozilla Firefox", "", @SW_SHOW) Send("^t") Exit Else Run("C:\Program Files (x86)\Mozilla Firefox\firefox.exe") EndIf Edited January 1, 2013 by 00pontiac 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