Sign in to follow this  
Followers 0
Heron

New member

10 posts in this topic

Hello fellow autoitters,

I'm a new member because I wanted to show my first AutoIT project and get your feedback. It's a launcher/macro tool like KeyBreeze and Launchy but able to run AutoIT macro's.

But now I've to post 5 messages first...

I have fallen in love with AutoIT a few month ago and like it very much because of the simplicity and fun factor of it. Also I'm enjoying the helpfull and respectfull atmosphere of this forum.

Ok, 4 posts more to go :D

Share this post


Link to post
Share on other sites



WELCOME to the forums...

lol

Share this post


Link to post
Share on other sites

WELCOME to the forums...

lol

Well, thanks

And a question at the same time: is there a IE for AutoIT that you could recommend? Now I use SciTE, it's ok but I miss a debug facility.

Share this post


Link to post
Share on other sites

Well, thanks

.. Now I use SciTE, it's ok but I miss a debug facility.

Debugging is something that would have to be supported by AutoIt3 internally. using another IDE will not help much.

I have added some LUA functionality that allow for easy Debugging/Tracing by means of adding Consolewrite statements.

The FULL installer of SciTE4AutoiT3 is required for this.

Jos


Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

Debugging is something that would have to be supported by AutoIt3 internally. using another IDE will not help much.

I have added some LUA functionality that allow for easy Debugging/Tracing by means of adding Consolewrite statements.

The FULL installer of SciTE4AutoiT3 is required for this.

Jos

Thanks Jos for your reply. I saw a IDE in VB some time ago but i think it uses a kind of trick indeed to simulate debugging functionality. I was thinking of making a function myself that would allow for executing manually entered statements in the middle of a program. That way you could watch the value of a variable or even assign a value to an application value. Is there already made such an approach that you know of? (before inventing the wheel again)

Share this post


Link to post
Share on other sites

Thanks Jos for your reply. I saw a IDE in VB some time ago but i think it uses a kind of trick indeed to simulate debugging functionality. I was thinking of making a function myself that would allow for executing manually entered statements in the middle of a program. That way you could watch the value of a variable or even assign a value to an application value. Is there already made such an approach that you know of? (before inventing the wheel again)

Yeap, there is a debugger made by Stumpii in the Examples forum that does something like that.

http://www.autoitscript.com/forum/index.php?showtopic=21834


Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

Hey,

I'm new here to the forum also and am also trying to get 5 posts so I can post my first program and get some feedback. I created an ICMP messenger using Nicolas Ricquemaque's Winpcap udf.

http://www.autoitscript.com/forum/index.ph...st&p=667070

Here's the code if anyone wants to look at it before I am able to post it on the example scripts forum.

CODE
#Include <Array.au3>

#include <GUIConstants.au3>

#Include <GuiEdit.au3>

#Include <EditConstants.au3>

#include <WindowsConstants.au3>

#include <Constants.au3>

#include <GuiIPAddress.au3>

#include <String.au3>

#include <ComboConstants.au3>

#include <GDIPlus.au3>

#include <Winpcap.au3>

; GUI

$GUI = GuiCreate("ICMP Messenger", 410, 290, -1, -1, -1, $WS_EX_TOOLWINDOW+$WS_EX_TOPMOST)

; MENU's

$filemenu = GuiCtrlCreateMenu("File")

$aboutmenu = GuiCtrlCreateMenu("About")

; File Menu

$Broadcastmenu = GuiCtrlCreateMenuItem("Set IP to Broadcast Address", $filemenu)

$Quitmenu = GuiCtrlCreateMenuItem("Quit", $filemenu)

; About Menu

$aboutmenuselect = GuiCtrlCreateMenuItem("About", $aboutmenu)

; CONTEXT MENU

$contextMenu = GuiCtrlCreateContextMenu()

GuiCtrlCreateMenuItem("Context Menu", $contextMenu)

GuiCtrlCreateMenuItem("", $contextMenu)

GuiCtrlCreateMenuItem("&Properties", $contextMenu)

; CTRLS

$IP = _GUICtrlIpAddress_Create($GUI,85,5,135,23)

GUICtrlCreateLabel ( "Send To IP :", 20, 9, 60)

GUICtrlSetFont(-1,8)

GUICtrlSetBkColor(-1, 0x000000)

GUICtrlSetColor(-1, 0xC4C4C4)

$message = GUICtrlCreateEdit("", 20, 75, 370, 140, $ES_MULTILINE + $ES_READONLY + $WS_VSCROLL)

GUICtrlSetBkColor(-1, 0x000000)

GUICtrlSetColor(-1, 0xC4C4C4)

$text = GuiCtrlCreateInput("", 20, 230, 300, 20)

GUICtrlSetBkColor(-1, 0x000000)

GUICtrlSetColor(-1, 0xC4C4C4)

GUISetBkColor(0x000000)

GUISetFont(9, 400, 0, "Tahoma")

WinSetTrans("ICMP Messenger", "", 230)

$start = GUICtrlCreateButton ( "Start", 250, 5, 60)

GUICtrlSetBkColor(-1, 0x000000)

GUICtrlSetColor(-1, 0xC4C4C4)

$stop = GUICtrlCreateButton ( "Stop", 330, 5,60)

GUICtrlSetBkColor(-1, 0x000000)

GUICtrlSetColor(-1, 0xC4C4C4)

$send = GUICtrlCreateButton ( "Send", 330, 227,60)

GUICtrlSetBkColor(-1, 0x000000)

GUICtrlSetColor(-1, 0xC4C4C4)

$winpcap=_PcapSetup()

If ($winpcap=-1) Then

MsgBox(16,"Pcap error !","WinPcap not found !")

exit

EndIf

$pcap_devices=_PcapGetDeviceList()

If ($pcap_devices=-1) Then

MsgBox(16,"Pcap error !",_PcapGetLastError())

exit

EndIf

GUICtrlCreateLabel ( "Interface :", 20, 45, 60)

GUICtrlSetFont(-1,8)

GUICtrlSetBkColor(-1, 0x000000)

GUICtrlSetColor(-1, 0xC4C4C4)

$interface=GUICtrlCreateCombo("", 85, 42, 305,default,$CBS_DROPDOWNLIST)

GUICtrlSetBkColor(-1, 0x000000)

GUICtrlSetColor(-1, 0xC4C4C4)

For $i = 0 to Ubound($pcap_devices)-1

GUICtrlSetData(-1, $pcap_devices[$i][1])

Next

GUISetState()

$i=0

$pcap=0

$packet=0

$pcapfile=0

Global $MACS[500]

Opt("GuiOnEventMode", 1)

GUICtrlSetOnEvent($start,"Start")

GUICtrlSetOnEvent($stop,"Stop")

GUICtrlSetOnEvent($text, "Packetize")

GUICtrlSetOnEvent($send,"Packetize")

HotKeySet("{Enter}","Packetize")

GUICtrlSetOnEvent($aboutmenuselect,"About")

GUISetOnEvent($GUI_EVENT_CLOSE, "Quit")

GUICtrlSetOnEvent($broadcastmenu, "SetBroadcast")

GUICtrlSetOnEvent($Quitmenu,"Quit")

While 1

$ICMPmessage = ""

If IsPtr($pcap) Then ; If $pcap is a Ptr, then the capture is running

$time0=TimerInit()

While (TimerDiff($time0)<500) ; Retrieve packets from queue for maximum 500ms before returning to main loop, not to "hang" the window for user

$packet=_PcapGetPacket($pcap)

If IsInt($packet) Then ExitLoop

If IsArray($packet) = 1 Then

$ICMPmessage = evalPacket($packet[3])

EndIf

If $ICMPmessage <> "" Then

_GUICtrlEdit_AppendText($message, $ICMPmessage & @CRLF)

EndIf

Wend

EndIf

WEnd

Func evalPacket($data) ; Quick example packet dissector....

Local $macdst=StringMid ($data,3,2)&":"&StringMid ($data,5,2)&":"&StringMid ($data,7,2)&":"&StringMid ($data,9,2)&":"&StringMid ($data,11,2)&":"&StringMid ($data,13,2)

Local $macsrc=StringMid ($data,15,2)&":"&StringMid ($data,17,2)&":"&StringMid ($data,19,2)&":"&StringMid ($data,21,2)&":"&StringMid ($data,23,2)&":"&StringMid ($data,25,2)

Local $ethertype=BinaryMid ( $data, 13 ,2 )

If $ethertype="0x0800" Then

Local $src=Number(BinaryMid ($data, 27 ,1))&"."&Number(BinaryMid ($data, 28 ,1))&"."&Number(BinaryMid ($data, 29 ,1))&"."&Number(BinaryMid ($data, 30 ,1))

Local $dst=Number(BinaryMid ($data, 31 ,1))&"."&Number(BinaryMid ($data, 32 ,1))&"."&Number(BinaryMid ($data, 33 ,1))&"."&Number(BinaryMid ($data, 34 ,1))

Switch BinaryMid ($data, 24 ,1)

Case "0x01" ; Match ICMP Packet

$got = StringTrimLeft($data,86)

If StringLeft($got,36) = "3C69636D704D657373656E676572312E303E" Then ; If Matches <icmpMessenger1.0>

$cutcode = _HexToString(StringTrimLeft($got,36))

If $cutcode <> "" Then

return $src & ": " & $cutcode

EndIf

EndIf

EndSwitch

EndIf

return ""

EndFunc

Func Packetize()

If _GUICtrlIpAddress_IsBlank($IP) <> True Then

$sip = StringSplit(@IPAddress1,".")

$dip = _GUICtrlIpAddress_GetArray($IP)

;Ethernet Header

$etherHeader = GetDestinationMac(_GUICtrlIpAddress_Get($IP)) ;Destination Mac

$etherHeader &= GetLocalMac(@IPAddress1) ;Source Mac

$etherHeader &= "0800" ;Protocol

;IP Header

$ipHeader = "45" ;Version / Header Length

$ipHeader &= "00" ;Type of Service

$ipHeader &= "003c" ;Length

$ipHeader &= "00a5" ;Identification

$ipHeader &= "0000" ;Flags / Fragment offset

$ipHeader &= "80" ;Time to Live

$ipHeader &= "01" ;Protocol

$ipHeader &= "0000" ;IP Checksum

$ipHeader &= hex($sip[1],2) & hex($sip[2],2) & hex($sip[3],2) & hex($sip[4],2) ;Source IP Address

$ipHeader &= hex($dip[0],2) & hex($dip[1],2) & hex($dip[2],2) & hex($dip[3],2) ;Destination IP Address

;ICMP Header

$icmpHeader = "08" ;Type

$icmpHeader &= "00" ;Code

$icmpHeader &= "0000" ;ICMP Checksum

$icmpHeader &= "0200" ;ID

$icmpHeader &= "0100" ;Sequence number

;Data

$data = _StringToHex("<icmpMessenger1.0>")

$data &= _StringToHex(GUICtrlRead($text))

;Create Packet

$packet = $etherHeader & $ipHeader & $icmpHeader & $data

;Send Packet

$success = _PcapSendPacket($pcap,_HexToString($packet))

If $pcap = 0 Then

_GUICtrlEdit_AppendText($message, "Error: Please Start Messenger." & @CRLF)

Else

Clear()

EndIf

Else

_GUICtrlEdit_AppendText($message, "Error: Please enter an IP Address to send messages to." & @CRLF)

EndIf

EndFunc

Func Start()

$prom=0

$int=""

If (GUICtrlRead($interface)="Pcap capture file") Then

$file=FileOpenDialog ( "Pcap file to open ?", ".", "Pcap (*.pcap)|All files (*.*)" ,1 )

$int="file://"&$file

Else

For $n = 0 to Ubound($pcap_devices)-1

If $pcap_devices[$n][1]=GUICtrlRead($interface) Then

$int = $pcap_devices[$n][0]

EndIf

Next

EndIf

$pcap=_PcapStartCapture($int,"",$prom)

If ($pcap=-1) Then

_GUICtrlEdit_AppendText($message, "Error: " & _PcapGetLastError() & @CRLF)

Else

$linktype=_PcapGetLinkType($pcap)

If ($linktype[1]<>"EN10MB") Then

_GUICtrlEdit_AppendText($message, "Error: This example only works for Ethernet captures." & @CRLF)

Endif

GUICtrlSetState ($stop, $GUI_ENABLE)

GUICtrlSetState ($start, $GUI_DISABLE)

_GUICtrlEdit_AppendText($message, "----------------------------------------------------------------------------------------------------" & @CRLF)

_GUICtrlEdit_AppendText($message, "Session Started: " & @Hour & ":" & @Min & " - " & @MON & "/" & @MDAY & "/" & @YEAR & @CRLF)

_GUICtrlEdit_AppendText($message, "----------------------------------------------------------------------------------------------------" & @CRLF)

EndIf

EndFunc

Func Stop()

If $pcap <> -1 Then

_PcapStopCapture($pcap)

$pcap=-1

GUICtrlSetState ($stop, $GUI_DISABLE)

GUICtrlSetState ($start, $GUI_ENABLE)

_GUICtrlEdit_AppendText($message, "----------------------------------------------------------------------------------------------------" & @CRLF)

_GUICtrlEdit_AppendText($message, "Session Ended: " & @Hour & ":" & @Min & " - " & @MON & "/" & @MDAY & "/" & @YEAR & @CRLF)

_GUICtrlEdit_AppendText($message, "----------------------------------------------------------------------------------------------------" & @CRLF)

EndIf

EndFunc

Func GetDestinationMac($ip)

$Pos = _ArraySearch($MACS, $ip, 0, 0, 0, True)

If $Pos <> -1 Then

$split = StringSplit($MACS[$Pos],"|")

return $split[2]

Else

Ping($ip)

$foo = Run(@ComSpec & " /c arp -g " & $ip, @SystemDir, @SW_HIDE, $STDOUT_CHILD)

While 1

$line = StdoutRead($foo)

If $line <> "" Then

$split = StringSplit($line,$ip,1)

$strip = StringLeft(StringStripWS($split[2],8),17)

$mac = StringReplace($strip,"-","")

return $mac

EndIf

WEnd

EndIf

EndFunc

Func GetLocalMac($ip)

$Pos = _ArraySearch($MACS, $ip, 0, 0, 0, True)

If $Pos <> -1 Then

$split = StringSplit($MACS[$Pos],"|")

return $split[2]

Else

$foo = Run(@ComSpec & " /c nbtstat -A " & $ip, @SystemDir, @SW_HIDE, $STDOUT_CHILD)

While 1

$line = StdoutRead($foo)

If $line <> "" Then

$mac = StringSplit($line,"MAC Address = ",1)

If $mac[0] <> 1 Then

$mac = StringStripWS(StringReplace($mac[2],"-",""),8)

_ArrayAdd($MACS, $ip & "|" & $mac)

return $mac

EndIf

EndIf

WEnd

EndIf

EndFunc

Func Clear()

GUICtrlSetData($text, "")

EndFunc

Func SetBroadcast()

_GUICtrlIpAddress_Set($IP,_BroadcastIP())

EndFunc

Func Quit()

Exit

EndFunc

Func About()

Opt("GuiOnEventMode", 0)

GUISetState(@SW_DISABLE,$GUI)

$AboutGUI = GUICreate("ABOUT ICMP Messenger", 410, 350,-1,-1,-1,-1,$GUI)

$hWnd = WinGetHandle("ABOUT ICMP Messenger")

WinSetTrans("ABOUT ICMP Messenger", "", 230)

GUISetState(@SW_SHOW)

;Create Monkey

_GDIPlus_Startup ()

$Graphic = _GDIPlus_GraphicsCreateFromHWND ($hWnd)

FileInstall("C:\monkey.gif", @scriptdir&"\monkey.gif",0)

$ParticleBitmap = _GDIPlus_BitmapCreateFromFile(@scriptdir & "\monkey.gif")

_AntiAlias($Graphic, 4)

_GDIPlus_GraphicsDrawImageRect($Graphic, $ParticleBitmap, 0, 0, 410, 350)

_GDIPlus_GraphicsFillEllipse ($Graphic, 206 , 168, 4, 7)

_GDIPlus_GraphicsFillEllipse ($Graphic, 216 , 168, 4, 7)

;End Create Monkey

$lastPos = MouseGetPos()

While 1

$mp = MouseGetPos()

$newx = $mp[0]

$newy = $mp[1]

If $newx <> $lastpos[0] Or $newy <> $lastpos[1] Then

$winPos = WinGetPos("ABOUT ICMP Messenger")

$eyeXlocation = $winPos[0] + 251

$eyeYlocation = $winPos[1] + 233

$percentx = (($newx - $eyeXlocation) / @DesktopWidth)

$percenty = (($newy - $eyeYlocation) / @DesktopHeight)

$positionx = Int(5*$percentx)

$positiony = Int(4*$percenty)

_GDIPlus_GraphicsDrawImageRect($Graphic, $ParticleBitmap, 0, 0, 410, 350)

If $positionx = 0 Then

_GDIPlus_GraphicsFillEllipse ($Graphic, 216+$positionx, 168+$positiony, 4, 7)

$positionx +=1

_GDIPlus_GraphicsFillEllipse ($Graphic, 206+$positionx, 168+$positiony, 4, 7)

Else

_GDIPlus_GraphicsFillEllipse ($Graphic, 216+$positionx, 168+$positiony, 4, 7)

_GDIPlus_GraphicsFillEllipse ($Graphic, 206+$positionx, 168+$positiony, 4, 7)

EndIf

EndIf

$lastPos[0] = $newx

$lastPos[1] = $newy

$msg = GUIGetMsg()

If $msg = $GUI_EVENT_CLOSE Then

ExitLoop

EndIf

sleep(20)

Wend

Opt("GuiOnEventMode", 1)

_GDIPlus_BitmapDispose($ParticleBitmap)

_GDIPlus_GraphicsDispose ($Graphic)

_GDIPlus_Shutdown()

GUIDelete($AboutGUI)

GUISetState(@SW_ENABLE,$GUI)

EndFunc

Func _SubnetMask($strIP = @IPAddress1)

Local $strEnumKey, $nEnum

Local $strKey = "HKLM\SYSTEM\CurrentControlSet\" & _

"Services\Tcpip\Parameters\Interfaces\"

While 1

$nEnum += 1

$strEnumKey = RegEnumKey($strKey, $nEnum)

If @error <> 0 Then ExitLoop

If RegRead($strKey & $strEnumKey, "DhcpIPAddress") = $strIP Then

Return RegRead($strKey & $strEnumKey, "DhcpSubnetMask")

EndIf

WEnd

Return SetError(1, 0, 0)

EndFunc

Func _BroadcastIP()

$submask = _SubnetMask()

$split_sub = stringsplit($submask,".")

$split_ip = stringsplit(@IPAddress1,".")

$Broadcast = ""

If $split_sub[1] <> 0 Then

for $i = 1 to 4

$Broadcast &= "."&bitOR((255-$split_sub[$i]),$split_ip[$i])

next

Else

return -1

EndIf

$Broadcast = stringmid($Broadcast,2)

return $Broadcast

Endfunc

Func _AntiAlias($Graphics, $iMode)

Local $aResult

$aResult = DllCall($ghGDIPDll, "int", "GdipSetSmoothingMode", "hwnd", $Graphics, "int", $iMode)

If @error Then Return SetError(@error, @extended, False)

Return SetError($aResult[0], 0, $aResult[0] = 0)

EndFunc

I've been programming for less than a year so if you have any suggestions at all I would love to hear them.

And if you have any suggestions on a quick way to get these five posts out of the way, I would love to hear those also.

Thanks for your time,

Disabled Monkey

Share this post


Link to post
Share on other sites

Hey,

I'm new here to the forum also and am also trying to get 5 posts so I can post my first program and get some feedback. I created an ICMP messenger using Nicolas Ricquemaque's Winpcap udf.

http://www.autoitscript.com/forum/index.ph...st&p=667070

Here's the code if anyone wants to look at it before I am able to post it on the example scripts forum.

I've been programming for less than a year so if you have any suggestions at all I would love to hear them.

And if you have any suggestions on a quick way to get these five posts out of the way, I would love to hear those also.

Thanks for your time,

Disabled Monkey

Tried your code but haven't installed winpcap yet so it quited early. What is de GDI+ stuff for? Is it a graphical representation of traffic?

(I reached 5 posts already. It's easy :-)

Share this post


Link to post
Share on other sites

Tried your code but haven't installed winpcap yet so it quited early. What is de GDI+ stuff for? Is it a graphical representation of traffic?

(I reached 5 posts already. It's easy :-)

GDI+ stuff is for the about page, which won't really look any good without the Monkey.gif, which I forgot to upload.

Here's the picture if your going to try it out.

post-48418-1239473180_thumb.gif

The about page is just a picture of a monkey with it's eye's following the mouse, that's why I needed GDI+.

Five posts does seem fairly simple, I just hate to spam random topics that I am not interested in and have no good comments or thoughts on.

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