Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #Persistent
- #SingleInstance ignore
- SetBatchLines, 10ms
- RC4Pass = pitarulla
- Menu, tray, NoStandard
- Menu, tray, add, FTP asetukset, Asetukset
- Menu, tray, add,
- Menu, tray, add, Ota kuvankaappaus, kaappaus
- Menu, tray, add, Poistu, Exitapp
- IniRead, server, %A_workingdir%\Asetukset.ini, yhdistys, palvelin
- IniRead, portti, %A_workingdir%\Asetukset.ini, yhdistys, portti
- IniRead, user, %A_workingdir%\Asetukset.ini, yhdistys, user
- IniRead, password, %A_workingdir%\Asetukset.ini, yhdistys, password
- IniRead, remotedir, %A_workingdir%\Asetukset.ini, yhdistys, remotedir
- Iniread, remotedirectory, %A_workingdir%\Asetukset.ini, yhdistys, remotedirectory
- RC4Dec := RC4hex2txt(password,RC4Pass)
- gui, add, text,,Palvelin
- gui, add, edit,w160 vserver, %server%
- gui, add, text,, Portti
- gui, add, edit, w20 h20 limit2 vportti, %portti%
- gui, add, text,, Käyttäjä
- gui, add, edit,w160 vuser, %user%
- gui, add, text,, Salasana
- gui, add, edit,w160 +password vpassword, %RC4Dec%
- gui, add, text,, Etäkansio
- gui, add, edit, vremotedir w160, %remotedir%
- gui, add, text,, Julkinen Osoite
- gui, add, edit, vremotedirectory w250, %remotedirectory%
- gui, add, button, gTallenna, Tallenna
- gui 2: add, edit, w200 vnewurl,
- Return
- #PrintScreen::
- kaappaus:
- nyt = %A_now%
- newFileName := nyt ".jpg"
- CaptureScreen(0, False, newFileName, 100)
- local = %nyt%.jpg
- remotefile = %nyt%.jpg
- ifnotexist %local%
- {
- Msgbox , Local puuttuu soita poliisit
- exitapp
- }
- FtpOpen(server,port,user,password)
- FtpSetCurrentDirectory("/"remotedir)
- FtpPutFile(local,remotefile)
- FtpClose()
- clipboard = %remotedirectory%%remotefile%
- filedelete, %A_workingdir%\%nyt%.jpg
- return
- Asetukset:
- Gui, show
- Return
- ExitApp:
- Exitapp
- Return
- Tallenna:
- Gui, submit
- passu := RC4txt2hex(password,RC4Pass)
- IniWrite, %server%, %A_workingdir%\Asetukset.ini, yhdistys, palvelin
- IniWrite, %portti%, %A_workingdir%\Asetukset.ini, yhdistys, portti
- IniWrite, %user%, %A_workingdir%\Asetukset.ini, yhdistys, user
- IniWrite, %passu%, %A_workingdir%\Asetukset.ini, yhdistys, password
- IniWrite, %remotedir%, %A_workingdir%\Asetukset.ini, yhdistys, remotedir
- IniWrite, %remotedirectory%, %A_workingdir%\Asetukset.ini, yhdistys, remotedirectory
- Msgbox, Asetukset tallennettu.
- Return
- ;________________________FUNKTIOT________________________________
- CaptureScreen(aRect = 0, bCursor = False, sFile = "", nQuality = "")
- {
- If !aRect
- {
- SysGet, nL, 76
- SysGet, nT, 77
- SysGet, nW, 78
- SysGet, nH, 79
- }
- Else If aRect = 1
- WinGetPos, nL, nT, nW, nH, A
- Else If aRect = 2
- {
- WinGet, hWnd, ID, A
- VarSetCapacity(rt, 16, 0)
- DllCall("GetClientRect" , "Uint", hWnd, "Uint", &rt)
- DllCall("ClientToScreen", "Uint", hWnd, "Uint", &rt)
- nL := NumGet(rt, 0, "int")
- nT := NumGet(rt, 4, "int")
- nW := NumGet(rt, 8)
- nH := NumGet(rt,12)
- }
- Else If aRect = 3
- {
- VarSetCapacity(mi, 40, 0)
- DllCall("GetCursorPos", "int64P", pt)
- DllCall("GetMonitorInfo", "Uint", DllCall("MonitorFromPoint", "int64", pt, "Uint", 2), "Uint", NumPut(40,mi)-4)
- nL := NumGet(mi, 4, "int")
- nT := NumGet(mi, 8, "int")
- nW := NumGet(mi,12, "int") - nL
- nH := NumGet(mi,16, "int") - nT
- }
- Else
- {
- StringSplit, rt, aRect, `,, %A_Space%%A_Tab%
- nL := rt1
- nT := rt2
- nW := rt3 - rt1
- nH := rt4 - rt2
- znW := rt5
- znH := rt6
- }
- mDC := DllCall("CreateCompatibleDC", "Uint", 0)
- hBM := CreateDIBSection(mDC, nW, nH)
- oBM := DllCall("SelectObject", "Uint", mDC, "Uint", hBM)
- hDC := DllCall("GetDC", "Uint", 0)
- DllCall("BitBlt", "Uint", mDC, "int", 0, "int", 0, "int", nW, "int", nH, "Uint", hDC, "int", nL, "int", nT, "Uint", 0x40000000 | 0x00CC0020)
- DllCall("ReleaseDC", "Uint", 0, "Uint", hDC)
- If bCursor
- CaptureCursor(mDC, nL, nT)
- DllCall("SelectObject", "Uint", mDC, "Uint", oBM)
- DllCall("DeleteDC", "Uint", mDC)
- If znW && znH
- hBM := Zoomer(hBM, nW, nH, znW, znH)
- If sFile = 0
- SetClipboardData(hBM)
- Else Convert(hBM, sFile, nQuality), DllCall("DeleteObject", "Uint", hBM)
- }
- CaptureCursor(hDC, nL, nT)
- {
- VarSetCapacity(mi, 20, 0)
- mi := Chr(20)
- DllCall("GetCursorInfo", "Uint", &mi)
- bShow := NumGet(mi, 4)
- hCursor := NumGet(mi, 8)
- xCursor := NumGet(mi,12)
- yCursor := NumGet(mi,16)
- VarSetCapacity(ni, 20, 0)
- DllCall("GetIconInfo", "Uint", hCursor, "Uint", &ni)
- xHotspot := NumGet(ni, 4)
- yHotspot := NumGet(ni, 8)
- hBMMask := NumGet(ni,12)
- hBMColor := NumGet(ni,16)
- If bShow
- DllCall("DrawIcon", "Uint", hDC, "int", xCursor - xHotspot - nL, "int", yCursor - yHotspot - nT, "Uint", hCursor)
- If hBMMask
- DllCall("DeleteObject", "Uint", hBMMask)
- If hBMColor
- DllCall("DeleteObject", "Uint", hBMColor)
- }
- Zoomer(hBM, nW, nH, znW, znH)
- {
- mDC1 := DllCall("CreateCompatibleDC", "Uint", 0)
- mDC2 := DllCall("CreateCompatibleDC", "Uint", 0)
- zhBM := CreateDIBSection(mDC2, znW, znH)
- oBM1 := DllCall("SelectObject", "Uint", mDC1, "Uint", hBM)
- oBM2 := DllCall("SelectObject", "Uint", mDC2, "Uint", zhBM)
- DllCall("SetStretchBltMode", "Uint", mDC2, "int", 4)
- DllCall("StretchBlt", "Uint", mDC2, "int", 0, "int", 0, "int", znW, "int", znH, "Uint", mDC1, "int", 0, "int", 0, "int", nW, "int", nH, "Uint", 0x00CC0020)
- DllCall("SelectObject", "Uint", mDC1, "Uint", oBM1)
- DllCall("SelectObject", "Uint", mDC2, "Uint", oBM2)
- DllCall("DeleteDC", "Uint", mDC1)
- DllCall("DeleteDC", "Uint", mDC2)
- DllCall("DeleteObject", "Uint", hBM)
- Return zhBM
- }
- Convert(sFileFr = "", sFileTo = "", nQuality = "")
- {
- If sFileTo =
- sFileTo := A_ScriptDir . "\screen.bmp"
- SplitPath, sFileTo, , sDirTo, sExtTo, sNameTo
- If Not hGdiPlus := DllCall("LoadLibrary", "str", "gdiplus.dll")
- Return sFileFr+0 ? SaveHBITMAPToFile(sFileFr, sDirTo . "\" . sNameTo . ".bmp") : ""
- VarSetCapacity(si, 16, 0), si := Chr(1)
- DllCall("gdiplus\GdiplusStartup", "UintP", pToken, "Uint", &si, "Uint", 0)
- If !sFileFr
- {
- DllCall("OpenClipboard", "Uint", 0)
- If DllCall("IsClipboardFormatAvailable", "Uint", 2) && (hBM:=DllCall("GetClipboardData", "Uint", 2))
- DllCall("gdiplus\GdipCreateBitmapFromHBITMAP", "Uint", hBM, "Uint", 0, "UintP", pImage)
- DllCall("CloseClipboard")
- }
- Else If sFileFr Is Integer
- DllCall("gdiplus\GdipCreateBitmapFromHBITMAP", "Uint", sFileFr, "Uint", 0, "UintP", pImage)
- Else DllCall("gdiplus\GdipLoadImageFromFile", "Uint", Unicode4Ansi(wFileFr,sFileFr), "UintP", pImage)
- DllCall("gdiplus\GdipGetImageEncodersSize", "UintP", nCount, "UintP", nSize)
- VarSetCapacity(ci,nSize,0)
- DllCall("gdiplus\GdipGetImageEncoders", "Uint", nCount, "Uint", nSize, "Uint", &ci)
- Loop, % nCount
- If InStr(Ansi4Unicode(NumGet(ci,76*(A_Index-1)+44)), "." . sExtTo)
- {
- pCodec := &ci+76*(A_Index-1)
- Break
- }
- If InStr(".JPG.JPEG.JPE.JFIF", "." . sExtTo) && nQuality<>"" && pImage && pCodec
- {
- DllCall("gdiplus\GdipGetEncoderParameterListSize", "Uint", pImage, "Uint", pCodec, "UintP", nSize)
- VarSetCapacity(pi,nSize,0)
- DllCall("gdiplus\GdipGetEncoderParameterList", "Uint", pImage, "Uint", pCodec, "Uint", nSize, "Uint", &pi)
- Loop, % NumGet(pi)
- If NumGet(pi,28*(A_Index-1)+20)=1 && NumGet(pi,28*(A_Index-1)+24)=6
- {
- pParam := &pi+28*(A_Index-1)
- NumPut(nQuality,NumGet(NumPut(4,NumPut(1,pParam+0)+20)))
- Break
- }
- }
- If pImage
- pCodec ? DllCall("gdiplus\GdipSaveImageToFile", "Uint", pImage, "Uint", Unicode4Ansi(wFileTo,sFileTo), "Uint", pCodec, "Uint", pParam) : DllCall("gdiplus\GdipCreateHBITMAPFromBitmap", "Uint", pImage, "UintP", hBitmap, "Uint", 0) . SetClipboardData(hBitmap), DllCall("gdiplus\GdipDisposeImage", "Uint", pImage)
- DllCall("gdiplus\GdiplusShutdown" , "Uint", pToken)
- DllCall("FreeLibrary", "Uint", hGdiPlus)
- }
- CreateDIBSection(hDC, nW, nH, bpp = 32, ByRef pBits = "")
- {
- NumPut(VarSetCapacity(bi, 40, 0), bi)
- NumPut(nW, bi, 4)
- NumPut(nH, bi, 8)
- NumPut(bpp, NumPut(1, bi, 12, "UShort"), 0, "Ushort")
- NumPut(0, bi,16)
- Return DllCall("gdi32\CreateDIBSection", "Uint", hDC, "Uint", &bi, "Uint", 0, "UintP", pBits, "Uint", 0, "Uint", 0)
- }
- SaveHBITMAPToFile(hBitmap, sFile)
- {
- DllCall("GetObject", "Uint", hBitmap, "int", VarSetCapacity(oi,84,0), "Uint", &oi)
- hFile:= DllCall("CreateFile", "Uint", &sFile, "Uint", 0x40000000, "Uint", 0, "Uint", 0, "Uint", 2, "Uint", 0, "Uint", 0)
- DllCall("WriteFile", "Uint", hFile, "int64P", 0x4D42|14+40+NumGet(oi,44)<<16, "Uint", 6, "UintP", 0, "Uint", 0)
- DllCall("WriteFile", "Uint", hFile, "int64P", 54<<32, "Uint", 8, "UintP", 0, "Uint", 0)
- DllCall("WriteFile", "Uint", hFile, "Uint", &oi+24, "Uint", 40, "UintP", 0, "Uint", 0)
- DllCall("WriteFile", "Uint", hFile, "Uint", NumGet(oi,20), "Uint", NumGet(oi,44), "UintP", 0, "Uint", 0)
- DllCall("CloseHandle", "Uint", hFile)
- }
- SetClipboardData(hBitmap)
- {
- DllCall("GetObject", "Uint", hBitmap, "int", VarSetCapacity(oi,84,0), "Uint", &oi)
- hDIB := DllCall("GlobalAlloc", "Uint", 2, "Uint", 40+NumGet(oi,44))
- pDIB := DllCall("GlobalLock", "Uint", hDIB)
- DllCall("RtlMoveMemory", "Uint", pDIB, "Uint", &oi+24, "Uint", 40)
- DllCall("RtlMoveMemory", "Uint", pDIB+40, "Uint", NumGet(oi,20), "Uint", NumGet(oi,44))
- DllCall("GlobalUnlock", "Uint", hDIB)
- DllCall("DeleteObject", "Uint", hBitmap)
- DllCall("OpenClipboard", "Uint", 0)
- DllCall("EmptyClipboard")
- DllCall("SetClipboardData", "Uint", 8, "Uint", hDIB)
- DllCall("CloseClipboard")
- }
- Unicode4Ansi(ByRef wString, sString)
- {
- nSize := DllCall("MultiByteToWideChar", "Uint", 0, "Uint", 0, "Uint", &sString, "int", -1, "Uint", 0, "int", 0)
- VarSetCapacity(wString, nSize * 2)
- DllCall("MultiByteToWideChar", "Uint", 0, "Uint", 0, "Uint", &sString, "int", -1, "Uint", &wString, "int", nSize)
- Return &wString
- }
- Ansi4Unicode(pString)
- {
- nSize := DllCall("WideCharToMultiByte", "Uint", 0, "Uint", 0, "Uint", pString, "int", -1, "Uint", 0, "int", 0, "Uint", 0, "Uint", 0)
- VarSetCapacity(sString, nSize)
- DllCall("WideCharToMultiByte", "Uint", 0, "Uint", 0, "Uint", pString, "int", -1, "str", sString, "int", nSize, "Uint", 0, "Uint", 0)
- Return sString
- }
- FtpOpen(Server, Port=21, Username=0, Password=0 ,Proxy="", ProxyBypass="") {
- IfEqual, Username, 0, SetEnv, Username, anonymous
- IfEqual, Password, 0, SetEnv, Password, anonymous
- If (Proxy != "")
- AccessType=3
- Else
- AccessType=1
- ;#define INTERNET_OPEN_TYPE_PRECONFIG 0 // use registry configuration
- ;#define INTERNET_OPEN_TYPE_DIRECT 1 // direct to net
- ;#define INTERNET_OPEN_TYPE_PROXY 3 // via named proxy
- ;#define INTERNET_OPEN_TYPE_PRECONFIG_WITH_NO_AUTOPROXY 4 // prevent using java/script/INS
- global ic_hInternet, io_hInternet, hModule
- hModule := DllCall("LoadLibrary", "str", "wininet.dll")
- io_hInternet := DllCall("wininet\InternetOpenA"
- , "str", A_ScriptName ;lpszAgent
- , "UInt", AccessType
- , "str", Proxy
- , "str", ProxyBypass
- , "UInt", 0) ;dwFlags
- If (ErrorLevel != 0 or io_hInternet = 0) {
- FtpClose()
- return 0
- }
- ic_hInternet := DllCall("wininet\InternetConnectA"
- , "uint", io_hInternet
- , "str", Server
- , "uint", Port
- , "str", Username
- , "str", Password
- , "uint" , 1 ;dwService (INTERNET_SERVICE_FTP = 1)
- , "uint", 0 ;dwFlags
- , "uint", 0) ;dwContext
- If (ErrorLevel != 0 or ic_hInternet = 0)
- return 0
- else
- return 1
- }
- FtpClose() {
- global ic_hInternet, io_hInternet, hModule
- DllCall("wininet\InternetCloseHandle", "UInt", ic_hInternet)
- DllCall("wininet\InternetCloseHandle", "UInt", io_hInternet)
- DllCall("FreeLibrary", "UInt", hModule)
- }
- FtpSetCurrentDirectory(DirName) {
- global ic_hInternet
- r := DllCall("wininet\FtpSetCurrentDirectoryA", "uint", ic_hInternet, "str", DirName)
- If (ErrorLevel != 0 or r = 0)
- return 0
- else
- return 1
- }
- FtpPutFile(LocalFile, NewRemoteFile="", Flags=0) {
- ;Flags:
- ;FTP_TRANSFER_TYPE_UNKNOWN = 0 (Defaults to FTP_TRANSFER_TYPE_BINARY)
- ;FTP_TRANSFER_TYPE_ASCII = 1
- ;FTP_TRANSFER_TYPE_BINARY = 2
- If NewRemoteFile=
- NewRemoteFile := LocalFile
- global ic_hInternet
- r := DllCall("wininet\FtpPutFileA"
- , "uint", ic_hInternet
- , "str", LocalFile
- , "str", NewRemoteFile
- , "uint", Flags
- , "uint", 0) ;dwContext
- If (ErrorLevel != 0 or r = 0)
- return 0
- else
- return 1
- }
- RC4txt2hex(Data,Pass) {
- Format := A_FormatInteger
- SetFormat Integer, Hex
- b := 0, j := 0
- VarSetCapacity(Result,StrLen(Data)*2)
- Loop 256
- a := A_Index - 1
- ,Key%a% := Asc(SubStr(Pass, Mod(a,StrLen(Pass))+1, 1))
- ,sBox%a% := a
- Loop 256
- a := A_Index - 1
- ,b := b + sBox%a% + Key%a% & 255
- ,sBox%a% := (sBox%b%+0, sBox%b% := sBox%a%) ; SWAP(a,b)
- Loop Parse, Data
- i := A_Index & 255
- ,j := sBox%i% + j & 255
- ,k := sBox%i% + sBox%j% & 255
- ,sBox%i% := (sBox%j%+0, sBox%j% := sBox%i%) ; SWAP(i,j)
- ,Result .= SubStr(Asc(A_LoopField)^sBox%k%, -1, 2)
- StringReplace Result, Result, x, 0, All
- SetFormat Integer, %Format%
- Return Result
- }
- RC4hex2txt(Data,Pass) {
- b := 0, j := 0, x := "0x"
- VarSetCapacity(Result,StrLen(Data)//2)
- Loop 256
- a := A_Index - 1
- ,Key%a% := Asc(SubStr(Pass, Mod(a,StrLen(Pass))+1, 1))
- ,sBox%a% := a
- Loop 256
- a := A_Index - 1
- ,b := b + sBox%a% + Key%a% & 255
- ,sBox%a% := (sBox%b%+0, sBox%b% := sBox%a%) ; SWAP(a,b)
- Loop % StrLen(Data)//2
- i := A_Index & 255
- ,j := sBox%i% + j & 255
- ,k := sBox%i% + sBox%j% & 255
- ,sBox%i% := (sBox%j%+0, sBox%j% := sBox%i%) ; SWAP(i,j)
- ,Result .= Chr((x . SubStr(Data,2*A_Index-1,2)) ^ sBox%k%)
- Return Result
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement