Jump to content
LaunchBox Community Forums

Recommended Posts

Posted (edited)

thanks joe1  i went with the second as the mouse does need to be clicked.  i got the coordinates but that bit with the mouse doesnt seem to do anything?

any helps is always appreciated!

Edited by d8thstar
Posted
9 hours ago, d8thstar said:

thanks joe1  i went with the second as the mouse does need to be clicked.  i got the coordinates but that bit with the mouse doesnt seem to do anything?

any helps is always appreciated!

Assuming you copied and pasted the script (vs retyping), only changed the necessary items and no errors were given...

  • it may be that the 2 second delay is too short. (i.e. not enough time for the window to fully load)
  • It may be that the coordinates are incorrect.  e.g. the coordinates are in the window vs for the whole monitor.
  • It may be that there's a command line parameter you can add to bypass that window and not have to click it at all.

You can verify the coordinates by checking the box in your Windows' Mouse Properties - Pointer Options, "Show location of mouse pointer when I press the CTRL key". Then change {LButtun} to {Ctrl}.  When you run the script this way, if all goes well, you'll see the "target rings" appear over the "Click to Start" button when you get to that part of the script.

Even if the window doesn't have focus, if it's showing and the mouse clicks in the correct location, it'll click that button.  

Posted

hi joe.

uuhhh, my mouse pointer doesnt move at all.  i start the exe which is on the left hand side of the screen.  the apps start, the mouse pointer stays where it is.

i press CTRL, it shows the circles around the mouse pointer, which hasn't moved.  and yes, i did copy / paste the script :)

if you have any thoughts...  i'll do a google, see if i can figure it out.

as always, thank you!

Posted
13 hours ago, d8thstar said:

if you have any thoughts... 

It sounds like you're compiling your ahk script to an exe file. Which should be fine.  Are you using AHK v1.1?  Or v2.0?  For using scripts with LaunchBox, I suggest V1.1.  (Ignore that it says depreciated.)

 

I don't have any more thoughts on this as in my tests here, it works. But I do have a suggestion for testing and working with scripts:

Download CodeQuickTester, place the file in a location where you won't forget where it is and use it for testing.  If you have AutoHotkey (v1.1) installed on your system (recommended), you can download the CodeQuickTester_v2.8.ahk file.  Otherwise, download CodeQuickTester_v2.8.exe.  Neither will work with AHK v2.0.

Run the app, click Edit and select Script Options.  Click Pick AHK Path and go to and select your Autohotkey.exe file. Close the window.  If you don't have AHK installed, you can point it to your /LaunchBox/ThirdParty/AutoHotkey/AutoHotkey.exe file. Close (red x) that window.

 

In the script body, type in 

DllCall("SetCursorPos", int, 960, int, 540)
Send, {Ctrl}

Then click Run.  This should move the mouse and show the circles.

image.png.dfafca993a457d674dd46fe7ba2a9b2a.png

Once satisfied that it is working, add above those 2 lines your Run....PrismXR.exe and Sleep lines and click Run.  See if the app starts and the mouse moves and shows circles (be sure to wait the full 2 seconds to see the circles).

Continue adding the rest of your script and testing until you satisfied with the results.  Don't forget to eventually change {Ctrl} to {LButton}.

Posted

thanks joe, this is driving me nuts...  taken from your coaching, this code in the tester WORKS, i see the circles pointing out where the mouse is.  when i change {Ctrl} to {LButton}, the mouse moves to the coordinates but it does not click.  second bit below, is the copy / paste of the LButton code so you can see i'm not crazy :)  and the bit at the very end, is cut and pasted from the full script.  tit opens both apps, doesn't move the mouse or hit CTRL.

 

anyway, you've spent way too much time on this, thanks for your time.

DllCall("SetCursorPos", int, 1367, int, 820)
Send, {Ctrl}

 

DllCall("SetCursorPos", int, 1367, int, 820)
Send, {LButton}

 

; Start Virtual Desktop Streamer
Run, "C:\Program Files\Virtual Desktop Streamer\VirtualDesktop.Streamer.exe"

; Start PrismXR application
Run, "C:\Users\tonys\Desktop\VR\PrismXR_Desktop_App\PrismXR\PrismXR.exe"
Sleep, 5000

; move mouse pointer to center of monitor (1920x1080)
DllCall("SetCursorPos", int, 1367, int, 820)
Send, {Ctrl}

Posted
5 minutes ago, d8thstar said:

it opens both apps, doesn't move the mouse or hit CTRL

If after the full 5 seconds has lapsed, and no circles appear, does anything happen if you [manually] hit Ctrl on your keyboard?  If so, is it (the circles) in the correct location (above the button)?

Posted

circles do appear but they are right over the exe that i clicked to launch, cursor isnt moving when in the full script (but it does when doing the test of just the two lines.

Posted
16 hours ago, d8thstar said:

circles do appear but they are right over the exe that i clicked to launch, cursor isnt moving when in the full script (but it does when doing the test of just the two lines.

Not sure what's going on then.  You might start (continue?) researching that app (Google, their forums/wiki, etc.) to see if there's a way to auto-start it without having to "click the button".  Something like a command line parameter.  

Or if there's an option to load it when Windows starts, test that to see if it loads without having to click anything.  If so, look at the shortcut they created in your Startup folder to see how they did it, and duplicate that. (then remove the shortcut)

And if nothing else, you've learned a couple new AHK script testing/troubleshooting techniques. :D

  • 1 month later...
Posted (edited)

It's a shame this thread doesn't get updated very much anymore, it's very helpful to Launchbox. But anyway I was hoping for a script what I want to do is press a keyboard key and have Launchbox come up fullscreen which I've accomplished that part, but the part I haven't is I want that key to include activating it to where I can start navigating it without having to take my mouse and click on it. I have tried ControlClick but it's not working very well. (although I'm not an ahk expert maybe it's my script IDK)

HotKey, F8, LaunchUpdate
return

LaunchUpdate:
              WinMinimize ahk_exe launchbox.exe
              WinMaximize ahk_exe launchbox.exe 
              Controlclick, x500 y700, Left, launchbox 
              WinActivate ahk_exe launchbox 
        ;...any code you need...
        return

 

Edit: lol didn't read the thread someone was having that problem of the mouse moving and clicking on this page. 

Edit 2: Found a script from a few years ago that works! I used F8 and then used Joytokey to map it to a controller combo so I can pull up Launchbox at any time and have it activated.

CoordMode, Mouse
MouseGetPos, x, y
WinActivate, ahk_exe Launchbox.exe 
MouseMove, 586, 657
sleep 500
MouseClick Left


SystemCursor(OnOff := 1) {  ; INIT = "I","Init"; OFF = 0,"Off"; TOGGLE = -1,"T","Toggle"; ON = others
 ; https://www.autohotkey.com/boards/viewtopic.php?t=6167
 Static AndMask, XorMask, $, h_cursor
  , b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12,b13   ; Blank cursors
  , h1,h2,h3,h4,h5,h6,h7,h8,h9,h10,h11,h12,h13   ; Handles of default cursors
  , c := StrSplit("32512,32513,32514,32515,32516,32642,32643,32644,32645,32646,32648,32649,32650", ",")
 If (OnOff = "Init" || OnOff = "I" || $ = "") {  ; Init when requested or at first call
  $ = h                                          ; Active default cursors
  VarSetCapacity(h_cursor,4444, 1), VarSetCapacity(AndMask, 32*4, 0xFF), VarSetCapacity(XorMask, 32*4, 0)
  For each, cursor in c {
   h_cursor := DllCall("LoadCursor", "Ptr",0, "Ptr", cursor)
   h%each%  := DllCall("CopyImage", "Ptr", h_cursor, "UInt", 2, "Int", 0, "Int", 0, "UInt", 0)
   b%each%  := DllCall("CreateCursor", "Ptr", 0, "Int", 0, "Int", 0
                     , "Int", 32, "Int", 32, "Ptr", &AndMask, "Ptr", &XorMask)
  }
 }
 $ := OnOff = 0 || OnOff = "Off" || $ = "h" && (OnOff < 0 || OnOff = "Toggle" || OnOff = "T") ? "b" : "h"
 For each, cursor in c {
  h_cursor := DllCall("CopyImage", "Ptr", %$%%each%, "UInt", 2, "Int", 0, "Int", 0, "UInt", 0)
  DllCall("SetSystemCursor", "Ptr", h_cursor, "UInt", cursor)
 }
}

 

Edited by Jayinem
Posted
10 hours ago, Jayinem said:

I used F8 and then used Joytokey to map it to a controller combo

As an option, you can detect the controller combo without the need for joytokey.

1Joy7::
{
  If GetKeyState("Joy8")
  {
     WinActivate, ahk_exe Launchbox.exe 
     MouseMove, 586, 657, 0
     Click
  }
}

Here, you need to press and hold Joy8 1st, then press Joy7 to have it run.  Change the buttons accordingly.

Regarding the SystemCursor method, is your script calling that from somewhere else?  Because what you provided doesn't even use it.

 

10 hours ago, Jayinem said:

It's a shame this thread doesn't get updated very much anymore

It's updated pretty much every time someone posts a question. ;)  

Posted
22 minutes ago, JoeViking245 said:

As an option, you can detect the controller combo without the need for joytokey.

1Joy7::
{
  If GetKeyState("Joy8")
  {
     WinActivate, ahk_exe Launchbox.exe 
     MouseMove, 586, 657, 0
     Click
  }
}

Here, you need to press and hold Joy8 1st, then press Joy7 to have it run.  Change the buttons accordingly.

Regarding the SystemCursor method, is your script calling that from somewhere else?  Because what you provided doesn't even use it.

 

It's updated pretty much every time someone posts a question. ;)  

That's what I mean nobody's really asking anything I was the first post since October. But I think that 90%+ of Launchbox users don't use autohotkey or at least they don't use it with Launchbox. 

Posted
10 minutes ago, Jayinem said:

That's what I mean nobody's really asking anything I was the first post since October. But I think that 90%+ of Launchbox users don't use autohotkey or at least they don't use it with Launchbox. 

Or... they have 66 pages of script tips and tidbits that they read through and find what their after, fulfilling their every need. ;) 

  • Like 1
Posted (edited)

I made a thread that I never got an answer that fixed the problem about when I run Big Box and exit Big Box Launchbox.exe will stay stuck in task manager and I get the error that Launchbox is already running until I go into task manager and close it. I was wondering since you're pretty good at scripts could you give me a script that is always running like a loop that is checking for it to be in that state and can make it be full screen again? I have another script that keeps Launchbox open at all times but of course with Big Box it has to close or I should say it's supposed to close but doesn't fully. 

Edited by Jayinem
Posted

I just realized something the script that forces Launchbox to stay open is causing the issue.

 

#SingleInstance, Force 
iTC_EXE     = "c:\Launchbox\Launchbox.exe"
iTC_Path    = "c:\Launchbox\"
iTC_imgName = Launchbox.exe

loop {
	
	Process, Exist, %iTC_imgName% ; check to see if iTeleportConnect is running
	If (ErrorLevel = 0) ; If it is not running
	   {
	   Run, %iTC_EXE%, %iTC_Path%, hide
	   }
	Else ; If it is running, ErrorLevel equals the process id for the target program (Printkey). Then do nothing.
	   {
		sleep 5
	   }
}

So it keeps checking if launchbox is open so I guess when Big box is running launchbox.exe can't run so the conflict causes it to stay open in task manager?Is there any adjustment I can do where I can keep using this script and Launchbox will open after closing Big Box? I changed sleep 5 to sleep 8000 but that didn't help. 

Posted
12 hours ago, Jayinem said:

I just realized something the script that forces Launchbox to stay open is causing the issue.

Woops! ;) 

Honestly, you'd be better to just add LaunchBox to your taskbar making it one click away rather than having this running and constantly checking.  Would eliminate a lot (all?) of these issues.

But if you must....  just add another check inside of "If it is not running" to see if Big Box is running. Then process accordingly.

BTW, the Sleep timer you have, really should be closer to 1 or 2 (or more?) seconds vs. every 5 milliseconds.  There's no reason to have it check if LB is running 200 time per second

Posted
3 minutes ago, JoeViking245 said:

Woops! ;) 

Honestly, you'd be better to just add LaunchBox to your taskbar making it one click away rather than having this running and constantly checking.  Would eliminate a lot (all?) of these issues.

But if you must....  just add another check inside of "If it is not running" to see if Big Box is running. Then process accordingly.

BTW, the Sleep timer you have, really should be closer to 1 or 2 (or more?) seconds vs. every 5 milliseconds.  There's no reason to have it check if LB is running 200 time per second

I already have it on my taskbar I just want it to stay open and always fullscreen sorta like it's desktop wallpaper. When I minimize my browser for example it's there at all times. But I made it 10000 which is 10 seconds but for some reason it instantly gives me the "Launchbox is already running" msg after choosing switch to desktop mode in Big Box. 

Posted
47 minutes ago, Jayinem said:

it instantly gives me the "Launchbox is already running" msg after choosing switch to desktop mode in Big Box.

When switching from one to the other, one closes, does its' save thing, then the other opens.  Maybe you need to add a sleep timer in the "If it is not running" to check/double-check again to catch this scenario.

Try spelling it all out first (create a flowchart of sorts) accounting for all scenarios.  Then write/adjust the code based on that.

  • If it is not running
    • sleep 10 (or more?) seconds (it may be in the middle of switching to BB [or LB] via the app)
    • check [again] if LB OR BB is running
      • if one of them is, you probably 'switched'
        • "Move along. Nothing to see/do here."
      • otherwise try starting LB
    • etc.......
  • etc.......

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...