Estimize

How to use selected text in autoit

20 posts in this topic

I have a program that automatically selects this bit of text and I need it to make a decision based on what this text is. For example here it is "2.18", if it shows this number I need it to repeat the function it just previously executed which is called Click_1(). Also if this value is something else for example "0.00" I need it to go onto the next function which is called Click_2. Any help is appreciated and if I missed any bits of info out which would help you answer my question just let me know. This decision also needs to be made outside of the functions Click_1/2 if possible. Thanks in advance

2.18.png

Share this post


Link to post
Share on other sites



Local $Data, $NewData;variable placeholder for selected text

While 1; make a loop to keep the script running inefinately
    WinActive(name of your program);You will probably want to use this to make the screen with the text the active window
    Send("^c");Send Ctrl + C to copy the copied text
    sleep(250);I add this to give the computer time to copy the data to the clipboard. It may not be necessary
    $NewData = ClipGet();This will read the clipboard data in windows and set it to the variable $data for comparisons
    If $NewData == $Data Then
        Click_1()
        $Data = $NewData
    EndIF
    IF $NewData == 0.00 Then
        Click_2()
        $Data == $NewData
    EndIF
    Sleep(1000);pause the program for 1 second so it doesn't overuse your processor.
WEnd

Func Click1()
    MouseClick("",x1,y1)
EndFunc

Func Click_2()
    MouseClick("",x1,y1)
EndFunc

Haven't tested this but it is how I would write what you are explaining.

1 person likes this

Get Scite to add a popup when you use a 3rd party UDF -> http://www.autoitscript.com/autoit3/scite/docs/SciTE4AutoIt3/user-calltip-manager.html

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Local $Data, $NewData;variable placeholder for selected text

While 1; make a loop to keep the script running inefinately
    WinActive(name of your program);You will probably want to use this to make the screen with the text the active window
    Send("^c");Send Ctrl + C to copy the copied text
    sleep(250);I add this to give the computer time to copy the data to the clipboard. It may not be necessary
    $NewData = ClipGet();This will read the clipboard data in windows and set it to the variable $data for comparisons
    If $NewData == $Data Then
        Click_1()
        $Data = $NewData
    EndIF
    IF $NewData == 0.00 Then
        Click_2()
        $Data == $NewData
    EndIF
    Sleep(1000);pause the program for 1 second so it doesn't overuse your processor.
WEnd

Func Click1()
    MouseClick("",x1,y1)
EndFunc

Func Click_2()
    MouseClick("",x1,y1)
EndFunc

Haven't tested this but it is how I would write what you are explaining.

If $NewData == 2.18 Then
        Click_1()
        $Data = $NewData
    EndIF
    IF $NewData == 0.00 Then
        Click_2()
        $Data == $NewData
    EndIF

 

 

is this correct or should what i changed to 2.18 stay as $data  also thanks very much for the help

 

 

Edited by Estimize
misscode

Share this post


Link to post
Share on other sites

It depends on what you want the script to do. Will it run forever? How many values will there be? The code I wrote is made to work forever. If you only want to check the number a few times then leave it at 2.18. Bottom line here is that you need to take what I wrote and test it and make changes and then test it. If you get stuck add more questions to this thread and we will help.


Get Scite to add a popup when you use a 3rd party UDF -> http://www.autoitscript.com/autoit3/scite/docs/SciTE4AutoIt3/user-calltip-manager.html

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

I am having trouble getting my code to recognise the second if statement any help? My code is shown belowproblems.thumb.png.7c75289e5ba64c4e3b2f7

 

Edited by Estimize
miss click

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

Can you copy and paste your code in a code window (its the <> symbols) rather than a blurry screen shot? Thy this. you can use msgbox to debug what is happening in your code to find out why it does not do what you want it to.

#include <MsgBoxConstants.au3>
HotKeySet("{F6}","Terminalte")

Local $Data = 2.18;stored value of what the selected text was as of the last check
Local $NewData;most current value of what is the selected text

Click_1();Run the function Click_1() when the script starts before the while loop

While 1; make a loop to keep the script running inefinately
    If WinExists("Function2") Then
        WinActive("Functions2");You will probably want to use this to make the screen with the text the active window
        Sleep(250)
    Else
        MgBox(0,"Missing Window","Functions2 window is not running")
        Exit 0
    EndIf
    Send("^c");Send Ctrl + C to copy the copied text
    sleep(250);I add this to give the computer time to copy the data to the clipboard. It may not be necessary
    $NewData = ClipGet();This will read the clipboard data in windows and set it to the variable $data for comparisons
    If $NewData == $Data Then;this value starts as 2.18 as declared by line 3
        Click_1()
        $Data = $NewData;Set $Data to 2.18 after Click_1() has been run
    EndIF
    If $NewData == 0.00 Then
        Click_2()
        $Data = $NewData;This will set $Data to 0.00
    EndIF
    If $NewData <> 2.18 and $NewData <> 0.00 Then
        MsgBox(0,"NewData Value not 2.18 or 0.00","The value of $NweData is neither 2.18 nor 0.00. The value of $NewData is: " & $NewData)
        Exit 0
    EndIf   
    Sleep(1000);pause the program for 1 second so it doesn't overuse your processor.
WEnd

Func Click1()
    MouseClick("",x1,y1)
EndFunc

Func Click_2()
    MouseClick("",x1,y1)
EndFunc

Func Terminate()
    Exit 0
EndFunc

 

Edited by computergroove

Get Scite to add a popup when you use a 3rd party UDF -> http://www.autoitscript.com/autoit3/scite/docs/SciTE4AutoIt3/user-calltip-manager.html

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

This is the funtions2.au3 page this shouldnt be like the rest of the code sorry
Func Click_1()
   Sleep (10000)
   MouseClick("left" , 863, 356) ;Click the X button
   sleep (250)
   MouseClick("left" , 1300, 186) ;Click the X button
   sleep (250)
   MouseClick("left" , 1260, 200) ;Click Amount TextBox
   sleep (250)
   for $x - 1 to 8
      send ("{BACKSPACE down}")
      sleep (100)
      Send("{BACKSPACE up}")
      sleep (100)
   Next ;Clicks Backspace 3 times
   sleep (100)
   Send("1.16") ;Inputs '1' into the amount box
   sleep (250)
   MouseClick("left" , 1245, 512) ;Click Call
   sleep (250)
   MouseClick("Left" , 790, 400)
   sleep (90000)
   MouseClick("right" , 807, 439)
   MouseClick("left" , 860, 665)
   sleep (5000)
   MouseClick("left" , 1001, 296)
   MouseClick("left" , 1012, 309)
   MouseClick("left" , 1046, 351)
   MouseClick("left" , 1046, 351)
EndFunc

Func Click_2()
   Sleep (1000)
   MouseClick("left" , 863, 563) ;Click the X button
   sleep (250)
   MouseClick("left" , 1260, 200) ;Click Amount TextBox
   sleep (250)
   for $x - 1 to 8
      send ("{BACKSPACE down}")
      sleep (100)
      Send("{BACKSPACE up}")
      sleep (100)
   Next ;Clicks Backspace 3 times
   sleep (100)
   Send("3.74") ;Inputs '1' into the amount box
   sleep (250)
   MouseClick("left" , 1245, 512) ;Click Call
   sleep (250)
   MouseClick("Left" , 790, 400)
   sleep (90000)
   MouseClick("right" , 807, 439)
   MouseClick("left" , 860, 665)
   sleep (5000)
   MouseClick("left" , 1001, 296)
   MouseClick("left" , 1012, 309)
   MouseClick("left" , 1046, 351)
   MouseClick("left" , 1046, 351)
EndFunc

This is the mainbot.au3 page

#include <MsgBoxConstants.au3>
#include <Functions2.au3>


HotKeySet("{F6}", "_Terminate")
Local $Data, $NewData;variable placeholder for selected text

Click_1()

While 1; make a loop to keep the script running inefinately
    WinActive("Functions2");You will probably want to use this to make the screen with the text the active window
    Send("^c");Send Ctrl + C to copy the copied text
    sleep(250);I add this to give the computer time to copy the data to the clipboard. It may not be necessary
    $NewData = ClipGet();This will read the clipboard data in windows and set it to the variable $data for comparisons
    If $NewData == 2.18 Then
       Click_1()
        $Data = $NewData
    EndIF
    IF $NewData == 0.00 Then
       Click_2()
        $Data == $NewData
    EndIF
    Sleep(1000);pause the program for 1 second so it doesn't overuse your processor.
WEnd

 

Edited by Estimize

Share this post


Link to post
Share on other sites

Can you copy and paste your code in a code window (its the <> symbols) rather than a blurry screen shot? Thy this. you can use msgbox to debug what is happening in your code to find out why it does not do what you want it to.

#include <MsgBoxConstants.au3>
HotKeySet("{F6}","Terminalte")

Local $Data = 2.18;stored value of what the selected text was as of the last check
Local $NewData;most current value of what is the selected text

Click_1();Run the function Click_1() when the script starts before the while loop

While 1; make a loop to keep the script running inefinately
    If WinExists("Function2") Then
        WinActive("Functions2");You will probably want to use this to make the screen with the text the active window
        Sleep(250)
    Else
        MgBox(0,"Missing Window","Functions2 window is not running")
        Exit 0
    EndIf
    Send("^c");Send Ctrl + C to copy the copied text
    sleep(250);I add this to give the computer time to copy the data to the clipboard. It may not be necessary
    $NewData = ClipGet();This will read the clipboard data in windows and set it to the variable $data for comparisons
    If $NewData == $Data Then;this value starts as 2.18 as declared by line 3
        Click_1()
        $Data = $NewData;Set $Data to 2.18 after Click_1() has been run
    EndIF
    If $NewData == 0.00 Then
        Click_2()
        $Data = $NewData;This will set $Data to 0.00
    EndIF
    If $NewData <> 2.18 and $NewData <> 0.00 Then
        MsgBox(0,"NewData Value not 2.18 or 0.00","The value of $NweData is neither 2.18 nor 0.00. The value of $NewData is: " & $NewData)
        Exit 0
    EndIf   
    Sleep(1000);pause the program for 1 second so it doesn't overuse your processor.
WEnd

Func Click1()
    MouseClick("",x1,y1)
EndFunc

Func Click_2()
    MouseClick("",x1,y1)
EndFunc

Func Terminate()
    Exit 0
EndFunc

 

what are the last 11 lines for???

 

 

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

#include <MsgBoxConstants.au3>
HotKeySet("{F6}","Terminate")

Local $Data = 2.18;stored value of what the selected text was as of the last check
Local $NewData;most current value of what is the selected text

Click_1();Run the function Click_1() when the script starts before the while loop

While 1; make a loop to keep the script running inefinately
    If WinExists("Function2") Then
        WinActive("Functions2");You will probably want to use this to make the screen with the text the active window
        Sleep(250)
    Else
        MgBox(0,"Missing Window","Functions2 window is not running")
        Exit 0
    EndIf
    Send("^c");Send Ctrl + C to copy the copied text
    sleep(250);I add this to give the computer time to copy the data to the clipboard. It may not be necessary
    $NewData = ClipGet();This will read the clipboard data in windows and set it to the variable $data for comparisons
    If $NewData == $Data Then;this value starts as 2.18 as declared by line 3
        Click_1()
        $Data = $NewData;Set $Data to 2.18 after Click_1() has been run
    EndIF
    If $NewData == 0.00 Then
        Click_2()
        $Data = $NewData;This will set $Data to 0.00
    EndIF
    If $NewData <> 2.18 and $NewData <> 0.00 Then
        MsgBox(0,"NewData Value not 2.18 or 0.00","$NewData is neither 2.18 nor 0.00. The value of $NewData is: " & $NewData)
        Exit 0
    EndIf   
    Sleep(1000);pause the program for 1 second so it doesn't overuse your processor.
WEnd

Func Click_1()
   Sleep (10000)
   MouseClick("left" , 863, 356) ;Click the X button
   sleep (250)
   MouseClick("left" , 1300, 186) ;Click the X button
   sleep (250)
   MouseClick("left" , 1260, 200) ;Click Amount TextBox
   sleep (250)
   for $x - 1 to 8
      send ("{BACKSPACE down}")
      sleep (100)
      Send("{BACKSPACE up}")
      sleep (100)
   Next ;Clicks Backspace 3 times
   sleep (100)
   Send("1.16") ;Inputs '1' into the amount box
   sleep (250)
   MouseClick("left" , 1245, 512) ;Click Call
   sleep (250)
   MouseClick("Left" , 790, 400)
   sleep (90000)
   MouseClick("right" , 807, 439)
   MouseClick("left" , 860, 665)
   sleep (5000)
   MouseClick("left" , 1001, 296)
   MouseClick("left" , 1012, 309)
   MouseClick("left" , 1046, 351)
   MouseClick("left" , 1046, 351)
EndFunc

Func Click_2()
   Sleep (1000)
   MouseClick("left" , 863, 563) ;Click the X button
   sleep (250)
   MouseClick("left" , 1260, 200) ;Click Amount TextBox
   sleep (250)
   for $x - 1 to 8
      send ("{BACKSPACE down}")
      sleep (100)
      Send("{BACKSPACE up}")
      sleep (100)
   Next ;Clicks Backspace 3 times
   sleep (100)
   Send("3.74") ;Inputs '1' into the amount box
   sleep (250)
   MouseClick("left" , 1245, 512) ;Click Call
   sleep (250)
   MouseClick("Left" , 790, 400)
   sleep (90000)
   MouseClick("right" , 807, 439)
   MouseClick("left" , 860, 665)
   sleep (5000)
   MouseClick("left" , 1001, 296)
   MouseClick("left" , 1012, 309)
   MouseClick("left" , 1046, 351)
   MouseClick("left" , 1046, 351)
EndFunc

Can you point them out for me? I am adding features to the code in the event that the selected text is neither 2.18 nor 0.00. Its optional and you can remove it if that will never happen.

Edited by computergroove

Get Scite to add a popup when you use a 3rd party UDF -> http://www.autoitscript.com/autoit3/scite/docs/SciTE4AutoIt3/user-calltip-manager.html

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

my code is now working and chooses call_1 or 2 appropriately and I renamed them to call because I felt it fitted it's purpose better. I used this

 

#include <MsgBoxConstants.au3>
#include <Functions2.au3>

HotKeySet("{F6}", "_Terminate")
Local $Data, $NewData;variable placeholder for selected text

Sleep (5000)

MouseClick ("right", 1260, 260)
Sleep (250)
MouseClick ("left", 1214, 485)
sleep (250)
Call_1()

While 1; make a loop to keep the script running inefinately
    WinActive("Functions2");You will probably want to use this to make the screen with the text the active window
    Send("^c");Send Ctrl + C to copy the copied text
    sleep(250);I add this to give the computer time to copy the data to the clipboard. It may not be necessary
    $NewData = ClipGet();This will read the clipboard data in windows and set it to the variable $data for comparisons
    If $NewData == 2.18 Then
       Call_1()
        ;$Data = $NewData
     Else
       $NewData == 0.00
       Call_2()
       ;$Data == $NewData
    EndIF
    Sleep(1000);pause the program for 1 second so it doesn't over use your processor.
WEnd

 

Now I need it to go onto call _3 if the result of the If statement call_2 is also 0.00 but if the result of the call_3 statement is 7.31 I need it to start back at call_1. If you don't understand I can explain it better because I'm sure I missed some sort of detail out, also thanks for the help so far very much appreciated. Also there can only be two values (like here 0.00 or 2.18) as what the program is asking a question and there are basically two answers every time it asks the question and one will always be 0.00. If the answer is 0.00 it will always go onto the next function for example if I was on call_2 and the answer was 0.00 I need the program to go onto call_3 but if the answer was 7.31 it goes back to call_1. Best explanation I can give. As well as this the program cannot skip call_1/2/3/4 to get to call_5 it has to go through all the call_'s in numerical order until the answer which isn't 0.00 is given then we loop back to call_1

 

 

Edited by Estimize
more info needed

Share this post


Link to post
Share on other sites

How many calls are there going to be? 5? What are the values that you want to call a click function on for these 5 calls? ie there will be click_1() = 2.18  click_2() = 0.00 click_3() =7.31 etc


Get Scite to add a popup when you use a 3rd party UDF -> http://www.autoitscript.com/autoit3/scite/docs/SciTE4AutoIt3/user-calltip-manager.html

Share this post


Link to post
Share on other sites

there will be a max of 10 calls,  and you might have misunderstood, so the program executes call_1 then the result of call_1 which can either be 2.18 or 0.00 decides whether it will move onto call_2 or stay on call_1. the result of call_1 to move onto call_2 is 0.00 but if the result of call_1 is 2.18 then it just repeats call_1. So when it executes call_2 it gets a result back at the end of the function which is either 7.31 or 0.00 if the result is 0.00 it will move onto call_3 but if the result of call_2 was 7.31 then I need it to loop back to call_1 and repeat like that. the numbers are the least relevant bits I think. So if the result of call_1 and 2 and 3 was all 0.00 it moves onto call_4 and if the result of call_4 is  17.16 (that may change in future but it j=should be easily replaced) then the program loops back to call_1 and carries on from there, but if the result of call_4 is 0.00 then it needs to go onto call_5 and so on.

Share this post


Link to post
Share on other sites

You need a while loop where you have 10 + if statements or you need a do while loop or possibly several nested if statements. Really the point of this forum is to help you understand the concept of what you want your script to do and be able to write and modify your own. Are you stuck? Where are you stuck?


Get Scite to add a popup when you use a 3rd party UDF -> http://www.autoitscript.com/autoit3/scite/docs/SciTE4AutoIt3/user-calltip-manager.html

Share this post


Link to post
Share on other sites

You need a while loop where you have 10 + if statements or you need a do while loop or possibly several nested if statements. Really the point of this forum is to help you understand the concept of what you want your script to do and be able to write and modify your own. Are you stuck? Where are you stuck?

The while loop is the bit of program I am stuck on.

 

 

Share this post


Link to post
Share on other sites

See if you can wrap your mind around this. It would help me write more if the info you gave me was correct and complete. What would help me the most would look something like this:

1. 0.00 or 2.18

2. 0.00 or 7.13

3. 0.00 or ?

4. 0.00 or 17.16

There's  a pattern here. Find it. Manipulate it to work for you.

#include <Array.au3>

Function_1();call the main function when the program starts

Func Function1()
    While 1; make a loop to keep the script running inefinately
        GetClipData();get the value of the number
        If $NewData == 2.18 Then
            Action_1()
        EndIf
        If
            $NewData == 0.00 Then
            Function_2()
        EndIF
        Sleep(1000);pause the program for 1 second so it doesn't over use your processor.
WEnd
EndFunc

Func Function_2()
    While 1; make a loop to keep the script running inefinately
        GetClipData();get the value of the number
        If $NewData == 7.13 Then
            Action_1()
            Function_1()
        EndIf
        If
            $NewData == 0.00 Then
            Action_3()
            Function_3()
        EndIF
        Sleep(1000);pause the program for 1 second so it doesn't over use your processor.
    WEnd
EndFunc

Func Function_3()
    While 1; make a loop to keep the script running inefinately
        GetClipData();get the value of the number
        If $NewData == 17.16 Then
            Action_1()
            Function_1()
        EndIf
        If
            $NewData == 0.00 Then
            Action_4()
            Function_4()
        EndIF
        Sleep(1000);pause the program for 1 second so it doesn't over use your processor.
    WEnd
EndFunc

Func GetClipData();get the number copied to the clipboard and then the value declared as a variable
    WinActive("Functions2");You will probably want to use this to make the screen with the text the active window
    Send("^c");Send Ctrl + C to copy the copied text
    sleep(250);I add this to give the computer time to copy the data to the clipboard. It may not be necessary
    $NewData = ClipGet();This will read the clipboard data in windows and set it to the variable $data for comparisons
EndFunc     

Func Action_1()
   Sleep (10000)
   MouseClick("left" , 863, 356) ;Click the X button
   sleep (250)
   MouseClick("left" , 1300, 186) ;Click the X button
   sleep (250)
   MouseClick("left" , 1260, 200) ;Click Amount TextBox
   sleep (250)
   for $x - 1 to 8
      send ("{BACKSPACE down}")
      sleep (100)
      Send("{BACKSPACE up}")
      sleep (100)
   Next ;Clicks Backspace 3 times
   sleep (100)
   Send("1.16") ;Inputs '1' into the amount box
   sleep (250)
   MouseClick("left" , 1245, 512) ;Click Call
   sleep (250)
   MouseClick("Left" , 790, 400)
   sleep (90000)
   MouseClick("right" , 807, 439)
   MouseClick("left" , 860, 665)
   sleep (5000)
   MouseClick("left" , 1001, 296)
   MouseClick("left" , 1012, 309)
   MouseClick("left" , 1046, 351)
   MouseClick("left" , 1046, 351)
EndFunc

Func Action_2()
   Sleep (1000)
   MouseClick("left" , 863, 563) ;Click the X button
   sleep (250)
   MouseClick("left" , 1260, 200) ;Click Amount TextBox
   sleep (250)
   for $x - 1 to 8
      send ("{BACKSPACE down}")
      sleep (100)
      Send("{BACKSPACE up}")
      sleep (100)
   Next ;Clicks Backspace 3 times
   sleep (100)
   Send("3.74") ;Inputs '1' into the amount box
   sleep (250)
   MouseClick("left" , 1245, 512) ;Click Call
   sleep (250)
   MouseClick("Left" , 790, 400)
   sleep (90000)
   MouseClick("right" , 807, 439)
   MouseClick("left" , 860, 665)
   sleep (5000)
   MouseClick("left" , 1001, 296)
   MouseClick("left" , 1012, 309)
   MouseClick("left" , 1046, 351)
   MouseClick("left" , 1046, 351)
EndFunc

 


Get Scite to add a popup when you use a 3rd party UDF -> http://www.autoitscript.com/autoit3/scite/docs/SciTE4AutoIt3/user-calltip-manager.html

Share this post


Link to post
Share on other sites

Thanks so much, I'll try it out for a bit and then get back to you with my progress, really appreciated thanks.

Share this post


Link to post
Share on other sites

what is the action_1 etc meant to represent?

 

 

Share this post


Link to post
Share on other sites

#18 ·  Posted (edited)

Function_1 searches for the number 0.00 and 2.18 then it calls the function action_1 or function_2. 

Object oriented design

1. Get the number.(call the function GetClipData())

2. If the number is 0.00 then Call function_2. If the number is 2.18 run action_1 again. (The if statements in Function_1())

3. In function_2, get the number. If the number is 0.00 then call function_3. If the number is 7.18 then call function_1 (start over).(The if statements in function_2())

etc.

Look at the function_# as the sequence you were describing for the numbers you want to compare. ie Function_1 compares 0.00 and 2.18. Function_2 compares 0.00 and 7.18. Function_3 I was given missing information from you so I dont know what the comparison is. You would make Function_4 to compare 0.00 and 17.16.

 

Edited by computergroove

Get Scite to add a popup when you use a 3rd party UDF -> http://www.autoitscript.com/autoit3/scite/docs/SciTE4AutoIt3/user-calltip-manager.html

Share this post


Link to post
Share on other sites

#19 ·  Posted (edited)

I think I made a mistake in the code above.

Func Function_1();Only the first function needs to use a while loop.
    While 1; make a loop to keep the script running inefinately
        GetClipData();get the value of the number
        If $NewData == 2.18 Then
            Action_1()
        EndIf
        If
            $NewData == 0.00 Then
            Function_2()
        EndIF
        Sleep(1000);pause the program for 1 second so it doesn't over use your processor.
    WEnd
EndFunc

Func Function_2()
    ;you might want to put a sleep here depending on how long it takes for the value to change    
        GetClipData();get the value of the number
        If $NewData == 2.18 Then
            Action_1();your click sequence
            Function_1();restart back at the top (Function_1())
        EndIf
        If
            $NewData == 0.00 Then
            Action_2();Do something because the value is 0.00
            Function_2();Go on to the next function
        EndIF
        Sleep(1000);pause the program for 1 second so it doesn't over use your processor.
EndFunc

 

Edited by computergroove

Get Scite to add a popup when you use a 3rd party UDF -> http://www.autoitscript.com/autoit3/scite/docs/SciTE4AutoIt3/user-calltip-manager.html

Share this post


Link to post
Share on other sites

Are we on track for nested IF statements?  I wonder what the source data represents? And the fact that it can always only be one item from a set of predefined values?  Do these values always increment? Can a value reduce? What are the implications if a wrong choice is made?

Intriguing.


Skysnake

Why is the snake in the sky?

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

  • Similar Content

    • Viki
      By Viki
      This is my first time here so please dont bombard me that what a silly question I am asking!!
      I have 500 rows (A1:A500) in a spreadsheet and I just want to copy one by one row and then paste into another application and then press enter, loop should repeat this until finishes all 500 rows.
      I have looked at clipget(), clip(put() but dont know how to select next row in next turn. I also looked at Array to store but again no luck. Can some guide me please..
    • DineshPawar
      By DineshPawar
      0down votefavorite   In my current project, Excel macro open AutoIt script using a function Call Shell("location of autoit script").
      For proper functioning of AutoIt script it's need to be close parent Excel workbook, so this closing Excel action is written in AutoIt script itself.
      But as soon as AutoIt script close parent Excel workbook then script get pause and it do nothing.
      How open the AutoIt script from Excel workbook and after that parent Workbook get close?
    • AndroidZero
      By AndroidZero
      I want to animate transparent GIFs on my gui.
      I searched, read and tested a lot UDFs
      At the end none fits to me
      I wrote my own animated function, but its flickering sometimes just for a miliseconds but still doesnt looks good.

       
      Below is my code for Testing and also the GIF images you need for it.
      GUIChangeImage() is the Animation Function.
      CODE:
      ;************FOR GATHER HTML SOURCE CODE********************** #include <IE.au3> #include <InetConstants.au3> ;************FOR GUI*********** #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <WinAPIFiles.au3> ;**********FOR BUTTON ********** #include <ButtonConstants.au3> #include <StaticConstants.au3> ;**********FOR STRINGS ********** #include <StringConstants.au3> #include <String.au3> ;**********FOR COMBOBOX ********** #include <StringConstants.au3> #include <EditConstants.au3> #include <GuiEdit.au3> #include <GuiComboBox.au3> ;**********FOR FONTS ********** #include <FontConstants.au3> ;**********FOR GIF ANIMATION ********** #include <GIFAnimation.au3> ;**********FOR PROCESS ********** #include <Process.au3> #include <SendMessage.au3> #include <GDIPlus.au3> #include <WinAPIDiag.au3> Opt("GUIOnEventMode",1) Global Const $SC_DRAGMOVE = 0xF012 Global $hGUIAccountCreator Global $graphics_path = @ScriptDir & "\graphics" Global $fontSize_TextBody = 8.5, $fontName_TextBody = "", $fontWeight_TextBody = $FW_BOLD, $fontColor_TextBody = 0x5A2800 GUI_open_AccountCreator() Func GUI_open_AccountCreator() Global $hGUIAccountCreator = GUICreate("Tibia Account Creator - SubZero", 350, 400, -1, -1, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_TOPMOST)) GUISetOnEvent($GUI_EVENT_CLOSE, "GUI_Close_AccountCreator") GUICtrlCreatePic($graphics_path & "\WindowAccountCreator.gif", 0, 0, 350, 400) GUICtrlSetState(-1, $GUI_DISABLE) ;********* GUI CONTROLS (LABELS,INPUTS,COMBOBOXES) ********************************************************************** GUICtrlCreateLabel(" Create New Account", 25,47,103,14,$SS_CENTERIMAGE) GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) GUICtrlSetFont(-1,8,$fontWeight_TextBody,0,$fontName_TextBody,1) GUICtrlSetColor(-1,0xFFFFFF) GUICtrlCreateLabel("Account Name:",30,75,75,14) GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) GUICtrlSetFont(-1,8,$fontWeight_TextBody,0,$fontName_TextBody,1) GUICtrlSetColor(-1,0x5A2800) Global $inptBox_Acc = GUICtrlCreateInput("",130,75,150,20) GUICtrlCreateLabel("Email Adress:",30,100,70,14) GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) GUICtrlSetFont(-1,8,$fontWeight_TextBody,0,$fontName_TextBody,1) GUICtrlSetColor(-1,0x5A2800) Global $inptBox_Email = GUICtrlCreateInput("",130,100,150,20) GUICtrlCreateLabel("Password:",30,125,55,14) GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) GUICtrlSetFont(-1,8,$fontWeight_TextBody,0,$fontName_TextBody,1) GUICtrlSetColor(-1,0x5A2800) Global $inptBox_Passwd = GUICtrlCreateInput("",130,125,150,20,$ES_PASSWORD) GUICtrlSetData($inptBox_Passwd, "") GUICtrlCreateLabel("Character Name:",30,170,83,14) GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) GUICtrlSetFont(-1,8,$fontWeight_TextBody,0,$fontName_TextBody,1) GUICtrlSetColor(-1,0x5A2800) Global $inptBox_CharName = GUICtrlCreateInput("",130,170,150,20) GUICtrlCreateLabel("Sex:",30,195,23,14) GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) GUICtrlSetFont(-1,$fontSize_TextBody,$fontWeight_TextBody,0,$fontName_TextBody,1) GUICtrlSetFont(-1,8,$fontWeight_TextBody,0,$fontName_TextBody,1) GUICtrlSetColor(-1,$fontColor_TextBody) Global $comboBox_sex = GUICtrlCreateCombo("",130,195,150,20,$CBS_DROPDOWNLIST) ;LoadSexIntoComboBox() GUICtrlCreateLabel("World Location:",30,240,77) GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) GUICtrlSetFont(-1,$fontSize_TextBody,$fontWeight_TextBody,0,$fontName_TextBody,1) GUICtrlSetFont(-1,8,$fontWeight_TextBody,0,$fontName_TextBody,1) GUICtrlSetColor(-1,$fontColor_TextBody) Global $comboBox_world = GUICtrlCreateCombo("",130,240,150,20,BitOr($CBS_DROPDOWNLIST, $WS_VSCROLL)) ;LoadWorldsIntoComboBox() Global $label_status = GUICtrlCreateLabel("",20,360,200,30) GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) ;********* GUI CONTROLS (LABELS,INPUTS,COMBOBOXES) ********************************************************************** ;********* CONTROL PICS ********************************************************************** Global $btn_randAccName = GUICtrlCreatePic($graphics_path & "\Die_Static.gif", 280, 75, 26, 26) GUICtrlSetTip($btn_randAccName, "Generate a random account name") GUICtrlSetCursor($btn_randAccName,0) ;GUICtrlSetOnEvent($btn_randAccName,"GenerateRandomAccName") GUICtrlSetOnEvent($btn_randAccName,"GUIChangeImage") Global $btn_x = GUICtrlCreatePic("", 315, 5, 40, 36) GUICtrlSetTip($btn_x, "Close") GUICtrlSetCursor($btn_x,0) GUICtrlSetOnEvent($btn_x,"GUI_Close_AccountCreator") Global $btn_donate = GUICtrlCreatePic("", 112, 313, 126, 47) GUICtrlSetTip($btn_donate, "Donate") GUICtrlSetCursor($btn_donate,0) ;GUICtrlSetOnEvent($btn_donate,"Donate") ;********* CONTROL PICS ********************************************************************** ;********* GDI+ DRAW ********************************************************************** _GDIPlus_Startup() Local $hImg = _GDIPlus_ImageLoadFromFile($graphics_path & "\X_Tic-Tac-Toe_Token.gif") Local $hHBMP = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImg) _WinAPI_DeleteObject(GUICtrlSendMsg($btn_x, 0x0172, $IMAGE_BITMAP, $hHBMP)) _GDIPlus_ImageDispose($hImg) Local $hImg = _GDIPlus_ImageLoadFromFile($graphics_path & "\Die_Static.gif") Local $hHBMP = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImg) _WinAPI_DeleteObject(GUICtrlSendMsg($btn_randAccName, 0x0172, $IMAGE_BITMAP, $hHBMP)) _GDIPlus_ImageDispose($hImg) Local $hImg = _GDIPlus_ImageLoadFromFile($graphics_path & "\btn_donateCC_LG.gif") Local $hHBMP = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImg) _WinAPI_DeleteObject(GUICtrlSendMsg($btn_donate, 0x0172, $IMAGE_BITMAP, $hHBMP)) _GDIPlus_ImageDispose($hImg) _GDIPlus_Shutdown() ;********* GDI+ DRAW ********************************************************************** _WinAPI_SetLayeredWindowAttributes($hGUIAccountCreator, 0x26f50b) GUISetIcon(@ScriptDir & "\TibiaInfo.ico") GUISetState(@SW_SHOW, $hGUIAccountCreator) WinSetOnTop($hGUIAccountCreator,"",1) GUIRegisterMsg($WM_LBUTTONDOWN, "_WM_LBUTTONDOWN") EndFunc Func GUIChangeImage() _GDIPlus_Startup() GUICtrlDelete($btn_randAccName) Local $btn_randAccName = GUICtrlCreatePic("", 280, 75, 26, 26) Local $hImg = _GDIPlus_ImageLoadFromFile($graphics_path & "\Die_Frame2.gif") Local $hHBMP = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImg) _WinAPI_DeleteObject(GUICtrlSendMsg($btn_randAccName, 0x0172, $IMAGE_BITMAP, $hHBMP)) _GDIPlus_ImageDispose($hImg) _WinAPI_SetLayeredWindowAttributes($hGUIAccountCreator, 0x26f50b) Sleep(100) GUICtrlDelete($btn_randAccName) Local $btn_randAccName = GUICtrlCreatePic("", 280, 75, 26, 26) Local $hImg = _GDIPlus_ImageLoadFromFile($graphics_path & "\Die_Frame3.gif") Local $hHBMP = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImg) _WinAPI_DeleteObject(GUICtrlSendMsg($btn_randAccName, 0x0172, $IMAGE_BITMAP, $hHBMP)) _GDIPlus_ImageDispose($hImg) _WinAPI_SetLayeredWindowAttributes($hGUIAccountCreator, 0x26f50b) Sleep(100) GUICtrlDelete($btn_randAccName) Local $btn_randAccName = GUICtrlCreatePic("", 280, 75, 26, 26) Local $hImg = _GDIPlus_ImageLoadFromFile($graphics_path & "\Die_Frame4.gif") Local $hHBMP = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImg) _WinAPI_DeleteObject(GUICtrlSendMsg($btn_randAccName, 0x0172, $IMAGE_BITMAP, $hHBMP)) _GDIPlus_ImageDispose($hImg) _WinAPI_SetLayeredWindowAttributes($hGUIAccountCreator, 0x26f50b) Sleep(100) GUICtrlDelete($btn_randAccName) Local $btn_randAccName = GUICtrlCreatePic("", 280, 75, 26, 26) Local $hImg = _GDIPlus_ImageLoadFromFile($graphics_path & "\Die_Frame5.gif") Local $hHBMP = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImg) _WinAPI_DeleteObject(GUICtrlSendMsg($btn_randAccName, 0x0172, $IMAGE_BITMAP, $hHBMP)) _GDIPlus_ImageDispose($hImg) _WinAPI_SetLayeredWindowAttributes($hGUIAccountCreator, 0x26f50b) Sleep(100) GUICtrlDelete($btn_randAccName) Local $btn_randAccName = GUICtrlCreatePic("", 280, 75, 26, 26) GUICtrlSetCursor($btn_randAccName,0) GUICtrlSetOnEvent($btn_randAccName,"GUIChangeImage") Local $hImg = _GDIPlus_ImageLoadFromFile($graphics_path & "\Die_Static.gif") Local $hHBMP = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImg) _WinAPI_DeleteObject(GUICtrlSendMsg($btn_randAccName, 0x0172, $IMAGE_BITMAP, $hHBMP)) _GDIPlus_ImageDispose($hImg) _WinAPI_SetLayeredWindowAttributes($hGUIAccountCreator, 0x26f50b) _GDIPlus_Shutdown() EndFunc Func GUI_Close_AccountCreator() Exit EndFunc Func _WM_LBUTTONDOWN($hWnd, $iMsg, $wParam, $lParam) _SendMessage($hGUIAccountCreator, $WM_SYSCOMMAND, $SC_DRAGMOVE, 0) EndFunc While 1 Sleep(10) WEnd  
      IMAGES:
       
       








    • ur
      By ur
      I am maintaining all the reusable code in a separate file as library.au3.
      In that file I have referenced some dependent files using fileinstall, so that they will be extracted when necessary.
       
      Problem is, if I use a function in the library.au3 in another script which doesn't require this dependent file, as I am including the whole file using include tag, it is embedding that file also.
      Is there any way to exclude that.
       
    • GAM
      By GAM
      Am trying to execute perl script from autoit script but its not running. Th command that I have given is...
      $rootDir = automation Run("cmd.exe /" & "C:\" & $rootDir & "\updatesource.pl") Can someone help please!