Add a msgbox to an existing script

Get help with using AutoHotkey and its commands and hotkeys
User avatar
SpikeVanHellsing
Posts: 24
Joined: 16 May 2017, 21:33

Add a msgbox to an existing script

07 Jul 2020, 14:06

I have a few scripts that i use and i would like to add a msg box or tooltip to them that will display when they have been activated or deactivated and that will do away on its own after a set period of tile say like a minute or less. Is there any possible way to do this?
User avatar
Chunjee
Posts: 594
Joined: 18 Apr 2014, 19:05
GitHub: Chunjee

Re: Add a msgbox to an existing script

07 Jul 2020, 14:27

I researched it and this isn't possible with ahk
User avatar
SpikeVanHellsing
Posts: 24
Joined: 16 May 2017, 21:33

Re: Add a msgbox to an existing script

07 Jul 2020, 14:38

Ok then could i add in a msgbox just to tell me that the script will be ran after i manually close it with the ok buton?
User avatar
flyingDman
Posts: 798
Joined: 29 Sep 2013, 19:01

Re: Add a msgbox to an existing script

07 Jul 2020, 15:16

@SpikeVanHellsing Why don't you provide an example of the types of script you want to add a msgbox to?
This msgbox cancels itself in 10 seconds:

Code: Select all

Msgbox,,,I'll go away in ten seconds, 10
and can be incorporated in most scripts.
A tooltip can be incorporated and dismissed after a period of your choice using a settimer like so:

Code: Select all

tooltip, This is a test, %a_screenwidth%, %a_screenheight%
SetTimer, dismissTT, 7000
return

dismissTT:
ToolTip
return
User avatar
SpikeVanHellsing
Posts: 24
Joined: 16 May 2017, 21:33

Re: Add a msgbox to an existing script

07 Jul 2020, 17:01

@flyingDman This is one of the scrypts that i use to press shift every so often:

Code: Select all

#MaxThreadsPerHotkey 2
F1::
Toggle := !Toggle
loop
{
    If not Toggle
        break
    sendinput, {LShift down}
    sleep 125
    sendinput, {LShift up}
    sleep 200000
}
return
And this is a script i use just as a generic rapid click someone made for me a few years ago:

Code: Select all

F1::domino66Click()


domino66Click(Interval=0){

   static Toggler

   Toggler := !Toggler

   TPer := Toggler ? Interval : "off"

   SetTimer, ClickClick, %TPer%

   return

   ClickClick:

   Click

   return

}
Now my question is how and where would i add either the tooltip or msgbox code into either of these scripts?
User avatar
SpikeVanHellsing
Posts: 24
Joined: 16 May 2017, 21:33

Re: Add a msgbox to an existing script

08 Jul 2020, 17:01

Anyone? I have tried pasting the msgbox code both before and after my trigger key in my scripts and nothing happens. What am i doing wrong?
User avatar
SpikeVanHellsing
Posts: 24
Joined: 16 May 2017, 21:33

Re: Add a msgbox to an existing script

11 Jul 2020, 08:10

Please someone. If i add in the msgbox code it runs but nothing else happens.
garry
Posts: 2339
Joined: 22 Dec 2013, 12:50

Re: Add a msgbox to an existing script

11 Jul 2020, 09:56

example splashimage if running

Code: Select all

#MaxThreadsPerHotkey 2
F1::
Toggle := !Toggle
if (toggle=1)
  Splashimage,,b w600 h150 x100 Y400 CWsilver m9 b fs10 zh0,Running...
loop
{
    If not Toggle
     {
     Splashimage, off
     break
     }
    msgbox, 262208, ,sendinput`, {LShift down},1  ;- msgbox for test 
    ;sleep 125
    ;sendinput, {LShift up}
    ;sleep 200000
}
return
esc::exitapp
User avatar
SpikeVanHellsing
Posts: 24
Joined: 16 May 2017, 21:33

Re: Add a msgbox to an existing script

14 Jul 2020, 01:05

garry wrote:
11 Jul 2020, 09:56
example splashimage if running

Code: Select all

#MaxThreadsPerHotkey 2
F1::
Toggle := !Toggle
if (toggle=1)
  Splashimage,,b w600 h150 x100 Y400 CWsilver m9 b fs10 zh0,Running...
loop
{
    If not Toggle
     {
     Splashimage, off
     break
     }
    msgbox, 262208, ,sendinput`, {LShift down},1  ;- msgbox for test 
    ;sleep 125
    ;sendinput, {LShift up}
    ;sleep 200000
}
return
esc::exitapp
so this does work, however its not what i am looking for. after doing some digging i think what i am looking for is a tooltip. seeing as it doesn't take focus away from the active window.
User avatar
haichen
Posts: 485
Joined: 09 Feb 2014, 08:24

Re: Add a msgbox to an existing script

14 Jul 2020, 03:09

Code: Select all

#MaxThreadsPerHotkey 2
F1::
Toggle := !Toggle
loop
{
    If not Toggle
    {
	tooltip, break
	sleep, 2000
	tooltip
        break
    }
    tooltip, LShift down
    ;sendinput, {LShift down}
    sleep 1250
    ;sendinput, {LShift up}
    tooltip, LShift up
    sleep 2000
    tooltip, Loop %a_index%
    sleep 2000
}
return
You can click on the code to jump to the Help
garry
Posts: 2339
Joined: 22 Dec 2013, 12:50

Re: Add a msgbox to an existing script

14 Jul 2020, 05:20

@haichen , thank you
splashimage doesn't steal the focus , only the msgbox example ( which isn't needed )
for splashimage you can set position , size , color etc , I like to use for : It's running ... / Finished ( when no GUI exist ) , Tooltip for short , fast messages
User avatar
SpikeVanHellsing
Posts: 24
Joined: 16 May 2017, 21:33

Re: Add a msgbox to an existing script

14 Jul 2020, 10:56

haichen wrote:
14 Jul 2020, 03:09

Code: Select all

#MaxThreadsPerHotkey 2
F1::
Toggle := !Toggle
loop
{
    If not Toggle
    {
	tooltip, break
	sleep, 2000
	tooltip
        break
    }
    tooltip, LShift down
    ;sendinput, {LShift down}
    sleep 1250
    ;sendinput, {LShift up}
    tooltip, LShift up
    sleep 2000
    tooltip, Loop %a_index%
    sleep 2000
}
return
You can click on the code to jump to the Help
thank you both for your help with this. however, i do not want a splashimage and the code did nothing but sycle through the tooltip. I didnt know adding a tolltip would be so hard. but all i want is for a tooltip to be displayed when the script is activated and deactivated. if this can't be done then so be it.
User avatar
haichen
Posts: 485
Joined: 09 Feb 2014, 08:24

Re: Add a msgbox to an existing script

14 Jul 2020, 11:28

Code: Select all

#MaxThreadsPerHotkey 2
CoordMode, ToolTip, Screen
F1::
Toggle := !Toggle
loop
{
    If not Toggle
    {
	tooltip, break, A_ScreenWidth-300, 150
        break
    }
    tooltip, running, A_ScreenWidth-300, 150
    sendinput, {LShift down}
    sleep 250
    sendinput, {LShift up}
    sleep 200000
    tooltip, ready, A_ScreenWidth-300, 150
}
return
Is this better?
User avatar
SpikeVanHellsing
Posts: 24
Joined: 16 May 2017, 21:33

Re: Add a msgbox to an existing script

14 Jul 2020, 14:23

haichen wrote:
14 Jul 2020, 11:28

Code: Select all

#MaxThreadsPerHotkey 2
CoordMode, ToolTip, Screen
F1::
Toggle := !Toggle
loop
{
    If not Toggle
    {
	tooltip, break, A_ScreenWidth-300, 150
        break
    }
    tooltip, running, A_ScreenWidth-300, 150
    sendinput, {LShift down}
    sleep 250
    sendinput, {LShift up}
    sleep 200000
    tooltip, ready, A_ScreenWidth-300, 150
}
return
Is this better?
while this actually runs, the tooltip doesn't go away. i need something like what flyingDman posted for a tooltip and to be able to just insert the tooltip into which ever existing code i use. For example

Code: Select all

F2::
 {
   toggle:=!toggle
   if (toggle)
    {
	  sendinput, {w down}
    }
   else
    {
	  sendinput, {w up}
    }
 }
return
User avatar
SpikeVanHellsing
Posts: 24
Joined: 16 May 2017, 21:33

Re: Add a msgbox to an existing script

24 Jul 2020, 00:31

Wow 10 days without anything. Guess I'm asking for too much. If I understand that uh polvolo mace creater thing more I'd try to do it myself. Well, thank you everyone who's tried to help. I appreciate it.

Return to “Ask For Help”

Who is online

Users browsing this forum: aifritz, Bing [Bot], doubledave22, elbeau, Google [Bot], JaydeNpie, jeongrak2, Jovannb, jvlz, kevlea and 47 guests