im trying to make a discord macro to send a message nonstop - automation

I'm using https://www.autohotkey.com/docs/AutoHotkey.htm to create a discord macro to basically spam a message in one of my servers nonstop. I want to have ctrl+4 to activate it and I want ctrl+5 to stop it, I also want it to wait until the message is sent to send the next one. I keep getting errors and cant make it work, does anyone here know how I should do it?

Easier to just send what you have copied in your clipboard.
Make a new script file (ending with .ahk) and paste this in. You can toggle it on and off with F1.
#NoEnv
SendMode Input
SetWorkingDir %A_ScriptDir%
#MaxThreadsPerHotkey 3
F1::
Toggle := !Toggle
Loop, {
If (!Toggle)
Break
Send %ClipBoard%
Send {Enter}
Sleep 1000
}
You can tweak this if need be.
Make sure to use it only when you are allowed to.

Related

How to make an input box in VBS that is always open?

I'm writing a VBS program where there is a while loop, but it's not easily breakable because it's not seen in the task manager easily (Not enough time to find it in the background processes because of the program). So, my solution was to make a simple input box that is always open which allows you to break the loop by typing Q. But, I can't find a way to allow the code in front of the input box code to run without having an input in the input box (Yes, No, Cancel). Any help? I'm new to VBS.

Pause VBA Macro to allow manual input of data

I have an Excel workbook macro that opens another workbook and starts copying data into it and formatting it. At one point in the process, I want the macro to pause and let the user manually enter data into the target workbook and then resume processing.
MsgBox, Application.Wait(), and Sleep are all application modal and will not let the user update anything in the other workbook while they are executing.
I found this while searching for a solution. It gets me halfway there in that I can manipulate the other sheet but only with my mouse. No keyboard presses get sent to the workbook.
Any ideas on getting all the way there?
I was thinking that I could just have two macros. The user would run one, then perform his manual tasks, then run the other. This appears to work but I would have to convert everything to globals so hopefully, someone has a better idea.
Thanks!
Depending on the macro being run to copy and paste, is the main concern with user intervention during execution of the macro getting the active cell/sheet (if being used) back to being active after the user manipulates something.
I'd recommend storing the active cell/sheet address in a variable prior to the Application.Wait() and then setting the active cell to that stored value on resume.
Without a posting of what your macro is doing though, it is hard to know if this suggestion helps your current situation.

Stuck in infinite loop. Any way to break vba into Code when Control+Break doesn't work

I have code stuck.
It might be in an infinite loop.
Not sure.
Is there a way to break the program to stop at the current line of code that it is running on?
I'd like to avoid shutting down excel because I want to be able to catch where in the loop it is, and by going into the code, I will be able to tell how much processing was done. I would like to break into the code, if possible.
It is stuck on hour glass.
Ctrl+Break doesn't seem to work
Seems like the running code has hijacked all the quota that cpu is giving to excel.
If there is nothing I can do now, is there something in the future I can do to where I can more easily break into the code?
I'm thinking that an intermittent wait within a loop might be a feasible solution.
In the future, include a DoEvents inside the loop. It will run a little slower, but you will be able to use Ctrl+Break to stop it from running.
Create a progress dialog when entering the loop and include a Cancel button. Within your loop check for the Cancel signal/event. This also gives you some flexibility on how you react to the Cancel - you could stop the loop and display key information in a new dialog box (for example).
Basic steps to achieve what I have described (not necessarily the most elegant or the most re-useable, but simple enough for those of lesser experience):
create a modeless (not modal) Form with either suitable labels or a progressbar item (for
visual effect). Include a public property (Boolean) for Cancel (e.g.
boolCancel)
Place a button on form and onClick set boolCancel = True
In your main code, show the form just before your problem loop.
while in your loop you can update some label or progress bar on the
form so that you have a visual indication of whether the loop is
doing something of value or if it is now simply spinning its wheels.
How you do this depends on what your loop is doing.
Also while in your loop check your boolCancel value. If true then
display any state information you want and break from the loop.
If your loop ends normally, hide/unload the progress dialog.

Send keys in VBA on appearance of dialog box

Back in this question, I was looking for a way of disabling a particularly troublesome dialog from Outlook that warned me the attachments I was sending might be unsafe. Having concluded that the only security-setting options were unavailable because of administrator privileges, I've instead been trying to look for a workaround to have a script active within Outlook that does something like the following (pseudo VBA):
sub PollForDialog()
if dialogbox = open and dialogbox.name = "This outgoing message may..." then
Sendkeys arrowleft + enter
I've tried exhaustively to search for how to have scripts execute upon a messagebox popping up, and I haven't had any luck. Plenty of stuff about dialog boxes opening when a script is run, but nothing I can find on how to trigger on a dialog opening. Anyone able to help?
Thanks muchly.

Bring the security message box to the front when using Outlook VBA to send an email

I'm writing code to automate sending an email from Excel. Whenever the send function of Outlook is executed, there is a warning/security message box to approve before the email is sent.
The message box is beneath the other forms so the user has to find this message box to proceed with the other tasks.
Is there a way to have this message box appear on top?
The warning message is there for a reason.
However, you can bypass it, but you have to code the functions in C++ and call them from VBA or use a commercial lib that has already done this.
One i've used is: Redemption, website
I've been able to solve the "messagebox on top" issue by using the following:
Set outlookProgram = CreateObject("Outlook.Application")
outlookProgram.ActiveExplorer.Activate
Thanks for all you help guys.
P