Jump to content

custom border, mouse to fast for it?


 Share

Recommended Posts

hey.. ive been creating a little "Addon" type thing for windows xp home... (lol, maybe ill just say program, because it probably wont be anything close to an addon :huh:) and ive been using josbe's great test AxWindow style.. ive got all the controls right, like the cut, exit, minimize... except the custom border is a label, and basically, ive used josbes structure of his code for like the $x_offset etc... and stuff... but when i click the label (custom border), then the window moves with the mouse until the border is pressed again, but moving it too fast, causes the mouse to be on the desktop, and not the border... but in the AxWindow demo, that doesnt happen, could anyone spot whats wrong here please?!?! thanks a milllion! :(:D

; ----------------------------------------------------------------------------
;
; AutoIt Version: 3.1.0
; Author:        Ryan <rpm91m@gmail.com>
;
; Script Function: Command line for the Windows XP Home Edition Speedy plugin
;   Template AutoIt script.
;
; ----------------------------------------------------------------------------

; Script Start - Add your code below here
; many thanks for Josbe for posting a WONDERFUL example on www.autoscript.com/forum/index.php? on making cool and stylish GUI's! :D
Global $iscut = 0
Opt("WinWaitDelay",20); If the value is less, it's more easy to move the window.
Opt("GuiResizeMode",800);
Local $move = 0,$offset

;gui variables
$WS_POPUP=0x80000000
$WS_BORDER=0x00800000
$BS_FLAT=32768

$hWnd = GUICreate("SpeedyCmdLine", 400, 100, -1, -1,$WS_POPUP+$WS_BORDER)
$border = GUICtrlCreateLabel(@ScriptDir, 0, 0, 340, 18)
GuiCtrlSetResizing($border,"")
GUICtrlSetCursor($border, 9)
GUICtrlSetBkColor($border, 0x00FF00)
$cmd = GUICtrlCreateInput("", 5, 50, 290, 20)
$exec = GUICtrlCreateButton("Exec", 300, 48, 50)
GUICtrlSetTip($exec, "Execute command")
$close = GUICtrlCreateButton("X", 380, 0, 20, 20, $BS_FLAT)
GUICtrlSetTip($close, "Exit")
$min = GUICtrlCreateButton("V", 360, 0, 20, 20, $BS_FLAT)
GUICtrlSetTip($min, "Minimize")
$cut = GUICtrlCreateButton("^", 340, 0, 20, 20, $BS_FLAT)
GUICtrlSetTip($cut, "Cut window")
GUISetState(@SW_SHOW, $hWnd)
While 1
    $get = GUIGetMsg()
    If $get = $close then Exit
        If $get = $min then GUISetState(@SW_MINIMIZE, $hWnd)
            If $get = $cut Then
                If $iscut = 0 Then
                Opt("WinWaitDelay",1)
                $winpos = WinGetPos($hWnd)
                $iscut = 1
                For $i = 100 to 20 step -1
                WinMove($hWnd, "", $winpos[0], $winpos[1], 400, $i)
            Next
        ElseIf $iscut = 1 Then
            $winpos = WinGetPos($hWnd)
            $iscut = 0
            For $n = 20 to 100 step 1
                WinMove($hWnd, "", $winpos[0], $winpos[1], 400, $n)
                Next
            EndIf
        EndIf
        If $move Then
            $mousepos = MouseGetPos()
            WinMove($hWnd, "", $mousepos[0] + $x_offset, $mousepos[1] + $y_offset)
            EndIf
        If $get = $border then $move = Not $move
            If $move Then
            $mousepos = MouseGetPos()
            $winpos = WinGetPos($hWnd)
            $x_offset = $winpos[0] - $mousepos[0]
            $y_offset = $winpos[1] - $mousepos[1]
            EndIf
    WEnd

PS, its not done yet... :):D

thanks!

FootbaG
Link to comment
Share on other sites

doh! i had that file on my hardrive, because i thought it was an excellent example! :) well, thanks for trying! but what exactyle happened when you ran the script, you mean you couldnt run it at all? it gave you an error? id like to know... hmmm... im gonna take a loot at the WinMove.au3 right now... thanks, ill post back if i find the answer!

FootbaG
Link to comment
Share on other sites

eh, while im at it... i rember someone posted in Chat a long time ago, about how we could execute commands from the command prompt, and im pretty sure you were the one with the nice example (again;)), or it could have been this-is-me, but instead of starting a new thread, ill ask in here...

how do i execute an autoit command from command line, or like batch file, this is how i would write a batch file for it...

cd C:\Program Files\AutoIt3\AutoIt3.exe
autoit3.exe "msgbox(0, 'test', 'haha')

but apparently, that doesnt work... ive tried the @ComSpec macro, ive tried _RunDOS... im not so good with using the command line with autoit, suggestions?

FootbaG
Link to comment
Share on other sites

I cleaned up your script using Tidy and then I tried to make it work.

In the end it didn't even move, so I gave up.

ABout your other thing

These both work.

Run('C:\Program Files\AutoIt3\AutoIt3.exe /c "msgbox(0, ''test'', ''haha'')"')

or

RunWait('C:\Program Files\AutoIt3\AutoIt3.exe /c "msgbox(0, ''test'', ''haha'')"')
Link to comment
Share on other sites

what about the new stdin/out functions wouldn't those make it so you could read output too?

[font="Times"] If anyone remembers me, I am back. Maybe to stay, maybe not.----------------------------------------------------------------------------------------------------------[/font][font="Times"]Things I am proud of: Pong! in AutoIt | SearchbarMy website: F.R.I.E.S.A little website that is trying to get started: http://thepiratelounge.net/ (not mine)[/font][font="Times"] ----------------------------------------------------------------------------------------------------------[/font][font="Arial"]The newbies need to stop stealing avatars!!! It is confusing!![/font]

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