Jump to content

Pangaea Ruler


rakudave
 Share

Recommended Posts

This is very nice and thanks for sharing it :P

Regards

--------------------------------------------------------------------------------------------------------------------------------Scripts : _Encrypt UDF_UniquePCCode UDF MS like calculatorInstall programm *UPDATED* --------------------------------------------------------------------------------------------------------------------------------[quote name='Helge' post='213117' date='Jul 26 2006, 10:22 AM']Have you ever tried surfing the internet with a milk-carton ?This is similar to what you're trying to do.[/quote]

Link to comment
Share on other sites

I would like to see this included in an updated version of SciTE

[quote name='DaleHohm']You have a strange habit of posting error messages that don't match your code.[/quote][quote name='SmOke_N']Forget the learning... straight to the scripting :lol: (laugh.gif)[/quote]

Link to comment
Share on other sites

Just wondering if this is still under developement?

[quote name='DaleHohm']You have a strange habit of posting error messages that don't match your code.[/quote][quote name='SmOke_N']Forget the learning... straight to the scripting :lol: (laugh.gif)[/quote]

Link to comment
Share on other sites

  • 1 month later...

I know you said your still working on it but its been a while and i thought you may have forgotten about it, I would love to see some useful improvements to this wonderful script.

[quote name='DaleHohm']You have a strange habit of posting error messages that don't match your code.[/quote][quote name='SmOke_N']Forget the learning... straight to the scripting :lol: (laugh.gif)[/quote]

Link to comment
Share on other sites

This would be great for integration into scripts where a window may be different dimensions for different computers. If you can turn it into a function that would return an array of coords, I'd use it in just about any script I make.

Something like:

$win = SelectAreaGUI()

Your GUI would pop up, the user can set the dimensions, hit "save"...

$win would then have 4 values. Top left X, top left Y, bottom right X, bottom right Y.

That would then be the window that the script would run a PixelSearch or something similar.

Awesome script.

:lmao:

Link to comment
Share on other sites

I have redone this script, I hope you dont mind :lmao:

I didnt have time to go through the whole script but i made some major changes to the _draw function. and added option to enter major mid and minor axis and an option to view a real ruler. please not that for the real ruler to have the correct length you would need to measure how many pixels one inch is on the screen and change the variable value $dpi to it. Next time you read on the internet that the worlds smallest dog is 11.94cm high you can visualize the size on your screen.

#include <GUIConstants.au3>

Global $oldwidth = 500, $oldheight = 100, $ontop = 1
$minInter=5
$midInter=10
$MaxInter=20


;$dpi = RegRead("HKEY_CURRENT_USER\Control Panel\Desktop\WindowMetrics", "AppliedDPI") 

$dpi=88

AutoItSetOption("GUIResizeMode",802)
$main = GUICreate("Pangaea_Ruler",500,100,-1,-1,$WS_POPUP + $WS_SIZEBOX)

$Button_1 = GUICtrlCreateButton ("Pixels",  180, 60, 100)
$Button_2 = GUICtrlCreateButton ( "Inches", 280, 60)
$Button_3 = GUICtrlCreateButton ( "Cm",  325, 60)
$MinInput=GUICtrlCreateInput ( "5",240,30 )
$MidInput=GUICtrlCreateInput ( "10",210,30 )
$MaxIntput=GUICtrlCreateInput ("20",180,30)

    GUICtrlCreateLabel("",28,28,32,20,$SS_BLACKFRAME,$GUI_WS_EX_PARENTDRAG)
    $quit = GUICtrlCreateLabel("",133,28,32,20,$SS_BLACKFRAME + $SS_NOTIFY)
    GUICtrlCreateLabel("move",30,30,28,20,$SS_CENTER,$GUI_WS_EX_PARENTDRAG)
    GUICtrlCreateLabel("",28,28,32,20,$SS_BLACKFRAME)
    $trans = GUICtrlCreateSlider(60,37,73,18,$TBS_NOTICKS)
    GUICtrlSetLimit(-1,255,80)
    GUICtrlSetData(-1,220)
    GUICtrlCreateLabel("transparency:",70,25,100,12)
    GUICtrlSetFont(-1,7)
    $top = GUICtrlCreateCheckbox('"Always On Top"',28,50)
    GUICtrlSetState(-1,1)
    $info = GUICtrlCreateCheckbox("Info",130,50,-1,-1,$SS_NOTIFY)
    GUICtrlSetState(-1,1)
    GUICtrlCreateLabel("quit",135,30,28,20,$SS_CENTER)
    GUICtrlCreateLabel("",133,28,32,20,$SS_BLACKFRAME)
    

    
GUISetState()
WinSetTrans("Pangaea_Ruler","",220)
WinSetOnTop("Pangaea_Ruler","",1)

do
$msg = GUIGetMsg()
    $size = WinGetPos("Pangaea_Ruler","")
    If $size[3] <> $oldheight then
        If $size[3] < 100 then
            WinMove("Pangaea_Ruler","",$size[0],$size[1],$size[2],100)
        Else
            $oldheight = $size[3]
        EndIf
    EndIf
    If $size[2] <> $oldwidth then
        If $size[2] < 200 then
            WinMove("Pangaea_Ruler","",$size[0],$size[1],200)
        Else
            $oldwidth = $size[2]
        EndIf
    EndIf
    If $msg = $top then
        select
            case $ontop = 0
                WinSetOnTop("Pangaea_Ruler","",1)
                $ontop = 1
            case $ontop = 1
                WinSetOnTop("Pangaea_Ruler","",0)
                $ontop = 0
        EndSelect
    EndIf
    If $msg = $trans then WinSetTrans("Pangaea_Ruler","",GUICtrlRead($trans))
    If $msg = $quit then exit
    If $msg = $info then ToolTip("")
    If GUICtrlRead($info) = 1 then
        $cur = GUIGetCursorInfo()
        $pos = WinGetPos("Pangaea_Ruler","")
        ToolTip("Rel. mouse position: " & $cur[0] + 4 & "x" & $cur[1] + 4 & @crlf & "Abs. mouse position: " & MouseGetPos(0) & "x" & MouseGetPos(1) & @crlf & "Win position: " & $pos[0] & "x" & $pos[1] & @crlf & "Win size: " & $pos[2] & "x" & $pos[3])
    EndIf
    
    if $msg = $Button_1 then
                $minInter=GUICtrlRead($MinInput)   
                $midInter=GUICtrlRead($MidInput)
                $MaxInter=GUICtrlRead($MaxIntput)
                _draw(0)
                Delete_ctrls()
    EndIf
    
    if $msg = $Button_2 then
        
        $MaxInter=$dpi
        $midInter=5.5
        $minInter=11
        _draw(1)
        Delete_ctrls()
    EndIf
    
    if $msg = $Button_3 Then
        $MaxInter=$dpi/2.54
        $midInter=17.3228
        $minInter=3.464567
        _draw(1)
        Delete_ctrls()
    EndIf
    
until $msg = $GUI_EVENT_CLOSE

Func _draw($F_mode)
    
    $multi=1
    if $F_mode=1 Then $multi=$MaxInter

;---------------------------------------------------------------------------------------------------------------------------------- 
    ;draw top major
    for $x = $MaxInter to @desktopwidth step $MaxInter
        GUICtrlCreateLabel("",$x-4 ,0,1,10,$SS_BLACKRECT)
        GUICtrlCreateLabel($x/$multi,$x - 8,10)
        GUICtrlSetFont(-1,6)
    next
    ;draw top mid
    
    for $x = $midInter to @desktopwidth step $midInter
        if IsInt($x/$MaxInter)=0 then GUICtrlCreateLabel("",$x-4,0,1,8,$SS_BLACKRECT)
        next
        
    ;draw top minor
    for $x = $minInter to @desktopwidth step $minInter
        if IsInt($x/$MaxInter)=0 AND IsInt($x/$midInter)=0 then GUICtrlCreateLabel("",$x-4,0,1,5,$SS_BLACKRECT)
    next
;---------------------------------------------------------------------------------------------------------------------------------- 
    ;draw left major
    for $y = $MaxInter to @desktopheight step $MaxInter
        GUICtrlCreateLabel("",0,$y-4,10,1,$SS_BLACKRECT)
        GUICtrlCreateLabel($y/$multi,10,$y - 8)
        GUICtrlSetFont(-1,6)
    Next
    
    ;draw mid
    for $y = $midInter to @DesktopHeight step $midInter
        if IsInt($y/$MaxInter)=0 then GUICtrlCreateLabel("",0,$y-4,8,1,$SS_BLACKRECT)
    next
    
        ;draw left minor
    for $y = $minInter to @desktopheight step $minInter
        if IsInt($y/$MaxInter)=0 AND IsInt($y/$midInter)=0 Then GUICtrlCreateLabel("",0,$y-4,5,1,$SS_BLACKRECT)
    Next
;---------------------------------------------------------------------------------------------------------------------------------- 
    AutoItSetOption("GUIResizeMode",842)
    ;draw bottom major
    For $x = $MaxInter to @desktopwidth step $MaxInter
        if $x>30 then
        GUICtrlCreateLabel($x/$multi,$x - 8,80)
        GUICtrlSetFont(-1,6)
        GUICtrlCreateLabel("",$x - 4,90,1,10,$SS_BLACKRECT)
        EndIf
    next
        ;draw bottom mid
    For $x = $midInter to @desktopwidth step $midInter
        if IsInt($x/$MaxInter)=0 and $x>30 then GUICtrlCreateLabel("",$x - 4,93,1,8,$SS_BLACKRECT)
    next
    
    ;draw bottom minor
    For $x = $minInter to @desktopwidth step $minInter
        if IsInt($x/$MaxInter) = 0 AND IsInt($x/$midInter)=0 AND $x>30 then GUICtrlCreateLabel("",$x - 4,95,1,5,$SS_BLACKRECT)
    next
;---------------------------------------------------------------------------------------------------------------------------------  
    AutoItSetOption("GUIResizeMode",804)
    ;right major
    For $y = $MaxInter to @DesktopHeight step $MaxInter
        if $y>30 then
            GUICtrlCreateLabel($y/$multi,480,$y-8)
            GUICtrlSetFont(-1,6)
            GUICtrlCreateLabel("",490,$y - 4,10,1,$SS_BLACKRECT)
        EndIf
    next
    
    For $y = $midInter to @DesktopHeight step $midInter
        if IsInt($y/$MaxInter) = 0 And $y>30 then
            GUICtrlCreateLabel("",493,$y - 4,8,1,$SS_BLACKRECT)
        EndIf
    next
    
        ;right minor
    for $y = $minInter to @desktopheight step $minInter
        if  IsInt($y/$MaxInter) = 0 AND IsInt($x/$midInter)=0 AND $y>30 Then GUICtrlCreateLabel("",495,$y - 4,5,1,$SS_BLACKRECT)
    Next
    AutoItSetOption("GUIResizeMode",802)
    
EndFunc

Func Delete_ctrls()
    GUICtrlDelete ( $Button_1 )
    GUICtrlDelete ( $Button_2 )
    GUICtrlDelete ( $Button_3 )
    GUICtrlDelete ( $MinInput )
    GUICtrlDelete ( $MidInput )
    GUICtrlDelete ( $MaxIntput )
EndFunc
Edited by Cue
Link to comment
Share on other sites

  • 4 months later...
  • 1 year later...

I get an error on line 78 with Error: Subscript used with non-Array variable.

i got the same error

the exe works tho

Edited by corgano

0x616e2069646561206973206c696b652061206d616e20776974686f7574206120626f64792c20746f206669676874206f6e6520697320746f206e657665722077696e2e2e2e2e

Link to comment
Share on other sites

This was posted almost three years ago. AutoIt has changed, learn to fix the problems by yourself when they get past 6 months with no reply from the OP.

i keep forgeting to look at when the topic was created. if its at the top i think its new. srry

0x616e2069646561206973206c696b652061206d616e20776974686f7574206120626f64792c20746f206669676874206f6e6520697320746f206e657665722077696e2e2e2e2e

Link to comment
Share on other sites

  • 2 years later...

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