Jump to content

Is it even possible?


Recommended Posts

it is

look under GUI* in the help file

TCP server and client - Learning about TCP servers and clients connection
Au3 oIrrlicht - Irrlicht project
Au3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related)



460px-Thief-4-temp-banner.jpg
There are those that believe that the perfect heist lies in the preparation.
Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost.

 
Link to comment
Share on other sites

for what?

he did asked if this is posible,

he did not tell anyone what he tryed until now, he did not posted any codes, he did not explaind what he need to do, what script need to do, as far as i see he only posted 'Is it possible to do something like this in AutoIt'?

well it is a lazy request and so i geaved lazy answer. :)

Edit: as for your question

and any suggestions? tips? advices?

GUICreate

GUICtrlCreateEdit

GUICtrlCreateLabel

GUICtrlCreateRadio

Edited by bogQ

TCP server and client - Learning about TCP servers and clients connection
Au3 oIrrlicht - Irrlicht project
Au3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related)



460px-Thief-4-temp-banner.jpg
There are those that believe that the perfect heist lies in the preparation.
Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost.

 
Link to comment
Share on other sites

#include <GUIConstantsEx.au3>

_Main()

Func _Main()
    $display = "go!"
    $hwnd = GUICreate("ManioPing", 140, 115, 200, 200)
    $input = GUICtrlCreateInput("google.com", 10, 10, 120, 20)

    $radio1 = GUICtrlCreateRadio( "beep if ping == 0", 10, 35, 100)
    $radio2 = GUICtrlCreateRadio( "beep if ping <> 0", 10, 55, 100)
    GUISetState(@SW_SHOW)

    While 1
        $msg = GUIGetMsg()
        $ping_input = GUICtrlRead($input)
        $ping = Ping($ping_input)
        GUICtrlCreateLabel($display, 10, 80, 120, 26)
        $display = $ping & " - " & $display
        If $msg = $GUI_EVENT_CLOSE Then ExitLoop
        Sleep(1000)
    WEnd
EndFunc

why I can't close this gui?

any suggestions to improve this?

Edited by maniootek
Link to comment
Share on other sites

#include <WinAPI.au3>
#include <GUIConstantsEx.au3>
AdlibEnable("myadlib",1000)
$display = "go!"

$hwnd = GUICreate("ManioPing", 140, 135, 200, 200)
$input = GUICtrlCreateInput("google.com", 10, 10, 120, 20)
$radio1 = GUICtrlCreateRadio( "beep if ping == 0", 10, 35, 100)
$radio2 = GUICtrlCreateRadio( "beep if ping <> 0", 10, 55, 100)
$button = GUICtrlCreateButton( "reload settings", 10, 110, 100)
GUISetState(@SW_SHOW)
$ping_input = GUICtrlRead($input)

While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
        Case $msg = $button
            $ping_input = GUICtrlRead($input)
    EndSelect
    Sleep(10)
WEnd

Func myadlib()
    $ping = Ping($ping_input)
    GUICtrlCreateLabel($display, 10, 80, 120, 26)
    $display = $ping & " - " & $display
EndFunc

TCP server and client - Learning about TCP servers and clients connection
Au3 oIrrlicht - Irrlicht project
Au3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related)



460px-Thief-4-temp-banner.jpg
There are those that believe that the perfect heist lies in the preparation.
Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost.

 
Link to comment
Share on other sites

  • 2 weeks later...

#include <WinAPI.au3>
#include <GUIConstantsEx.au3>
AdlibEnable("myadlib",1000)
$display = "go!"

$hwnd = GUICreate("ManioPing", 180, 110, 200, 200)
$input = GUICtrlCreateInput("maniootek.com", 10, 10, 100, 20)
$radio1 = GUICtrlCreateRadio( "beep if ping == 0", 10, 35, 100)
$radio2 = GUICtrlCreateRadio( "beep if ping <> 0", 10, 55, 100)
$button = GUICtrlCreateButton("Reload settings", 10, 80, 160, 20)

GUISetState(@SW_SHOW)
GUISetFont(8, 400, "", "Lucida Console")
$ping_input = GUICtrlRead($input)

While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
        Case $msg = $button
            $ping_input = GUICtrlRead($input)
    EndSelect
WEnd

Func myadlib()
    $ping = Ping($ping_input)
    GUICtrlCreateLabel($display, 140, 10, 40, 61)
    $display = $ping & @LF & $display
EndFunc

Now I have no idea how to do with my 2 radios. How to check 6 last ping results and if all of them are == 0 then make a beep. Any suggestions?

Added:

Or how to check if variable which contains string got inside "0,@LF,0,@LF,0,@LF,0,@LF,0,@LF,0,@LF"

Added:

something like function Pos in Pascal

Edited by maniootek
Link to comment
Share on other sites

Another tip:

DON'T use GuiCtrlCreateLabel() inside a loop or an adlib function. All you are doing is creating a control over an existing control. Create the control once in your GUI and then use GUICtrlSetData() to update it.

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

Now I have no idea how to do with my 2 radios. How to check 6 last ping results and if all of them are == 0 then make a beep. Any suggestions?

Added:

Or how to check if variable which contains string got inside "0,@LF,0,@LF,0,@LF,0,@LF,0,@LF,0,@LF"

Added:

something like function Pos in Pascal

#Include <Array.au3>
#include <WinAPI.au3>
#include <GUIConstantsEx.au3>
AdlibEnable("myadlib",1000)
$display = "go!"
Global $avArray[6]
Global $beepstate = 0, $loop = 0
$hwnd = GUICreate("ManioPing", 180, 110, 200, 200)
$input = GUICtrlCreateInput("maniootek.com", 10, 10, 100, 20)
$radio1 = GUICtrlCreateRadio( "beep if 6 ping = 0", 10, 35, 120)
$radio2 = GUICtrlCreateRadio( "beep if 6 ping <> 0", 10, 55, 120)
$button = GUICtrlCreateButton("Reload settings", 10, 80, 160, 20)
$lable = GUICtrlCreateLabel($display, 140, 0, 40, 77)

GUISetState(@SW_SHOW)
GUISetFont(8, 400, "", "Lucida Console")
$ping_input = GUICtrlRead($input)

While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
        Case $msg = $button
            $ping_input = GUICtrlRead($input)
        Case $msg = $radio1 And BitAND(GUICtrlRead($radio1), $GUI_CHECKED) = $GUI_CHECKED
            $beepstate = 1
        Case $msg = $radio2 And BitAND(GUICtrlRead($radio2), $GUI_CHECKED) = $GUI_CHECKED
            $beepstate = 2
    EndSelect
WEnd

Func myadlib()
    $ping = Ping($ping_input)
    _ArrayAdd($avArray, $ping)
    _ArrayDelete($avArray,0)
    GUICtrlSetData($lable,$avArray[0]&@LF&$avArray[1]&@LF&$avArray[2]&@LF&$avArray[3]&@LF&$avArray[4]&@LF&$avArray[5])
    $loop += 1
    If $loop = 6 Then
    Select
        Case $beepstate = 1
            If $avArray[0] = 0 And $avArray[1] = 0 And $avArray[2] = 0 And $avArray[3] = 0 And $avArray[4] = 0 And $avArray[5] = 0 Then Beep(500, 1000)
        Case $beepstate = 2
            If $avArray[0] <> 0 And $avArray[1] <> 0 And $avArray[2] <> 0 And $avArray[3] <> 0 And $avArray[4] <> 0 And $avArray[5] <> 0 Then Beep(500, 1000)
    EndSelect   
    $loop = 0
    EndIf
EndFunc

this will probably work

Edit:

Another tip:

DON'T use GuiCtrlCreateLabel() inside a loop or an adlib function. All you are doing is creating a control over an existing control. Create the control once in your GUI and then use GUICtrlSetData() to update it.

sry 4 that, it whas from my code up there, did not realized that i had done that in there >_<

Edited: to beep on every 6 pings so that yoy can easy exit from program :/

Edited by bogQ

TCP server and client - Learning about TCP servers and clients connection
Au3 oIrrlicht - Irrlicht project
Au3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related)



460px-Thief-4-temp-banner.jpg
There are those that believe that the perfect heist lies in the preparation.
Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost.

 
Link to comment
Share on other sites

@bogQ;

No problem for me but it would have been for the OP.

Also this piece of code

Select
        Case $beepstate = 1
            If $avArray[0] = 0 And $avArray[1] = 0 And $avArray[2] = 0 And $avArray[3] = 0 And $avArray[4] = 0 And $avArray[5] = 0 Then Beep(500, 1000)
        Case $beepstate = 2
            If $avArray[0] <> 0 And $avArray[1] <> 0 And $avArray[2] <> 0 And $avArray[3] <> 0 And $avArray[4] <> 0 And $avArray[5] <> 0 Then Beep(500, 1000)
    EndSelect
;

Could easily be shortened using (untested but should be correct)

Switch $beepstate
        Case 1
            If NOT BitOR($avArray[0],$avArray[1],$avArray[2],$avArray[3],$avArray[4],$avArray[5]) Then Beep(500, 1000)
        Case 2
            If BitOR($avArray[0],$avArray[1],$avArray[2],$avArray[3],$avArray[4],$avArray[5]) Then Beep(500, 1000)
    EndSwitch
;

EDIT: Changed the Select to a Switch

Edited by GEOSoft

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

Sometimes shorter way isnt easy to understand, never the less im gona geave it another shorther spin >_<

While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
        Case $msg = $button
            $ping_input = GUICtrlRead($input)
    EndSelect
WEnd
Func myadlib()
    $ping = Ping($ping_input)
    _ArrayAdd($avArray, $ping)
    _ArrayDelete($avArray,0)
    GUICtrlSetData($lable,_ArrayToString($avArray,@LF, 0, 5))
    $loop += 1
    If $loop = 6 Then
        If Not Number(_ArrayToString($avArray,"", 0, 5)) And GUICtrlRead($radio1) = 1 Then Beep(500, 1000)
        If Number(_ArrayToString($avArray,"", 0, 5)) And GUICtrlRead($radio2) = 1 Then Beep(500, 1000)
    $loop = 0
    EndIf
EndFunc
Edited by bogQ

TCP server and client - Learning about TCP servers and clients connection
Au3 oIrrlicht - Irrlicht project
Au3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related)



460px-Thief-4-temp-banner.jpg
There are those that believe that the perfect heist lies in the preparation.
Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost.

 
Link to comment
Share on other sites

#include <WinAPI.au3>
#include <GUIConstantsEx.au3>
#Include <Array.au3>

AdlibEnable("myadlib",1000)
Global $a[6]
Global $beepstate = 0
Global $loop

$hwnd = GUICreate("ManioPing v1.0", 180, 110, 200, 200)
$input = GUICtrlCreateInput("maniootek.com", 10, 10, 100, 20)
$radio1 = GUICtrlCreateRadio( "beep if 6 ping = 0", 10, 35, 120)
$radio2 = GUICtrlCreateRadio( "beep if 6 ping <> 0", 10, 55, 120)
$button = GUICtrlCreateButton("Reload settings", 10, 80, 160, 20)
$label = GUICtrlCreateLabel("", 140, 0, 40, 77)

GUISetState(@SW_SHOW)
GUISetFont(8, 400, "", "Lucida Console")
$ping_input = GUICtrlRead($input)

While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
        Case $msg = $button
            $ping_input = GUICtrlRead($input)
    EndSelect
WEnd

Func myadlib()
    $ping = Ping($ping_input)
    _ArrayAdd($a, $ping)
    _ArrayDelete($a,0)
    GUICtrlSetData($label,_ArrayToString($a,@LF, 0, 5))
    $loop += 1
    If $loop = 6 Then
        If Not Number(_ArrayToString($a,"", 0, 5)) And GUICtrlRead($radio1) = 1 Then Beep(500, 1000)
        If Number(_ArrayToString($a,"", 0, 5)) And GUICtrlRead($radio2) = 1 Then Beep(500, 1000)
    $loop = 0
    EndIf
EndFunc

That's how looks my script now, thanks for every advices.

Function Ping() has timeout - default 4000 - and when no answer for this time it makes my application dead for while. How to solve this?

Added:

To better explanation just put instead of "maniootek.com" "x.com" (or something that doesn't exist or is wrong) and mark first radio. Now wait for 6 answers and try do something with window (move or something)

Edited by maniootek
Link to comment
Share on other sites

Ping($ping_input,1000);<== recomend from 500-1000

Becose AdlibEnable("myadlib",1000) is working on every second

TCP server and client - Learning about TCP servers and clients connection
Au3 oIrrlicht - Irrlicht project
Au3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related)



460px-Thief-4-temp-banner.jpg
There are those that believe that the perfect heist lies in the preparation.
Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost.

 
Link to comment
Share on other sites

  • 2 months later...

I still have problems with close this application.

I'm doing like this: switching few times radios and then trying to close window and I have to wait few seconds to window disappear ;/

I have tried edit my source but still the same :/

I have no idea

I got something like this:

#include <WinAPI.au3>
#include <GUIConstantsEx.au3>
#Include <Array.au3>

AdlibEnable("myadlib",100)
TraySetState(2)
Global $a[6]
Global $beepstate = 0
Global $loop
Global $msg

$hwnd = GUICreate("MPing v1.0", 180, 110, 200, 200)
$input = GUICtrlCreateInput("onet.pl", 10, 10, 100, 20)
$radio1 = GUICtrlCreateRadio( "beep if 6 ping = 0", 10, 35, 120)
$radio2 = GUICtrlCreateRadio( "beep if 6 ping <> 0", 10, 55, 120)
$button = GUICtrlCreateButton("Reload settings", 10, 80, 160, 20)
$label = GUICtrlCreateLabel("", 140, 0, 40, 77)

GUISetState(@SW_SHOW)
GUISetFont(8, 400, "", "Lucida Console")
$ping_input = GUICtrlRead($input)

while 1
    $ping = Ping($ping_input, 1000)
    _ArrayAdd($a, $ping)
    _ArrayDelete($a,0)
    WinSetTitle($hwnd, "", "[" & $ping & "] MPing v1.0")
    GUICtrlSetData($label,_ArrayToString($a, @LF, 0, 5))
    $loop += 1
    If ((GUICtrlRead($radio1) = 1) or (GUICtrlRead($radio2) = 1)) Then
        if $loop = 6 Then
            If Not Number(_ArrayToString($a,"", 0, 5)) And GUICtrlRead($radio1) = 1 Then 
                Beep(500, 1000) 
            EndIf
            If Number(_ArrayToString($a,"", 0, 5)) And GUICtrlRead($radio2) = 1 Then 
                Beep(500, 1000) 
            EndIf
            $loop = 0
        EndIf
    EndIf
    Sleep(1000)
WEnd

Func myadlib()
    $msg = GUIGetMsg()
    if $msg = $GUI_EVENT_CLOSE Then
        Exit
    EndIf
EndFunc
Link to comment
Share on other sites

I'm not 100% sure but I think your problem has to do with ping not being interruptable. You call the Adlib function 10 times a second so while a ping is running there queue up to 10 calls to the adlib function. The sleep(1000) makes it even worse.

IIRC there are some PING functions being discussed on this forum. Yould you please search for "ping" and see how others have written their scripts?

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

Found another ping script that might be of use for further questions.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

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...