how to monitor screen for text in pulover's macro - automation

Im trying to make a macro where it monitors screen for a keyword
I tried image search in pulover's macro but it is not working, it doesn't read the text even when it showed up
Loop
{
CoordMode, Pixel, Screen
ImageSearch, FoundX, FoundY, 1583, 209, 1913, 939, C:\Users\Administrator\Pictures\Capture.PNG
Sleep, 10
}
Until ErrorLevel = 0
Click, 1645, 975 Left, 1
the image is a screenshot of the text that I want, its just word with white background so that shouldn't really be the problem, I checked the area that it is monitoring which is correct.

Related

Lock OfficeRibonLabel size

I have an Excel VSTO plug-in which displays error messages in a RibbonLabel.
Changing the label text causes it to resize which causes its containing RibbonGroup to resize which moves the last group separator right and left with each message. This looks very annoying.
Is there a way to freeze Ribbon control size or, alternatively, any other way to display immediately visible error message which will not block the document itself (i.e. NOT message box)?
You could write the label to the status bar.
excelApp.StatusBar = String.Format("Processing line {0} on {1}.",rows,rowNum);

VBA PowerPoint Toggle or Disable Animation During Presentation

In short, the issue I'm running into is that when using VBA to change font size during a presentation, the slide runs all animations for that slide a second time. Changing other qualities, such as font color or shape fill, the slide does not animate a second time.
The longer version: I'm creating a tool in PowerPoint for my trainers to be able to build quizzes and computer-based trainings. I'm using a template shape for each state of the button (correct, incorrect or unanswered), and then have .pickup and .apply to change the formatting of the shapes on the question slides. At runtime, the slide builds based on the animations, the user clicks an option and the shapes format immediately. However, the font size also changes to mirror the template shape. When I temporarily store the font size and reapply it after .apply, at runtime, the slide animates, the user clicks an option and the slide runs the animations again (albeit correctly with the new formatting). The code works, but certain changes cause the slide to animate a second time (text, size), and some changes don't (shape color, text color). It's this second animation of the slide I need to avoid.
Windows 7 Professional;
PowerPoint 2016
Instead of using .pickup & .apply, one thought was to change qualities of everything but the font size, (the fill and line qualities), but for the fill, alone there are 20+ qualities, and that's before getting into number of gradient stops, shadows, etc. I need my developers to have the freedom of formatting the shape as they want that my code can quickly pull from.
.SlideShowSettings.ShowWithAnimation - setting to 'false' at the start of the code and 'true' yielded no change in results. (Attempt shown in code below.)
.SlideShowWindow.View.State - setting to 'paused' and 'running' also did not affect anything. (Attempt shown in code below.)
All objects on the slide are set to fade in automatically upon showing the slide. The simplified code here is set to run when a shape is clicked and shows what works and what doesn't work. I've commented lines in and out so I can try different things.
Sub ProcessResponse()
'These options do not prevent re-animation when in mid-presentation:
'ActivePresentation.SlideShowSettings.ShowWithAnimation = msoFalse
'ActivePresentation.SlideShowWindow.View.State = ppSlideShowPaused
'The following items do NOT cause the slide to run the animation again (desired result):
'Changing the object fill.
'ActivePresentation.Slides(1).Shapes(1).Fill.ForeColor.RGB = RGB(50, 25, 100)
'Changing text color.
'ActivePresentation.Slides(1).Shapes(1).TextFrame.TextRange.Font.Color.RGB = RGB(50, 25, 150)
'The following lines of code cause the slide to run the animation again (undesired result):
'Changing the font size.
ActivePresentation.Slides(1).Shapes(1).TextFrame.TextRange.Font.Size = 40
'Changing the text.
'ActivePresentation.Slides(1).Shapes(1).TextFrame.TextRange.Text = "Changed"
'Closing the above attempts.
'ActivePresentation.SlideShowSettings.ShowWithAnimation = msoTrue
'ActivePresentation.SlideShowWindow.View.State = ppSlideShowRunning
End Sub
Setup: Slide with animations (i.e., fade in) that run "after next". 3-4 shapes, each with the above code called when clicked.
During the slide show:
Expected - animations, user clicks shape, the changes are made, no further actions/animations.
Actual Result - animations, user clicks shape, animations (changes are included).
Thank you for any and all help and considerations. Your time is appreciated.

How to extend dialogue dynamically to add error msg in vb.net windows form application

I have aLogin dialogue like the image below and I am showing the error messages on top of the dialogue.
As you can see I am leaving a rather big empty area on top of the dialogue for these messages(it can be up to 5 lines of text) which does not look good. I would like to remove the empty space on top and add the space in run time when there is an error line added.
I know that it is possible to move each element of the Dialogue down when a new error line is added(e.g. button1.Left += 200, for each element in dialogue), but is there an easier and more practical way to do it?

Multiple message boxes appear instead of one

I am designing a Breakout style game in VB and am having some minor problems with my code.
I am checking for collisions between the ball and the 4 sides of the form. So, as the ball collides with the bottom of the form, the game is meant to display a message box saying "You Lost!" with the Retry and Cancel buttons.
This is what I have coded under my Timer1_Tick event:
'check bottom of screen
If PictureBox_ball.Top >= 403 Then
'403 is the Y-coordinate of a horizontal line I have implemented
MsgBox("You Lost!", MessageBoxButtons.RetryCancel)
End If
However, when I run this code, the game displays multiple message boxes (around 25 of the same ones) instead of displaying one. And it doesn't stop there.
As the ball moves downwards and hits the bottom of the screen, the ball stops moving, displays a bunch of message boxes and then continues to move downwards and out of the screen.
How would I be able to fix this?
This is what I have coded under my Timer1_Tick event:
Stop your timer before you call out your msgBox
WHY ??
Because the the timer is always ticking, and as it ticks, it displays your msgBox.
Just try it, I had the same problem before on my projects.
The above code is in your main loop. Since you don't change any other flag (like : game_over = True or disarm the timer tick), the loop keeps running, the value is still matching the condition, and you get all those MessageBoxes
For example:
If not you_lost
if PictureBox_ball.Top >= 403 Then '403 is the Y-coordinate of a horizontal line I have implemented
MsgBox("You Lost!", MessageBoxButtons.RetryCancel)
you_lost = True
End If
end if

Microsoft Office 2007 Macro - Odd behavior. Cursor Jumps

I hope someone have some insight into this.
I have a check box on page 1 and when it's clicked, it will launch a macro & insert a value to a text box on page 10. Simple
The problem is, the script in the macro is looking for the value of another text box on page 5 to do some calculation. Whenever i do
text5value = Val(oFFld("Text5").Result)
or
If (Val(oFFld("Text5").Result) = "") Then
The cursor will suddenly move from page 1 to page 5. Very confusing to user.
This behavior happens whenever I try to get the value of a textbox. Wherever that textbox is in the current document, it will jump to it.
Please help
Try setting Screen Updating to false for the duration of the macro.
Application.ScreenUpdating = False
Not only will this hide the various screen jumps it is doing while the macro runs, the macro will also run faster if it doesn't have to constantly update the screen.