Sign in to follow this  
Followers 0
lilandywandy

need some help with script

9 posts in this topic

If PixelGetColor(119,777) = Dec("8c8e9c") Then
      Send("{F7}")
      Sleep(5000)

is currently what i have, and this is only... "when XX,XX equals to Xcolor, do Xcommands"

but what im looking for is a code where, it serves ..." when XX,XX has not been Xcolor for 15 secs, then do Xcommands"

someone gave me this

While 1

If PixelGetColor(367,708) = Dec(0x00f742) Then
$Temp = 0 
EndIf

If Not PixelGetColor(367,708) = Dec(0x00f742) Then
$Temp = $Temp +1
If $Temp = 12 then
Send("{PAUSE}")
Endif
EndIf

Sleep(1000); sleep 1 second
Wend

but all it seems to do is press pause after 15 secs even if the pixel 367,708 had been 0x00f742 before 15 secs

Share this post


Link to post
Share on other sites



Try This, I used a debug so you could see, and just used the Hex colour.

Dim $Temp = 0

While 1
   ToolTip("Temp = " & $Temp, 0, 0)
   
   If (PixelGetColor(367, 708) == 0x00F742) Then
      $Temp = 0
   Else
      If Not (PixelGetColor(367, 708) == 0x00F742) Then
         $Temp = $Temp + 1
         If $Temp = 12 Then
            MsgBox(0, "", "Hit 12")
         EndIf
      EndIf
   EndIf
   Sleep(1000); sleep 1 second
WEnd

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
Share on other sites

Also, I don't use HotKeys much, maybe one of the other guys can answer this: If you use {Pause} in the middle of an If statment, does it return to the same spot when unpaused?

If so, you may want to add a $Temp = 0 right after where the message box is as shown below:

If $Temp = 12 Then
            MsgBox(0, "", "Hit 12")
         $Temp = 0

Just a thought.


Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
Share on other sites

then this works like a charm but can anyone help me with this?

i have 2 codes and i wanna combine them into one file, but they still have to run like they do when i open them serperatly

Dim $Temp = 0

While 1
   ToolTip("Temp = " & $Temp, 0, 0)
   
   If (PixelGetColor(367, 708) == 0x00F742) Then
      $Temp = 0
   Else
      If Not (PixelGetColor(367, 708) == 0x00F742) Then
         $Temp = $Temp + 1
         If $Temp = 12 Then
            Send("{ESC}")
         EndIf
      EndIf
   EndIf
   Sleep(1000); sleep 1 second
WEnd

While 1
   If PixelGetColor(89,751) = Dec("31414a") Then
      Send("{F8}")
      Sleep(5000)
   EndIf
Wend

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

but they still have to run like they do when i open them serperatly

Sorry, could you elaborate on that please? Seems to me, you could just combine them into one file, then if you need them to call one another, put one in a named function so it can be called as necessary...so if you take the stuff from the second, and put it in it's own, you could call it half way through execution of the first script and the second would execute before the first continues... Is that what you mean of how you want them to run? example:
;script 1 statements:
...
SecondScript()
;other statements






Func SecondScript()
msgbox(0,"blah","this would be displayed, and execution of first script would hold until it is cleared")
EndFunc

***edit*** added the close code tag

Edited by cameronsdad

1100111 00001011101111 00011101101111 00010111100100 00001111110100 00110111110010 00101101111001 0011100i didn't make up this form of encryption, but i like it.credit to the lvl 6 challenge on arcanum.co.nz

Share this post


Link to post
Share on other sites

If you are wanting the ability to combine your scripts, but still be able to have them perform at the exact same time that is impossible for now with AutoIt. If they can perform in just any order (as needed) then you will be fine combining them into one script.

JS


AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

i have 2 codes and i wanna combine them into one file, but they still have to run like they do when i open them serperatly

<{POST_SNAPBACK}>

Give this a shot and let us know how it works for you:

local $timer1 = timerInit()
local $timer2 = 0

while (1)

    if (pixelGetColor(367, 708) = 0x00f742) then
        $timer1 = timerInit()
    else
        if (timerDiff($timer1) > 12000) then
            send("{ESC}")
            $timer1 = timerInit()
        endIf
    endIf

    if (timerDiff($timer2) > 5000 and pixelGetColor(89, 751) = 0x31414a) then
        send("{F8}")
        $timer2 = timerInit()
    endIf

    sleep(100)

wEnd

Edit: removed an If..EndIf block. The AutoIt developers were fantastically considerate when programming AND and OR logic -- take for instance If (Condition1 Or Condition2) -- if Condition1 is true then (the potentially CPU-consuming) Condition2 is not tested which is fantastic. Things work similarly for AND. :)

Edited by LxP

Share this post


Link to post
Share on other sites

If you are wanting the ability to combine your scripts, but still be able to have them perform at the exact same time that is impossible for now with AutoIt.

Isnt this impossible in all programming languages ?

Dont programs work by reading 1 line of code at a time according to priority like example a shopping list?

So if you have 3 tasks like so.

Task A - Priority 1

Task B - Priority 3

Task C - Priority 2

The tasks would be read and completed in the order A,C,B

I understand that lines of code could be read and tasks completed so fast that it would appear multiple tasks are done at the same time.

So my question is can computers compute multiple tasks at the same time or do they do everything in a shopping list style ?

Is this only true in scripting languages ? or true for all programming languages ?

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

Isnt this impossible in all programming languages ?

Dont programs work by reading 1 line of code at a time according to priority like example a shopping list?

So if you have 3 tasks like so.

Task A - Priority 1

Task B - Priority 3

Task C - Priority 2

The tasks would be read and completed in the order A,C,B

I understand that lines of code could be read and tasks completed so fast that it would appear multiple tasks are done at the same time.

So my question is can computers compute multiple tasks at the same time or do they do everything in a shopping list style ?

Is this only true in scripting languages ? or true for all programming languages ?

<{POST_SNAPBACK}>

Actually there are some languages, Java for example, that support what's called multi-threading. Each linear process of statements is a thread, and with java, you can have several threads executing at the same time from the same application.

***edit***

grammatical error

Edited by cameronsdad

1100111 00001011101111 00011101101111 00010111100100 00001111110100 00110111110010 00101101111001 0011100i didn't make up this form of encryption, but i like it.credit to the lvl 6 challenge on arcanum.co.nz

Share this post


Link to post
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
Sign in to follow this  
Followers 0