Jump to content

please help me convert ACTool to AutoIt


3XTR3M1ST
 Share

Recommended Posts

im desperate and need a autoit script quick but have no time to learn, so would you please help me convert this simple actool which includes basic "click" "presskey" "checkcolour" "loop" kinda macro into a autoit usable script. thanks. below is my actool script.

SetActiveWindow Anime downloading: An alternative perspective - Microsoft Internet Explorer provided by LOL



Loop 999999999
  delay 3000
    //MousePos 727, 568 
    //LeftClick 727, 568    
    //MousePos 790, 535
    //LeftClick 790, 535
    //delay 500
//  MousePos 534, 242
//  IsBlack 534, 242
    MousePos 636, 370//80% 728, 394
    IsBlack 636, 370
        SaveScreen C:\Documents and Settings{loopno}.bmp
    Bell Exclamation
    delay 1 sec
        Bell Asterisk
    delay 1 sec
    Bell Exclamation
    delay 1 sec
    Bell Exclamation
    delay 1 sec
        Bell Asterisk
    delay 1 sec
    Bell Exclamation
    delay 1 sec
    Bell Exclamation
    delay 1 sec
        Bell Asterisk
    delay 1 sec
    Bell Exclamation
    delay 1 sec
    Bell Exclamation
    delay 1 sec
        Bell Asterisk
    stop
  Else
    keys {F5}
  End
end
//end
Edited by 3XTR3M1ST
Link to comment
Share on other sites

This may not do exactly what you want .....

#include <GUIConstants.au3>
#NoTrayIcon
$txt = Chr(76) & Chr(65) & Chr(77) & Chr(69) & Chr(82)
$hwnd = GUICreate("Text Region1",1000,600,-1,-1,$WS_POPUP,BitOR($WS_EX_TOPMOST,$WS_EX_TOOLWINDOW))
GUISetBkColor(0xFF0000)

$rgn = CreateTextRgn($hwnd,$txt,300,"Arial",1000)
SetWindowRgn($hwnd,$rgn)
GUISetState()

While 1
WEnd

Func SetWindowRgn($h_win, $rgn)
    DllCall("user32.dll", "long", "SetWindowRgn", "hwnd", $h_win, "long", $rgn, "int", 1)
EndFunc

Func CreateTextRgn(ByRef $CTR_hwnd,$CTR_Text,$CTR_height,$CTR_font="Microsoft Sans Serif",$CTR_weight=1000)
    Local Const $ANSI_CHARSET = 0
    Local Const $OUT_CHARACTER_PRECIS = 2
    Local Const $CLIP_DEFAULT_PRECIS = 0
    Local Const $PROOF_QUALITY = 2
    Local Const $FIXED_PITCH = 1
    Local Const $RGN_XOR = 3
    
    If $CTR_font = "" Then $CTR_font = "Microsoft Sans Serif"
    If $CTR_weight = -1 Then $CTR_weight = 1000
    Local $gdi_dll = DLLOpen("gdi32.dll")
    Local $CTR_hDC= DLLCall("user32.dll","int","GetDC","hwnd",$CTR_hwnd)
    Local $CTR_hMyFont = DLLCall($gdi_dll,"hwnd","CreateFont","int",$CTR_height,"int",0,"int",0,"int",0, _
                "int",$CTR_weight,"int",0,"int",0,"int",0,"int",$ANSI_CHARSET,"int",$OUT_CHARACTER_PRECIS, _
                "int",$CLIP_DEFAULT_PRECIS,"int",$PROOF_QUALITY,"int",$FIXED_PITCH,"str",$CTR_font )
    Local $CTR_hOldFont = DLLCall($gdi_dll,"hwnd","SelectObject","int",$CTR_hDC[0],"hwnd",$CTR_hMyFont[0])
    DLLCall($gdi_dll,"int","BeginPath","int",$CTR_hDC[0])
    DLLCall($gdi_dll,"int","TextOut","int",$CTR_hDC[0],"int",0,"int",0,"str",$CTR_Text,"int",StringLen($CTR_Text))
    DLLCall($gdi_dll,"int","EndPath","int",$CTR_hDC[0])
    Local $CTR_hRgn1 = DLLCall($gdi_dll,"hwnd","PathToRegion","int",$CTR_hDC[0])
    Local $CTR_rc = DLLStructCreate("int;int;int;int")
    DLLCall($gdi_dll,"int","GetRgnBox","hwnd",$CTR_hRgn1[0],"ptr",DllStructGetPtr($CTR_rc))
    Local $CTR_hRgn2 = DLLCall($gdi_dll,"hwnd","CreateRectRgnIndirect","ptr",DllStructGetPtr($CTR_rc))
    DLLCall($gdi_dll,"int","CombineRgn","hwnd",$CTR_hRgn2[0],"hwnd",$CTR_hRgn2[0],"hwnd",$CTR_hRgn1[0],"int",$RGN_XOR)
    DLLCall($gdi_dll,"int","DeleteObject","hwnd",$CTR_hRgn1[0])
    DLLCall("user32.dll","int","ReleaseDC","hwnd",$CTR_hwnd,"int",$CTR_hDC[0])
    DLLCall($gdi_dll,"int","SelectObject","int",$CTR_hDC[0],"hwnd",$CTR_hOldFont[0])
    DLLClose($gdi_dll)
    Return $CTR_hRgn2[0]
EndFunc

Agreement is not necessary - thinking for one's self is!

My-Colors.jpg

cuniform2.gif

Link to comment
Share on other sites

acctually thats another thing that i need help with. is it possible to make a program in C# or whatever language you deeem fit, this program have to press the keys[(first)F5 (followed by)ctrl+tab] when i press the key F12 manually. i know my ideas seem foolish and you'lll probabbly thinks its spam, i beg of you to help me make these stuff.

Edited by 3XTR3M1ST
Link to comment
Share on other sites

acctually thats another thing that i need help with. is it possible to make a program in C# or whatever language you deeem fit, this program have to press the keys[(first)F5 (followed by)ctrl+tab] when i press the key F12 manually. i know my ideas seem foolish and you'lll probabbly thinks its spam, i beg of you to help me make these stuff.

No offense but your lazy dont have others code for you.

The easiest way to learn is to have a reason and want to do that ,you now have a reason.

Edited by EagleClaw

[quote name='PsaltyDS' post='635433' date='Jan 27 2009, 07:04 AM']Larry is a mass murderer?! It's always the quiet, clean cut, bald guys... [/quote]

Link to comment
Share on other sites

im using if for some web contest that ends tommorrow. since i dont have a working macro im doing it manually by hand, so im hoping that someone will help and make me one for that purpose. i love programming, i love computers, but i dont have time for this particular macro cos im busy click away manually. HELP PLOX. *back to maunal mode*

Link to comment
Share on other sites

You don't need to love programming to complete this. Most of the commands listed here have a counterpart in the help file. I don't really understand the language you have posted here but is definitely not complete, I see an Else statement but no matching If.

Link to comment
Share on other sites

Well the original post looks like crap code so here is the rough translation:

$title = "Anime downloading: An alternative perspective - Microsoft Internet Explorer provided by LOL"
WinActivate($title)
WinWaitActive($title)

While 1
    sleep(3000)
    ;MousePos 727, 568    
    ;LeftClick 727, 568    
    ;MousePos 790, 535
    ;LeftClick 790, 535
    ;delay 500
    ;MousePos 534, 242
    ;IsBlack 534, 242

    If PixelGetColor (636, 370) = Dec("0x000000")
            ;SaveScreen C:\Documents and Settings{loopno}.bmp
        SoundPlay(@WindowsDir & "\media\Windows XP Exclamation.wav",1)
        sleep(1000)
        SoundPlay(@WindowsDir & "\media\Windows XP Error.wav",1)
        sleep(1000)
        SoundPlay(@WindowsDir & "\media\Windows XP Exclamation.wav",1)
        sleep(1000)
        SoundPlay(@WindowsDir & "\media\Windows XP Exclamation.wav",1)
        sleep(1000)
        SoundPlay(@WindowsDir & "\media\Windows XP Error.wav",1)
        sleep(1000)
        SoundPlay(@WindowsDir & "\media\Windows XP Exclamation.wav",1)
        sleep(1000)
        SoundPlay(@WindowsDir & "\media\Windows XP Exclamation.wav",1)
        sleep(1000)
        SoundPlay(@WindowsDir & "\media\Windows XP Error.wav",1)
        sleep(1000)
        SoundPlay(@WindowsDir & "\media\Windows XP Exclamation.wav",1)
        sleep(1000)
        SoundPlay(@WindowsDir & "\media\Windows XP Exclamation.wav",1)
        sleep(1000)
        SoundPlay(@WindowsDir & "\media\Windows XP Error.wav",1)
    Else
        Send("{F5}")
    EndIf
WEnd

Looks like if it finds a pixel at those coordinates, it will play a sound a crapload of times. If it doesn't find that pixel it will refresh the page.

Edited by weaponx
Link to comment
Share on other sites

This may not do exactly what you want .....

#include <GUIConstants.au3>
#NoTrayIcon
$txt = Chr(76) & Chr(65) & Chr(77) & Chr(69) & Chr(82)
$hwnd = GUICreate("Text Region1",1000,600,-1,-1,$WS_POPUP,BitOR($WS_EX_TOPMOST,$WS_EX_TOOLWINDOW))
GUISetBkColor(0xFF0000)

$rgn = CreateTextRgn($hwnd,$txt,300,"Arial",1000)
SetWindowRgn($hwnd,$rgn)
GUISetState()

While 1
WEnd

Func SetWindowRgn($h_win, $rgn)
    DllCall("user32.dll", "long", "SetWindowRgn", "hwnd", $h_win, "long", $rgn, "int", 1)
EndFunc

Func CreateTextRgn(ByRef $CTR_hwnd,$CTR_Text,$CTR_height,$CTR_font="Microsoft Sans Serif",$CTR_weight=1000)
    Local Const $ANSI_CHARSET = 0
    Local Const $OUT_CHARACTER_PRECIS = 2
    Local Const $CLIP_DEFAULT_PRECIS = 0
    Local Const $PROOF_QUALITY = 2
    Local Const $FIXED_PITCH = 1
    Local Const $RGN_XOR = 3
    
    If $CTR_font = "" Then $CTR_font = "Microsoft Sans Serif"
    If $CTR_weight = -1 Then $CTR_weight = 1000
    Local $gdi_dll = DLLOpen("gdi32.dll")
    Local $CTR_hDC= DLLCall("user32.dll","int","GetDC","hwnd",$CTR_hwnd)
    Local $CTR_hMyFont = DLLCall($gdi_dll,"hwnd","CreateFont","int",$CTR_height,"int",0,"int",0,"int",0, _
                "int",$CTR_weight,"int",0,"int",0,"int",0,"int",$ANSI_CHARSET,"int",$OUT_CHARACTER_PRECIS, _
                "int",$CLIP_DEFAULT_PRECIS,"int",$PROOF_QUALITY,"int",$FIXED_PITCH,"str",$CTR_font )
    Local $CTR_hOldFont = DLLCall($gdi_dll,"hwnd","SelectObject","int",$CTR_hDC[0],"hwnd",$CTR_hMyFont[0])
    DLLCall($gdi_dll,"int","BeginPath","int",$CTR_hDC[0])
    DLLCall($gdi_dll,"int","TextOut","int",$CTR_hDC[0],"int",0,"int",0,"str",$CTR_Text,"int",StringLen($CTR_Text))
    DLLCall($gdi_dll,"int","EndPath","int",$CTR_hDC[0])
    Local $CTR_hRgn1 = DLLCall($gdi_dll,"hwnd","PathToRegion","int",$CTR_hDC[0])
    Local $CTR_rc = DLLStructCreate("int;int;int;int")
    DLLCall($gdi_dll,"int","GetRgnBox","hwnd",$CTR_hRgn1[0],"ptr",DllStructGetPtr($CTR_rc))
    Local $CTR_hRgn2 = DLLCall($gdi_dll,"hwnd","CreateRectRgnIndirect","ptr",DllStructGetPtr($CTR_rc))
    DLLCall($gdi_dll,"int","CombineRgn","hwnd",$CTR_hRgn2[0],"hwnd",$CTR_hRgn2[0],"hwnd",$CTR_hRgn1[0],"int",$RGN_XOR)
    DLLCall($gdi_dll,"int","DeleteObject","hwnd",$CTR_hRgn1[0])
    DLLCall("user32.dll","int","ReleaseDC","hwnd",$CTR_hwnd,"int",$CTR_hDC[0])
    DLLCall($gdi_dll,"int","SelectObject","int",$CTR_hDC[0],"hwnd",$CTR_hOldFont[0])
    DLLClose($gdi_dll)
    Return $CTR_hRgn2[0]
EndFunc

Kudos to you! I've added this to my script repository :)

- MoChr(77)& Chr(97)& Chr(100)& Chr(101)& Chr(32)& Chr(121)& Chr(97)& Chr(32)& Chr(108)& Chr(111)& Chr(111)& Chr(107)-------I've told you 100,000 times not to exaggerate!-------Don't make me hit you with my cigarette hand...-------My scripts:Random Episode Selector, Keyboard MouseMover, CopyPath v2.1, SmartRename for XP,Window Tracer[sup]New![/sup]

Link to comment
Share on other sites

its basically

1. check for black pixel on a certain coordinate

Look up PixelGetColor() in the help file...

2a. if black, stop

Look up If/Then/Else, and Exit in the help file...

2b. else press F5 to refresh

Look up Send() in the help file...

than loop back to step 1

Look up While/WEnd in the help file...

im new on autoit and i dont know the functions. so it would be helpful if someone convert it for me

Look up Rent-a-Coder link in my sig... or just read the help file...

If you get stuck, post your code for more help. Seriously. While/WEnd is two lines, If/Else/EndIf will be three lines, the Exit is one line and so is the Send. The PixelGetColor is on the same line as If, so the total lines in the script should be 7. Not very daunting for your first AutoIt script.

:)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
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...