ATTENTION: You are viewing a page formatted for mobile devices; to view the full web page, click HERE.

DonationCoder.com Software > Finished Programs

DONE: Photo Downloader Kiosk

<< < (6/9) > >>

skrommel:
 :) Download the pngs and place them beside the script.

Then replace the source code

--- ---Gui,Add, Button,W75 Xm Ym GREFRESH Default,&Refresh
Gui,Add, Button,W75 X+5 GSELECTALL,Select &All
Gui,Add, Button,W75 X+5 GINVERT,&Invert
Gui,Add, Button,W75 X+5 GUPLOAD,&Upload
width

--- ---Gui,Add,Picture,Xm Ym GREFRESH Default,reload.png
Gui,Add,Text,X+5 Ym+7 GREFRESH,&Reload
Gui,Add,Picture,X+5 Ym GSELECTALL,list-add.png
Gui,Add,Text,X+5 Ym+7 GSELECTALL,Select &All
Gui,Add,Picture,X+5 Ym GINVERT,list-remove.png
Gui,Add,Text,X+5 Ym+7 GINVERT,&Invert
Gui,Add,Picture,X+5 Ym GUPLOAD,filesave.png
Gui,Add,Text,X+5 Ym+7 GUPLOAD,&Upload

Skrommel

NinJA999:
Thanks.

This line was not working:

--- ---Gui,Add,Picture,Xm Ym GRELOAD Default,reload.png
Gui,Add,Text,X+5 Ym+7 GRELOAD,&ReloadSo I replaced it with this one (the label was GREFRESH not GRELOAD):

--- ---Gui,Add,Picture,Xm Ym GREFRESH Default,reload.png
Gui,Add,Text,X+5 Ym+7 GREFRESH,&Reload
I also neatened up the coordinates for use with the 48x48 icons:

--- ---Gui,Add,Picture,Xm Ym GREFRESH Default,reload.png
Gui,Add,Text,X+2 Ym+36 GREFRESH,&Refresh
Gui,Add,Picture,X+10 Ym GSELECTALL,list-add.png
Gui,Add,Text,X+2 Ym+36 GSELECTALL,Select &All
Gui,Add,Picture,X+10 Ym GINVERT,list-remove.png
Gui,Add,Text,X+2 Ym+36 GINVERT,&Invert Selection
Gui,Add,Picture,X+10 Ym GUPLOAD,filesave.png
Gui,Add,Text,X+2 Ym+36 GUPLOAD,&Upload
And since I'm using the 48x48 icons, the pictures needed to move down a bit, so I changed this code

--- ---y:=25+spaceto this

--- ---y:=50+space

murple:
Skrommel: I decided to try your script just for the fun of it, copy pasterde the code from your original post and ran the script. The only problem was that I couldn't close the window, nor do anything else with my computer since the window steels all focus. (I realise this is a "feature" of the program, but for the unknowning user testing this, it's very annoying.) I could barely launch Task Manager and had to look up how to use tskill and taskkill to kill all autohotkey.exe processes. Perhaps it would be a smart idea to include a close button in your script by default and explain to people who actually want to use this as a kiosk how to disable the close button (Just comment out the "gui, add, button" line of code for example). I'm really happy that I didn't have to restart, because I've been upgrading a Magellan GPS for a colleague on my computer for the past 2 hours and it was just about finished when I tried PhotoKiosk.

I'll have to do some research on how to close the window before I run it again. I'm guessing it's a nice program though. I'm curious on how you create the thumbnails and also about why it's not listed in your main software page? Is it too early or are you not planning on listing it there?

NinJA999:
Just so you know, the hard-to-exit-ness was my request, as I know some people who would love to play that type of mischief :P but I do think it might be a good idea to at least have the key combo listed in the comments at the beginning.  (Ctrl+Shift+Alt+E).

NinJA999:
I also have been tweaking it a little to have a message that pops up while pictures are loading/uploading.  Since there are several lines added in different places, I'll just put the entire script here; keep in mind it is SKROMMEL'S, not mine -- I just made modifications.  Once again, this is SKROMMEL'S SCRIPT.  (I also left off the gdi functions on the bottom since it was too long -- if you want to use this script take the bottom from skrommel's)

--- ---;PhotoKiosk.ahk
;PRESS CTRL+ALT+SHIFT+E TO EXIT!!!!
;Skrommel @ 2008
;Modifications by NinJA999

in:="M:,N:,O:,P:"   ; Source folders separated by comma
out:="G:\Temp2"      ; Targe folder
size:=120           ; Thumbnail size
space:=14           ; Thumbnail space
subfolders:=1       ; Traverse subfolders? 1=Yes 0=No
preview:=400        ; Width of preview window

applicationname=PhotoKiosk

#NoEnv
#SingleInstance,Force
SetBatchLines,-1
SetWinDelay,0
DetectHiddenWindows,On

OnExit,EXIT
pToken:=Gdip_Startup()

StringRight,right,out,1
If (right="\")
  StringTrimRight,out,out,1

START:
Gui,Destroy
Gui,Show,% "X Y W" A_ScreenWidth " H" A_ScreenHeight,%applicationname%
Gui,+Resize +0x300000 +AlwaysOnTop -Resize +OwnDialogs ;WS_VSCROLL | WS_HSCROLL
Gui,+LastFound
guiid:=WinExist()

WinSetUnMovable(guiid)
DllCall("RegisterShellHookWindow",UInt,guiid)
msgnum:=DllCall("RegisterWindowMessage",Str,"SHELLHOOK")
OnMessage(msgnum,"ShellMessage")
GroupAdd,MyGui,ahk_id %guiid%
WinSet,Top,,ahk_id %guiid%
WinSetTitle,ahk_id %guiid%,,% applicationname " - Reading pictures..."

Gui,3:Destroy
Gui,3:+Owner1
Gui,3:+AlwaysOnTop +ToolWindow -Caption
Gui,3:Margin,10,10
Gui,3:Font, s24
Gui,3:Add,Text,Xm Ym vProgressText,% "Reading pictures, please wait..."
Gui,3:Show

subfolder:=A_Now
counter:=0
x:=space
y:=50+space
Loop,Parse,in,`,
{
  source:=A_LoopField
  StringRight,right,source,1
  If (right="\")
    StringTrimRight,source,source,1

  Loop,%source%\*.*,0,% subfolders
  {
    If A_LoopFileExt Not In GIF,JPG,JPEG,JPE,BMP,ICO,CUR,ANI,PNG,TIF,Exif,WMF,EMF
      Continue
    counter+=1
    path_%counter%:=A_LoopFileLongPath
    pBitmap := Gdip_CreateBitmapFromFile(A_LoopFileLongPath)
    w:=Gdip_GetImageWidth(pBitmap)
    h:=Gdip_GetImageHeight(pBitmap)
    Gdip_DisposeImage(pBitmap)
    If (w>h)
      Gui,Add,Picture,% "X" x " Y" y+(size-size*h/w)/2 " W" size " H-1 GPICTURE AltSubmit V" check%counter%,%A_LoopFileLongPath%
    Else
      Gui,Add,Picture,% "X" x+(size-size*w/h)/2 " Y" y " H" size " W-1 GPICTURE AltSubmit V" check%counter%,%A_LoopFileLongPath%
    Gui,Add,CheckBox,% "X" x-space " Y" y+size " W" space " H" space,% "" ; " W" size+space-1 " H" space*2,% "" ;% A_LoopFileName
    Gui,Add,Edit,% "X" x+1 " Y" y+size " W" size-2 " H" space*2 " -HScroll -VScroll",% A_LoopFileName

    x:=x+size+space*2
    If (x>A_ScreenWidth-size)
    {
      x:=space
      y:=y+size+space*2
    }
  }
}
;Gui,Add, Button,W75 Xm Ym GREFRESH Default,&Refresh
;Gui,Add, Button,W75 X+5 GSELECTALL,Select &All
;Gui,Add, Button,W75 X+5 GINVERT,&Invert
;Gui,Add, Button,W75 X+5 GUPLOAD,&Upload

Gui,Add,Picture,Xm Ym GREFRESH Default,reload.png
Gui,Add,Text,X+2 Ym+36 GREFRESH,&Refresh
Gui,Add,Picture,X+10 Ym GSELECTALL,list-add.png
Gui,Add,Text,X+2 Ym+36 GSELECTALL,Select &All
Gui,Add,Picture,X+10 Ym GINVERT,list-remove.png
Gui,Add,Text,X+2 Ym+36 GINVERT,&Invert Selection
Gui,Add,Picture,X+10 Ym GUPLOAD,filesave.png
Gui,Add,Text,X+2 Ym+36 GUPLOAD,&Upload

OnMessage(0x115, "OnScroll") ; WM_VSCROLL
OnMessage(0x114, "OnScroll") ; WM_HSCROLL

WinMove,ahk_id %guiid%,,,,,% A_ScreenHeight-1
WinMove,ahk_id %guiid%,,,,,% A_ScreenHeight
WinSetTitle,ahk_id %guiid%,,% "Finished reading pictures"
GuiControl,3:,ProgressText,% "Finished reading pictures"
Sleep, 1000
Gui,3:Destroy
Return


PICTURE:
MouseGetPos,mx,my,mwin,mctrl
StringTrimLeft,control,mctrl,6
Gui,2:Destroy
Gui,2:+Owner1
Gui,2:Margin,0,0
Gui,2:+AlwaysOnTop +ToolWindow
Gui,2:Add,Picture,% "X" 0 " Y" 0 " W" 400 " H-1 GPREVIEW",% path_%control%
Gui,2:Show
Return


PREVIEW:
Return


REFRESH:
subfolder:=A_Now
Gui,2:+AlwaysOnTop -Border -Resize
Gui,2:Show,X0 Y0 W%A_ScreenWidth% H%A_ScreenHeight%,PhotoKiosk
Gosub,START
Gui,2:Destroy
Return


SELECTALL:
WinGet,controls,ControlList,ahk_id %guiid%
Loop,Parse,controls,`n
{
  If A_LoopField Contains Button
    GuiControl,,% A_LoopField,1
  If (A_LoopField="Button" counter)
    Break
}
Return


INVERT:
WinGet,controls,ControlList,ahk_id %guiid%
Loop,Parse,controls,`n
{
  If A_LoopField Contains Button
  {
    GuiControlGet,checked,,% A_LoopField
    If checked=1
      GuiControl,,% A_LoopField,0
    Else
      GuiControl,,% A_LoopField,1
  }
  If (A_LoopField="Button" counter)
    Break
}
Return


UPLOAD:
Gui,3:Destroy
Gui,3:+Owner1
Gui,3:+AlwaysOnTop +ToolWindow -Caption
Gui,3:Margin,10,10
Gui,3:Font, s24
Gui,3:Add,Text,Xm Ym vProgressText,% "Uploading pictures..."
Gui,3:Show

FileCreateDir,% out "\" subfolder "\"
WinGet,controls,ControlList,ahk_id %guiid%
Loop,Parse,controls,`n
{
  If A_LoopField Contains Button
  {
    GuiControlGet,checked,,% A_LoopField
    If checked=1
    {
      StringTrimLeft,control,A_LoopField,6
     
      FileCopy,% path_%control%,% out "\" subfolder "\"
      WinSetTitle,ahk_id %guiid%,,% "Uploading " path_%control% "..."
      GuiControl,3:,ProgressText,% "Uploading " path_%control% "..."
    }
  }
  If (A_LoopField="Button" counter)
    Break
}
WinSetTitle,ahk_id %guiid%,,% "Finished uploading pictures"
GuiControl,3:,ProgressText,% "Finished uploading pictures"
Sleep, 1000
Gui,3:Destroy
Return


GuiSize:
  UpdateScrollBars(A_Gui,A_GuiWidth,A_GuiHeight)
Return


GuiClose:
Return


^+!e::
EXIT:
Gdip_Shutdown(pToken)
DllCall("CloseHandle",UInt,hDir)
ExitApp
Return


ShellMessage(wParam,lParam)
{
  Global guiid
  If (lParam<>guiid)
  {
    WinSet,Top,,ahk_id %guiid%
    WinActivate,ahk_id %guiid%
  }
}
Return


WinSetUnMovable(hwnd)
{
  hSysMenu:=DllCall("GetSystemMenu","Int",hWnd,"Int",FALSE)
  nCnt:=DllCall("GetMenuItemCount","Int",hSysMenu)
  DllCall("RemoveMenu","Int",hSysMenu,"UInt",nCnt-6,"Uint","0x400")
  DllCall("DrawMenuBar","Int",hWnd)
}
Return


#IfWinActive ahk_group MyGui
WheelUp::
WheelDown::
+WheelUp::
+WheelDown::
  ; SB_LINEDOWN=1, SB_LINEUP=0, WM_HSCROLL=0x114, WM_VSCROLL=0x115
  OnScroll(InStr(A_ThisHotkey,"Down") ? 1 : 0, 0, GetKeyState("Shift") ? 0x114 : 0x115, WinExist())
Return
#IfWinActive


UpdateScrollBars(GuiNum, GuiWidth, GuiHeight)
{
  static SIF_RANGE=0x1, SIF_PAGE=0x2, SIF_DISABLENOSCROLL=0x8, SB_HORZ=0, SB_VERT=1
 
  Gui, %GuiNum%:Default
  Gui, +LastFound
 
  ; Calculate scrolling area.
  Left := Top := 9999
  Right := Bottom := 0
  WinGet, ControlList, ControlList
  Loop, Parse, ControlList, `n
  {
    GuiControlGet, c, Pos, %A_LoopField%
    if (cX < Left)
      Left := cX
    if (cY < Top)
      Top := cY
    if (cX + cW > Right)
      Right := cX + cW
    if (cY + cH > Bottom)
      Bottom := cY + cH
  }
  Left -= 8
  Top -= 8
  Right += 8
  Bottom += 8
  ScrollWidth := Right-Left
  ScrollHeight := Bottom-Top
 
  ; Initialize SCROLLINFO.
  VarSetCapacity(si, 28, 0)
  NumPut(28, si) ; cbSize
  NumPut(SIF_RANGE | SIF_PAGE, si, 4) ; fMask
 
  ; Update horizontal scroll bar.
  NumPut(ScrollWidth, si, 12) ; nMax
  NumPut(GuiWidth, si, 16) ; nPage
  DllCall("SetScrollInfo", "uint", WinExist(), "uint", SB_HORZ, "uint", &si, "int", 1)
 
  ; Update vertical scroll bar.
;     NumPut(SIF_RANGE | SIF_PAGE | SIF_DISABLENOSCROLL, si, 4) ; fMask
  NumPut(ScrollHeight, si, 12) ; nMax
  NumPut(GuiHeight, si, 16) ; nPage
  DllCall("SetScrollInfo", "uint", WinExist(), "uint", SB_VERT, "uint", &si, "int", 1)
 
  if (Left < 0 && Right < GuiWidth)
      x := Abs(Left) > GuiWidth-Right ? GuiWidth-Right : Abs(Left)
  if (Top < 0 && Bottom < GuiHeight)
      y := Abs(Top) > GuiHeight-Bottom ? GuiHeight-Bottom : Abs(Top)
  if (x || y)
      DllCall("ScrollWindow", "uint", WinExist(), "int", x, "int", y, "uint", 0, "uint", 0)
}


OnScroll(wParam, lParam, msg, hwnd)
{
  static SIF_ALL=0x17, SCROLL_STEP=10
 
  bar := msg=0x115 ; SB_HORZ=0, SB_VERT=1
 
  VarSetCapacity(si, 28, 0)
  NumPut(28, si) ; cbSize
  NumPut(SIF_ALL, si, 4) ; fMask
  if !DllCall("GetScrollInfo", "uint", hwnd, "int", bar, "uint", &si)
    return
 
  VarSetCapacity(rect, 16)
  DllCall("GetClientRect", "uint", hwnd, "uint", &rect)
 
  new_pos := NumGet(si, 20) ; nPos
 
  action := wParam & 0xFFFF
  if action = 0 ; SB_LINEUP
    new_pos -= SCROLL_STEP
  else if action = 1 ; SB_LINEDOWN
    new_pos += SCROLL_STEP
  else if action = 2 ; SB_PAGEUP
    new_pos -= NumGet(rect, 12, "int") - SCROLL_STEP
  else if action = 3 ; SB_PAGEDOWN
    new_pos += NumGet(rect, 12, "int") - SCROLL_STEP
  else if action = 5 ; SB_THUMBTRACK
    new_pos := NumGet(si, 24, "int") ; nTrackPos
  else if action = 6 ; SB_TOP
    new_pos := NumGet(si, 8, "int") ; nMin
  else if action = 7 ; SB_BOTTOM
    new_pos := NumGet(si, 12, "int") ; nMax
  else
    return
 
  min := NumGet(si, 8, "int") ; nMin
  max := NumGet(si, 12, "int") - NumGet(si, 16) ; nMax-nPage
  new_pos := new_pos > max ? max : new_pos
  new_pos := new_pos < min ? min : new_pos
 
  old_pos := NumGet(si, 20, "int") ; nPos
 
  x := y := 0
  if bar = 0 ; SB_HORZ
    x := old_pos-new_pos
  else
    y := old_pos-new_pos
  ; Scroll contents of window and invalidate uncovered area.
  DllCall("ScrollWindow", "uint", hwnd, "int", x, "int", y, "uint", 0, "uint", 0)
 
  ; Update scroll bar.
  NumPut(new_pos, si, 20, "int") ; nPos
  DllCall("SetScrollInfo", "uint", hwnd, "int", bar, "uint", &si, "int", 1)
}
Skrommel, if you don't want me to post this, I'll take it off.

PS sorry for the bump but it wouldn't let me put it in the earlier post because it was too long

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version