::Full keyboard control is here::

Ask for help and post your question on how to use XnView Classic.

Moderators: helmut, XnTriq, xnview

Post Reply
User avatar
wOxxOm
Posts: 26
Joined: Sun Mar 11, 2007 1:29 pm
Contact:

::Full keyboard control is here::

Post by wOxxOm »

FIRST STEP TO ACHIEVE THE TOPIC's GOAL

The script provides some ('full' is up to you, see in the code) control of XnView via customizable keyboard shortcuts
Customizing is done via editing code below. Save it as "XnViewKeys.AHK", download AutoHotKey and install it to run this script (just double click or compile to make an exe using ahk2exe compiler in autohotkey folder)

All the keyboard shortcut labels are given in autohotkey help, and are easy to remember, use, understand.

CODE UPDATED: ::Sane AcquireInto...current folder, autoset StartIndex::
UPDATED: numpad control is off in editboxes

Code: Select all

GiveMeTrayIcon()
#ifWinActive,ahk_class XmainClass
~Numpad0::ControlXnView(415) ;Extension
~Numpad1::ControlXnView(413) ;Name
~Numpad2::ControlXnView(416) ;Date
~Numpad3::ControlXnView(418) ;File size
~Numpad4::ControlXnView(419) ;Image size
~Numpad5::ControlXnView(420) ;Image width
~Numpad6::ControlXnView(421) ;Image height

;CTRL+numpad
^Numpad0::ControlXnView(406) ;thumbs
^Numpad1::ControlXnView(407) ;icons
^Numpad2::ControlXnView(408) ;details
^Numpad3::ControlXnView(409) ;list
^Numpad4::ControlXnView(410) ;thumbs and labels
^Numpad5::ControlXnView(411) ;thumbs and desc

;CTRL+SHIFT+numpad
^+Numpad0::ControlXnView(432) ;all
^+Numpad1::ControlXnView(428) ;images
^+Numpad2::ControlXnView(431) ;archives
^+Numpad3::ControlXnView(433) ;custom

;ALT+numpad
~!Numpad0::ControlXnView(502) ;thumbsize
~!Numpad1::ControlXnView(505) ;thumbsize
~!Numpad2::ControlXnView(506) ;thumbsize
~!Numpad3::ControlXnView(507) ;thumbsize
~!Numpad4::ControlXnView(508) ;thumbsize
~!Numpad5::ControlXnView(512) ;thumbsize
~!Numpad6::ControlXnView(515) ;thumbsize
~!Numpad7::ControlXnView(516) ;thumbsize
~!Numpad8::ControlXnView(517) ;thumbsize

!+A::ControlXnView(31) ;ALT-SHIFT-A   select twain source
!A::AcquireInto()         ;ALT-A         acquire into CURRENT directory

#ifWinActive

GiveMeTrayIcon()
{
   regRead,xn,HKCR,XnView.jpg\DefaultIcon
   stringLeft,xn,xn,% instr(xn,".exe")+3
   splitPath,xn,,xndir
   ifExist,%xndir%\WebTemplate\Visuddhi - Simple\favicon.ico
      menu,tray,icon,%xndir%\WebTemplate\Visuddhi - Simple\favicon.ico
   else
      ifExist,%xn%
         menu,tray,icon,%xn%,0
}

ControlXnView(cmd)
{
   ControlGetFocus,ctl
   if (InStr(ctl,"Edit"))
      return
   sendMessage,273,%cmd%,0
}

;######################################################
;406 thumbs
;407 icons
;408 details
;409 list
;410 thumbs and labels
;411 thumbs and desc
;
;sort:
;413 name
;414 name numeric
;415 ext
;416 date
;417 type
;418 filesize
;419 image size
;420 image width
;421 image height
;422 descript
;423 comment embedded
;424 rating
;425 exif date
;426 ascending
;427 descend
;
;filters
;428 images
;429 videos
;430 sounds
;431 archives
;432 all
;433 custom
;
;520-528 layout
;500-517 thumbnail size
;
;611 show tag box
;
;480: treepane: FOLDERS
;481: treepane: favorites
;482: treepane: categories
;
;711: preview pane: Properties
;712: preview pane: Histogram
;
;170: no Fit
;172: fit image to window
;173: fit image to window large only
;176: fit image to window width
;178: fit image to window height
;
;490: jpeg lossless rotate 180
;151: jpeg lossless DIALOG (CtrlJ now)
;
;469: batch rename
;
;30977: zip pack
;
;602: find similar files
;
;30: acquire twain
;31: select twain source
;32: acquire into
;604: acquire WIA
;
;31744-31753: File->recent file ##

AcquireInto() ;; invoke AcquireInto... set to CurrentFolder ;;
              ;; Start Index is set to ensure that files won't be overwritten
{
   ; get current dir from browser
   ControlGetText,curDir,Edit1

   ; invoke AcquireInto dialog, wait up to 2 secs until it's active
   postMessage,273,32,0
   winWaitActive,Batch scanning ahk_class #32770,,2

   ifWinActive,Batch scanning ahk_class #32770
   {
      ; set target path to current folder from browser
      ; and move caret to the end, to make the most meaningful part of the path visible
      ControlSetText,Edit1,%curDir%
      ControlSend,Edit1,{END}

      ; read sequence parameters from acquireInto dialog box
      ControlGetText,prefix,Edit2
      ControlGetText,seqStart,Edit3
      ControlGet,seqLen,Choice,,ComboBox1
      ControlGet,format,Choice,,ComboBox3
      stringLeft,format,format,% instr(format," ")-1
      format:="." format
      if (substr(curDir,0,1)<>"\")
         curDir:=CurDir "\"

      varSetCapacity(seqMask,seqLen,asc("?"))
      stringLeft,seqMask,seqMask,%seqLen%

      ; get files from currentdir to determine which one has the highest index
      ; with the current prefix and numeric sequence of given length
      loop,% curDir . prefix . seqMask . format
         files:=files . A_LoopFileName "`n"
      stringTrimRight,files,files,1
      sort,files

      ; get the last line - a file with the biggest index (after sort)
      i:=instr(files,"`n",true,0)
      StringTrimLeft,files,files,%i%

      ; extract just the numbers
      files:=substr(files,strlen(prefix)+1,seqLen)

      ; set dialog box "Start index" to the next value (or 1 if no files exist)
      if !(files)
         files:=0
      ControlSetText,Edit3,% files+1
   }
   return
}
Last edited by wOxxOm on Thu Mar 15, 2007 10:50 am, edited 2 times in total.
Dreamer
XnThusiast
Posts: 4608
Joined: Sun Jul 25, 2004 9:08 pm

Post by Dreamer »

Perhaps you could copy this post here, as another alternative:

http://newsgroup.xnview.com/viewtopic.p ... highlight=
Dreamer
User avatar
wOxxOm
Posts: 26
Joined: Sun Mar 11, 2007 1:29 pm
Contact:

Post by wOxxOm »

Perhaps you could copy this post here, as another alternative
I enjoy XnView only for a few months, let's give the topic some time to ripe. It's just my second day of using the script to automate XnView...btw something is updated in first post
Dreamer
XnThusiast
Posts: 4608
Joined: Sun Jul 25, 2004 9:08 pm

Post by Dreamer »

wOxxOm wrote:
Perhaps you could copy this post here, as another alternative
I enjoy XnView only for a few months, let's give the topic some time to ripe. It's just my second day of using the script to automate XnView...btw something is updated in first post
O.K.
Dreamer
Post Reply