Jump to content

ImageSplitter v1.0.0.7 Update of 26 March 2014 (Multi Images Split allowed)


wakillon
 Share

Recommended Posts

#include <GUIConstantsEx.au3>
#include <ButtonConstants.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <ScreenCapture.au3>
#include <Array.au3>

HotKeySet("{END}", "_CapControl")

Global $aLabels[16][2]

For $i = 0 To 15
    $aLabels[$i][1] = $i + 1
Next

_ArrayShuffle2($aLabels, 0, 0, 1)

Global $hwnd

Example()

Func Example()
    Local $msg
    Local $index = 0

    $hwnd = GUICreate("", 336, 464)
    GUISetIcon(@AutoItExe, -2, $hwnd)
    GUICtrlCreatePic("", 0, 0, 338, 464, $BS_ICON)
    GUICtrlSetImage(-1, @ScriptDir & "\file.bmp")
    GUICtrlSetDefColor(0xFFFFFF)
    For $y = 0 To (464 - 116) Step 116
        For $x = 0 To (336 - 84) Step 84
            $aLabels[$index][0] = GUICtrlCreateLabel($aLabels[$index][1], $x, $y, 84, 116, BitOR($SS_CENTER, $SS_CENTERIMAGE), $WS_EX_CLIENTEDGE)
            GUICtrlSetFont(-1, 15)
            GUICtrlSetBkColor(-1, 0x000000)
            $index += 1
        Next
    Next

    GUISetState()

    While 1
        Switch GUIGetMsg()

            Case $GUI_EVENT_CLOSE
                ExitLoop
            Case $aLabels[0][0]
                GUICtrlDelete(Int($aLabels[0][0]))
            Case $aLabels[1][0]
                GUICtrlDelete(Int($aLabels[1][0]))
            Case $aLabels[2][0]
                GUICtrlDelete(Int($aLabels[2][0]))
            Case $aLabels[3][0]
                GUICtrlDelete(Int($aLabels[3][0]))
            Case $aLabels[4][0]
                GUICtrlDelete(Int($aLabels[4][0]))
            Case $aLabels[5][0]
                GUICtrlDelete(Int($aLabels[5][0]))
            Case $aLabels[6][0]
                GUICtrlDelete(Int($aLabels[6][0]))
            Case $aLabels[7][0]
                GUICtrlDelete(Int($aLabels[7][0]))
            Case $aLabels[8][0]
                GUICtrlDelete(Int($aLabels[8][0]))
            Case $aLabels[9][0]
                GUICtrlDelete(Int($aLabels[9][0]))
            Case $aLabels[10][0]
                GUICtrlDelete(Int($aLabels[10][0]))
            Case $aLabels[11][0]
                GUICtrlDelete(Int($aLabels[11][0]))
            Case $aLabels[12][0]
                GUICtrlDelete(Int($aLabels[12][0]))
            Case $aLabels[13][0]
                GUICtrlDelete(Int($aLabels[13][0]))
            Case $aLabels[14][0]
                GUICtrlDelete(Int($aLabels[14][0]))
            Case $aLabels[15][0]
                GUICtrlDelete(Int($aLabels[15][0]))

        EndSwitch
    WEnd
EndFunc   ;==>Example

Func _ArrayShuffle2(ByRef $avArray, $iStart_Row = 0, $iEnd_Row = 0, $iCol = 0)
    ; http://www.autoitscript.com/forum/topic/159789-execute-items-in-for-next-loop-in-random-order/#entry1159625

    ; Fisher–Yates algorithm

    If $iStart_Row = Default Then $iStart_Row = 0
    If $iEnd_Row = Default Then $iEnd_Row = 0
    If $iCol = Default Then $iCol = 0

    If Not IsArray($avArray) Then Return SetError(1, 0, -1)
    Local $iDim_1 = UBound($avArray, $UBOUND_ROWS)
    If $iEnd_Row = 0 Then $iEnd_Row = $iDim_1 - 1
    If $iStart_Row < 0 Or $iStart_Row > $iDim_1 - 1 Then Return SetError(3, 0, -1)
    If $iEnd_Row < 1 Or $iEnd_Row > $iDim_1 - 1 Then Return SetError(3, 0, -1)
    If $iStart_Row > $iEnd_Row Then Return SetError(4, 0, -1)

    Local $vTmp, $iRand
    Switch UBound($avArray, $UBOUND_DIMENSIONS)
        Case 1
            For $i = $iEnd_Row To $iStart_Row + 1 Step -1
                $iRand = Random($iStart_Row, $i, 1)
                $vTmp = $avArray[$i]
                $avArray[$i] = $avArray[$iRand]
                $avArray[$iRand] = $vTmp
            Next
            Return 1
        Case 2
            Local $iDim_2 = UBound($avArray, $UBOUND_COLUMNS)
            If $iCol < 0 Or $iCol > $iDim_2 - 1 Then Return SetError(5, 0, -1)
            Local $iCol_Start, $iCol_End
            If $iCol Then
                $iCol_Start = $iCol
                $iCol_End = $iCol
            Else
                $iCol_Start = 0
                $iCol_End = $iDim_2 - 1
            EndIf
            For $i = $iEnd_Row To $iStart_Row + 1 Step -1
                $iRand = Random($iStart_Row, $i, 1)
                For $j = $iCol_Start To $iCol_End
                    $vTmp = $avArray[$i][$j]
                    $avArray[$i][$j] = $avArray[$iRand][$j]
                    $avArray[$iRand][$j] = $vTmp
                Next
            Next
            Return 1
        Case Else
            Return SetError(2, 0, -1)
    EndSwitch

EndFunc   ;==>_ArrayShuffle2

Func _CapControl()
    _ScreenCapture_CaptureWnd(@ScriptDir & "\test.bmp", $hwnd)
EndFunc   ;==>_CapControl

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

Monkey's are, like, natures humans.

Link to comment
Share on other sites

I just press Alt and F5 and it runs, that's why I thought it was in Array.au3.

But I remove #include <Array.au3> and it still works.

 

Ok it's good too, but you should take in count ratio dimension of the picture for avoid distortion.

AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts

Link to comment
Share on other sites

  • Moderators

JohnOne,

Be my guest - it will be in the next release anyway. ;)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Hey, nice software wakillon,
thanks to share.

one question please,
how do you transform pictures in that data contained in the $sFileBin variable?
(the hidden Bill Clinton from post >#16 for example :))
thanks

Edited by PincoPanco

 

image.jpeg.9f1a974c98e9f77d824b358729b089b0.jpeg Chimp

small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....

Link to comment
Share on other sites

Hey, nice software wakillon,

thanks to share.

one question please,

how do you transform pictures in that data contained in the $sFileBin variable?

(the hidden Bill Clinton from post >#16 for example :))

thanks

 

A winner for my little game !  :thumbsup:

I use BinaryToAu3Kompressor for "compress" picture and include it in the script.

See link in my signature.

Thanks  :)

AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts

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

×
×
  • Create New...