Jump to content

Need help with a script


Splitz
 Share

Recommended Posts

I have a script here i've been messing with, but i cant seem to figure out how to change how it works. Currently when i press the 1 key it will 'turn on' and then controlsend the '1' key multiple times to the comodo window and if i press 1 again it will simply shut off, but i want to change this.

I would like:

When i press the 1 key, i would like for it to make the first sound 'spam.wave' and trigger the script to be 'on'.. it will then await for the color 0x2E1700 to appear and then controlsend the 1 key to comodo window, after it has sent the 1 key ONE time, i want it to make the second 'beep' sound and the script will trigger its self 'off' until i press "1" again which will turn it back ON and it will wait for the color 0x2E1700 to appear

Thanks =)

Global $On
HotKeySet("1", "on_off")
While 1
        Sleep(100)
WEnd
Func on_off()
if Not $on Then
SoundPlay("C:\Program Files (x86)\FeedDemon\Data\sounds\Spam.wav") ; On
Else
Beep(5500, 500) ; Off
EndIf
    $On = Not $On
    While $On
Sleep(100)
PixelSearch(689, 767, 699, 777, 0x2E1700, 1)
If  Not @error Then
ControlSend("Comodo", "", "", "1")
Sleep(100)
EndIf
    WEnd
EndFunc
Link to comment
Share on other sites

  • Moderators

Fenix`,

Please wait at least 24hrs before bumping your own threads. ;)

Remember this is not a 24/7 support forum - those who answer are only here because they like helping others and have some time to spare. You just have to wait until someone who knows something about your particular problem, and is willing to help, comes online. Be patient and someone will answer eventually. :)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Try it this way:

HotKeySet("1", "on_off")
While 1
        Sleep(100)
WEnd
Func on_off()
Beep(2500, 500) ; On
Sleep(100)
While 1
PixelSearch(689, 767, 699, 777, 0x2e1700, 1)
If  Not @error Then
  ControlSend("Comodo", "", "", "1")
  Sleep(100)
  Beep(5500, 500) ; Off
  ExitLoop
EndIf
Sleep(100)
WEnd
EndFunc

it was sending "1" because it was finding the color over and over again

Link to comment
Share on other sites

Also, I hope this doesn't come out the wrong way, but the title you have given to this thread is not very descriptive and so many people will not click on it. People are on this forum because they need help with their script, ofcourse. A title that gives people an idea of the problem you are experiencing would be good. As an example, this particular thread should be called something along the lines of "Control Send Problem" or rather "Control Send Sending Repeatedly". Atleast then, people have an idea what the problem is before they go to check out the thread.

Link to comment
Share on other sites

Thanks Blinky youve helped me a bunch with this, i do have one last thing though

Could you please add a function so that it can be turned 'off' if i hit 1 again before the color is detected?

it works perfectly right now but i'd just like the option to press 1 and have it 'deactivate' as well

So it would work like this:

press 1, it turns on and waits for the color, sends 1 if the color is detected and shuts off just like it does now

but if i press 1 a second time before it finds the color, it will shut off as if it detected the color and make the second beep as well

pressing 1 at anytime after this will trigger it back on

thanks =)

Link to comment
Share on other sites

Here it is

Global $on=0
HotKeySet("1", "on_off")
While 1
        Sleep(100)
WEnd
Func on_off()
if $on=0 Then
SoundPlay("C:Program Files (x86)FeedDemonDatasoundsSpam.wav") ; On
$on=1
Else
Beep(5500, 500) ; Off
$on=0
EndIf
    While $on=1
Sleep(100)
PixelSearch(689, 767, 699, 777, 0x2E1700, 1)
If  Not @error Then
ControlSend("Comodo", "", "", "1")
Sleep(100)
Beep(5500, 500) ; Off  same sound
$on=0
EndIf
    WEnd
EndFunc

If u whant to learn autoit i recomand the tutorials or at least the AutoIt help its very useful

this is basic code and im sure there is a nother way to handle ur probblem

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...