View unanswered posts | View active topics

Reply to topic  [ 3 posts ] 
AHK Script to start FlashDevelop on my second monitor 
Author Message

Joined: Fri Jul 23, 2010 10:26 am
Posts: 146
Reply with quote
My secondary monitor (on the wall) is above my first one (laptop on the desk), and that's where I run my FlashDevelop.
In the Windows display setup, it's convenient for me to position the secondary monitor above and to the left of the primary one as well (so the mouse going up-left at the top-left corner of the laptop monitor goes into the wall-mounted screen).
FlashDevelop doesn't want to remember which monitor I've used it on, or maybe it just has a problem remembering negative coordinates, since the top-left corner of my secondary screen with these settings is at coordinates -1920, -1080. My current workaround is this AutoHotKey script, I use it to run FlashDevelop, and also hide/activate FlashDevelop (using Win+F hotkey):
EnvGet, ProgramFiles32, ProgramFiles(x86)
EnvGet, ProgramFiles64, ProgramFiles
if (!ProgramFiles32)
   ProgramFiles32 := ProgramFiles64

; ************************************************************************************************************************************************************
; Run/show/hide FlashDevelop
   State := RunOrShowHideApp(ProgramFiles32 . "\FlashDevelop\FlashDevelop.exe")
   if (State == 3) {
      WinWait, ahk_exe FlashDevelop.exe
      if WinExist("ahk_exe FlashDevelop.exe") {
         WinMove -1920, -1080

; ************************************************************************************************************************************************************
;   Returns 1 if a window is visible, 0 otherwise
IsWindowVisible(WindowTitle) {
   WinGet, Style, Style, % WindowTitle
   Transform, IsVisible, BitAnd, %Style%, 0x10000000
   return IsVisible

; ************************************************************************************************************************************************************
;   If an app is running, toggle it's window's minimized/active state, otherwise run the app
; Returns:
;      0 on no action
;      1 on show window
;      2 on hide window
;      3 on run app
RunOrShowHideApp(Program, DetectHidden = "off", WindowTitle = "") {
   Result := 0
   SplitPath Program, ExeFile
   Process, Exist, %ExeFile%
   PID := ErrorLevel
   if (PID == 0) {
      Run, %Program%, %WorkingDir%, %WindowSize%
      Result := 3
   else {
      DetectHiddenWindows, %DetectHidden%
      if (WindowTitle == "")
         WindowTitle := "ahk_pid " . PID
      if WinActive(WindowTitle) {
         Result := 2
      else if WinExist(WindowTitle) {
         if (!IsWindowVisible(WindowTitle))
         Result := 1
   DetectHiddenWindows, Off
   return Result

Last edited by heilong on Thu Sep 03, 2015 2:04 pm, edited 1 time in total.

Wed Aug 26, 2015 6:38 pm

Joined: Tue Aug 30, 2005 6:14 pm
Posts: 3055
Location: Finland
Reply with quote
Thanks for sharing. There are cases where negative values are truly incorrect and we forcefully restore them so the FD doesn't open in incorrect negative positions.

Thu Sep 03, 2015 12:56 pm
Profile WWW

Joined: Fri Jul 23, 2010 10:26 am
Posts: 146
Reply with quote
Mika, this was my theory on why it's like that. It would be nice if FD could be smarter about auto-remembering position/display in this case, or at least if there was an option to explicitly disable the current sanity checks (to force the negative coordinates).

Thu Sep 03, 2015 2:03 pm
Display posts from previous:  Sort by  
Reply to topic   [ 3 posts ] 

Who is online

Users browsing this forum: No registered users and 1 guest

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.