ATTENTION: You are viewing a page formatted for mobile devices; to view the full web page, click HERE.

DonationCoder.com Software > Finished Programs

DONE: autohotkey - reload script on screen number change

<< < (2/4) > >>

skwire:
How elegant do you want this?  I mean, what you want to do is a piece of cake in the scripting sense but did you want a nice GUI and such to go along with it?

Target:
I've just had a quick look at the doc's and it appears that the switching is done via hotkey (I'm also assuming that what you're doing is disabling/enabling your 'secondary'monitors)

this being the case you can simply add the same hotkey to your AHK script (DialogMove?) that sends the hotkey AND reloads the script, eg

    ^!F12::
    send ^!F12
    reload
    return

    +^!F12::
    send +^!F12
    reload
    return

you'll need ot check the syntax of the send command (I rarely use it so I always need to work it out each time...)

the returns are redundant in this case but it looks wrong to leave them out :huh:



nudone:
ooh, i like that, Target. i wasn't using the hotkeys (without a good reason; just lazy) so i'll check that ActualWindowManager works correctly that way. that would be enough to keep me happy for a while  :)

but, skwire, as for looking pretty, that wasn't important really. i was first just hoping for a few lines of script that i could edit maybe. the real problem is that it could be a very simple bit of code - but it would probably take me a couple of days (or more) to figure out myself. unless i hit lucky.

so, Targets idea will work quite well, i think, just for reloading Dialogmove. but it would be nice if i had a little script i could add to and reload/restart other scripts and exe files. i assume i can just add the same Target hotkey method to all the scripts i want to reload - maybe i just need a script that uses the very same hotkey to kill and restart a list of apps running in the tray...

...this is assuming that ActualWindowManager will behave as expected using the hotkeys.

i'll report back when i've got to my main pc and tried it.

p.s.
it would still be nice to have a script that automatically reloads stuff when detecting the number of screens enabled changes.

nudone:
Target's method of adding the hotkeys to DialogMove works. i'm not entirely sure if it works perfectly as there seems to be a problem "making things happen". that might just be the keyboard itself, seems i have to hold the keys down longer than expected before the system recognises what i'm doing.

i'll keep testing it out and report back.

Target:
ok, here's an automagic method - use a timer to fire a routine that counts the number of monitors and if the numbers don't match, reload

put this bit at the top of your script (DialogMove)


--- ---sysget, Count, monitorcount
settimer, Mon_Count,10000

put this bit at the bottom of your script


--- ---Mon_Count:
sysget, tmp_, monitorcount

if tmp_ = %count%
    return

reload
return
 

you could reload any number of scripts/apps using run commands, or you could do this from a list (ini), but you need to make sure to add the run commands before the reload command, and any other AHK scripts will need to use #singleinstance, force

NOTE - I don't have multiple monitors so this is untested, but it should work

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version