Sign in to follow this  
Followers 0
focksie

Variables ascending return value?!!??!?!

9 posts in this topic

I'm trying to get a tooltip to scroll up and down the screen for an infinite amount of time

this is what I have so far:

$var_1 = 0+1 

Do
ToolTip( "Testy Text", 1200, $var_1, "Testy Text") 
Sleep( 200 )

Until 
GUIGetMsg ()

(This example shows only the descending motion of the tooltip window since the "Until" statement makes it descend forever.)

I'm sure that I don't have a high enough understanding of the declaration of variables to get what I want to happen. Does anyone else have a better idea?

Share this post


Link to post
Share on other sites



I'm trying to get a tooltip to scroll up and down the screen for an infinite amount of time

this is what I have so far:

$var_1 = 0+1 

Do
ToolTip( "Testy Text", 1200, $var_1, "Testy Text") 
Sleep( 200 )

Until 
GUIGetMsg ()

(This example shows only the descending motion of the tooltip window since the "Until" statement makes it descend forever.)

I'm sure that I don't have a high enough understanding of the declaration of variables to get what I want to happen. Does anyone else have a better idea?

$x=0+1 is always equal to 1

I think what you are looking for is $x+=1

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

I'm sure that I don't have a high enough understanding of the declaration of variables to get what I want to happen. Does anyone else have a better idea?

I wonder why the help file of Autoit is used for? (The answer to this might be THE answer to your questions) :blink:

And now the answer to your problem:

#include <GUIConstantsEx.au3>
HotKeySet("{ESC}","_Exit")

_Tool()

Func _Tool()
Local $state = 1;down

While 1
    Sleep(10)
    Switch $state
    Case 1
        For $i=1 To @DesktopHeight
            ToolTip("Here I Go Down...", @DesktopWidth/2, $i,"Tooltip")
            If $i = @DesktopHeight Then ExitLoop
            $state = 0;up
        Next
    Case 0
        For $i = @DesktopHeight To 1 Step -1
            ToolTip("Here I Go Up...", @DesktopWidth/2, $i,"Tooltip")
            If $i = 1 Then ExitLoop
            $state = 1;up
        Next
EndSwitch
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
WEnd
EndFunc
Func _Exit()
    Exit
EndFunc

M.I.

Edited by taietel

Share this post


Link to post
Share on other sites

Hi,

Sorry it's not helpful.

Just for kicks...lol

#include <Date.au3>

HotKeySet("{ESC}", "_Exit")

Global $w = @DesktopWidth - 60, $h = @DesktopHeight - 20, $ex, $ey, $bx, $by

While 1
    Sleep(10)
    If $bx >= $w Then
        $bx = $w
        $ex = "$bx - 3"
    ElseIf $bx <= 0 Then
        $bx = 0
        $ex = "$bx + 3"
    EndIf
    If $by >= $h Then
        $by = $h
        $ey = "$by - 3"
    ElseIf $by <= 0 Then
        $by = 0
        $ey = "$by + 3"
    EndIf
    $bx = Execute($ex)
    $by = Execute($ey)
    ToolTip(_NowTime(), $bx, $by)
WEnd

Func _Exit()
    Exit
EndFunc   ;==>

Share this post


Link to post
Share on other sites

Version 2 of zSmashly's script...

#include <Date.au3>
HotKeySet("{ESC}", "_Exit")
Global $w = @DesktopWidth - 60, $h = @DesktopHeight - 20, $ex, $ey, $bx, $by, $xdir = 3, $ydir = 3

While 1
    Sleep(10)
    If $bx > $w Or $bx < 0 Then $xdir *= -1
    If $by > $h Or $by < 0 Then $ydir *= -1
    $bx += $xdir
    $by += $ydir
    ToolTip(_NowTime(), $bx, $by)
WEnd

Func _Exit()
    Exit
EndFunc   ;==>

Cut half of it out and it would only move along one axis.

Share this post


Link to post
Share on other sites

Slower, crapper, more annoying version3

#include <Date.au3>
HotKeySet("{ESC}", "_Exit")
Global $w = @DesktopWidth - 60, $h = @DesktopHeight - 20, $ex, $ey, $bx = Random(0,@DesktopWidth,1), $by = Random(0,@DesktopHeight,1), $xdir = 3, $ydir = 3
$dll = DllOpen("Kernel32.dll")
While 1
    Sleep(10)
    If $bx > $w Or $bx < 0 Then $xdir *= -1
    If $by > $h Or $by < 0 Then $ydir *= -1
    $bx += $xdir
    $by += $ydir
    ToolTip(_NowTime(), $bx, $by)
    If IsInt($bx/2) Then
    DllCall($dll,"int","Beep","int",$bx+100,"int",90)
    EndIf
WEnd

Func _Exit()
    DllClose($dll)
    Exit
EndFunc   ;==>

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Share this post


Link to post
Share on other sites

Slower, crapper, more annoying version3

... but more fun!!

Share this post


Link to post
Share on other sites

I wonder why the help file of Autoit is used for? (The answer to this might be THE answer to your questions) :blink:

And now the answer to your problem:

#include <GUIConstantsEx.au3>
HotKeySet("{ESC}","_Exit")

_Tool()

Func _Tool()
Local $state = 1;down

While 1
    Sleep(10)
    Switch $state
    Case 1
        For $i=1 To @DesktopHeight
            ToolTip("Here I Go Down...", @DesktopWidth/2, $i,"Tooltip")
            If $i = @DesktopHeight Then ExitLoop
            $state = 0;up
        Next
    Case 0
        For $i = @DesktopHeight To 1 Step -1
            ToolTip("Here I Go Up...", @DesktopWidth/2, $i,"Tooltip")
            If $i = 1 Then ExitLoop
            $state = 1;up
        Next
EndSwitch
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
WEnd
EndFunc
Func _Exit()
    Exit
EndFunc

M.I.

I always try to read about things before I ask about them here...

the problem is that the help file doesn't really speak in sensible terms, where you guys do!

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