AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Capture screeshots with a nice GUI (and IrfanView)
Goto page Previous  1, 2, 3, 4  Next
 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions
View previous topic :: View next topic  
Author Message
corrupt



Joined: 29 Dec 2004
Posts: 2397

PostPosted: Mon Sep 12, 2005 8:14 am    Post subject: Reply with quote

Very Nice Very Happy

Requests Wink :
- Ask to create destination directory if it doesn't exist
- Open destination folder option
- Show GUI option in Tray menu


Bugs Question :
- Preview didn't work when the script was run for the first time (was there but the window was not tall enough to display it)
- Region only works once. After that the script must be restarted to select a different region. However, Capture Redo will capture the same region of the screen again until a different capture option has been used.
Back to top
View user's profile Send private message Visit poster's website
toralf



Joined: 31 Jan 2005
Posts: 3842
Location: Bremen, Germany

PostPosted: Mon Sep 12, 2005 8:36 am    Post subject: Reply with quote

What AHK version are you using? You must have the latest. If you don't this might explain the region problem.

Quote:
- Ask to create destination directory if it doesn't exist
User can select a path with the FolderSelect dialog and also add new folders. I prefer it that way, since it prevents wrong spellings of existing paths. These missspellings would otherwise lead to multiple paths which should be identical. If you want you can set the edit field read only.
Secondly it is a lot of code if you want capture if the user has added a complete path e.g. C:\t\s\u\v\w\x, where all folders do not exist. Then AHK would have to go through all of them and create them individually.
Could you suggest a code freagment with feedback to the user that does this nicely?

Quote:
- Open destination folder option
I do not understand, could you please clarify?

Quote:
- Show GUI option in Tray menu
I do not what to make the Tray menu too big, so I just put the basic stuff in there. The options have to be set in the GUI.
_________________
Ciao
toralf
Back to top
View user's profile Send private message Send e-mail Visit poster's website
corrupt



Joined: 29 Dec 2004
Posts: 2397

PostPosted: Mon Sep 12, 2005 9:09 am    Post subject: Reply with quote

toralf wrote:
What AHK version are you using? You must have the latest. If you don't this might explain the region problem.

1.0.38.00


toralf wrote:
Quote:
- Open destination folder option
I do not understand, could you please clarify?

A Button or menu option to open the folder that contains the captured images. If I was to capture a few images it would be great to have quick access to where they are stored when finshed instead of having to open explorer and browse to the folder manually Smile .

toralf wrote:
I do not what to make the Tray menu too big, so I just put the basic stuff in there. The options have to be set in the GUI.

I can understand that but If I want to change te path and/or filename I cannot seem to get to the gui unless I choose to capture something or choose Options then click cancel.
Back to top
View user's profile Send private message Visit poster's website
toralf



Joined: 31 Jan 2005
Posts: 3842
Location: Bremen, Germany

PostPosted: Mon Sep 12, 2005 11:36 am    Post subject: Reply with quote

corrupt wrote:
1.0.38.00
you'll need 1.0.38.02

Quote:
A Button or menu option to open the folder that contains the captured images. If I was to capture a few images it would be great to have quick access to where they are stored when finshed instead of having to open explorer and browse to the folder manually.
That is a good idea. Whould it be ok, to have a button that opens the path in the explorer. Or would it need more options? What would be a good caption for that button? "Go"? "Dest."? "Open"?
I would place it next to the Options button.

Quote:
If I want to change te path and/or filename I cannot seem to get to the gui unless I choose to capture something or choose Options then click cancel.
Good point, I will add a tray menu to show the Gui.
_________________
Ciao
toralf
Back to top
View user's profile Send private message Send e-mail Visit poster's website
toralf



Joined: 31 Jan 2005
Posts: 3842
Location: Bremen, Germany

PostPosted: Mon Sep 12, 2005 12:31 pm    Post subject: Reply with quote

I have updated the first post:
050912: New tray option to show Gui (thanks corrupt)
050912: New Gui button and tray option to open destination (thanks corrupt)
_________________
Ciao
toralf
Back to top
View user's profile Send private message Send e-mail Visit poster's website
corrupt



Joined: 29 Dec 2004
Posts: 2397

PostPosted: Tue Sep 13, 2005 3:53 am    Post subject: Reply with quote

Thanks toralf Smile . I updated to the latest version of AHK (1.0.38.03), updated to your latest version and now Region now seems to work great. Thanks for adding a couple of the suggested options also. This script is very handy Very Happy .
Back to top
View user's profile Send private message Visit poster's website
not-logged-in-daonlyfreez
Guest





PostPosted: Tue Sep 13, 2005 12:51 pm    Post subject: Reply with quote

Very nice script... Cool

I changed the start of the script a bit, to try to get the path to IrfanView if installed, couldn't find no useable registry information to check for. The next step would be to offer the option of downloading and installing IrfanView if not found, which can be done silent with command line commands...:

Quote:
IrfanViewDefault = %programfiles%\IrfanView\i_view32.exe
StartCenterIni = %A_ScriptName%.ini
IniRead, ExeCapture, %StartCenterIni%, EasyCopy, ExeCapture, i_view32.exe
If not FileExist(ExeCapture)
{
If FileExist(IrfanViewDefault)
ExeCapture = %IrfanViewDefault%
else

{
FileSelectFile, ExeCapture , 3,%systemdrive%, Please select the executable of IrfanView (i_view32.exe), Executables (*.exe)
If ( not FileExist(ExeCapture) or not ExeCapture )
{
MsgBox, 16, IrfanView not found,The executable of Irfanview couldn't be found.`n`nThe script will exit now.`n`nYou can get IrfanView from here:`n`nhttp://www.irfanview.com/
ExitApp
}
}
IniWrite, %ExeCapture%, %StartCenterIni%, EasyCopy, ExeCapture
}


Two questions:

- Could you add built in Help?
- Would it be possible to do all this without IrfanView? With dll-calls maybe?
Back to top
toralf



Joined: 31 Jan 2005
Posts: 3842
Location: Bremen, Germany

PostPosted: Tue Sep 13, 2005 4:14 pm    Post subject: Reply with quote

not-logged-in-daonlyfreez wrote:
I changed the start of the script a bit,
Thank you for the suggestion. but I will not add this to the script, since I assume that the user already has Irfanview installed.

Quote:
- Could you add built in Help?
I do not know on what help is needed. I tried to make everything selfexplaining. If not, let me know.

Quote:
- Would it be possible to do all this without IrfanView? With dll-calls maybe?
Yes, I assume it is possible. But I didn't want to reinvent the wheel, and since IrfanView has a lot of options, why should I do it? If you have further questions have a talk with shimanov or see the topic on "drag a frame on screen" it contains some examples on how it would be possible.

Thanks
_________________
Ciao
toralf
Back to top
View user's profile Send private message Send e-mail Visit poster's website
shimanov
Guest





PostPosted: Tue Sep 13, 2005 9:14 pm    Post subject: known locations for IrfanView path Reply with quote

The following registry keys should be present in all default (or otherwise) installs of IrfanView. You may consider checking these keys, before asking a user to manually select the location of the program.

Code:
[HKEY_CLASSES_ROOT\Applications\i_view32.exe\shell\open\command]
@=""C:\Program Files\IrfanView\I_VIEW32.EXE" "%1""

[HKEY_CLASSES_ROOT\IrfanView\shell\open\command]
@=""C:\Program Files\IrfanView\I_VIEW32.EXE" "%1""

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Applications\i_view32.exe\shell\open\command]
@=""C:\Program Files\IrfanView\I_VIEW32.EXE" "%1""

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\IrfanView\shell\open\command]
@=""C:\Program Files\IrfanView\I_VIEW32.EXE" "%1""

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\IrfanView]
"UninstallString"="C:\Program Files\IrfanView\iv_uninstall.exe"


Hope this is helpful.
Back to top
olaf



Joined: 20 Apr 2005
Posts: 25

PostPosted: Sat Sep 17, 2005 8:43 am    Post subject: Re: known locations for IrfanView path Reply with quote

Great tool.
another suggestion.
png format with 0-9 compression option?

q: script seems to work even though Effects.dll is not in the same directory asi_view32.exe.
Back to top
View user's profile Send private message
toralf



Joined: 31 Jan 2005
Posts: 3842
Location: Bremen, Germany

PostPosted: Mon Sep 19, 2005 9:00 am    Post subject: Re: known locations for IrfanView path Reply with quote

olaf wrote:
another suggestion.
png format with 0-9 compression option?
This is not possible, since IrfanView doesn't support it as an commandline option.

Quote:
q: script seems to work even though Effects.dll is not in the same directory asi_view32.exe.
It will work if you do not use all options the script provides. I do not remember exactly for which options it is needed, but I guess it was for sharpen and contrast.
_________________
Ciao
toralf
Back to top
View user's profile Send private message Send e-mail Visit poster's website
hps



Joined: 19 Aug 2005
Posts: 14
Location: Germany

PostPosted: Thu Sep 22, 2005 3:47 pm    Post subject: Capture region on multiple screens again Reply with quote

Hi Toralf

toralf wrote:

I wonder what B_ScreenWidth and B_ScreenHeight are.

you missed the important lines:
Code:

;create transparent GUI covering the whole screen
  [b]Sysget[/b],B_ScreenWidth,78
  [b]Sysget[/b],B_ScreenHeight,79

I created two new variables B_ScreenWidth and B_ScreenHeight with the
Sysget command. They hold the width and heiight of the virtual, multi-monitor screen. I changed all further references of A_Screen.... to B_Screen... in your script.
toralf wrote:

Regarding Irfanview: I do not know how to fix it.

this is the answer from Irfan:
Quote:

Hi Hans,

Danke Smile
Ok, habe uebersehen, wird geaendert Wink

Greetings,
Gruesse,
Pozdrav,

Irfan


I will wait for the new Irfanview version, adapt your actual version of the script, and post again here.
Back to top
View user's profile Send private message
toralf



Joined: 31 Jan 2005
Posts: 3842
Location: Bremen, Germany

PostPosted: Thu Sep 22, 2005 3:57 pm    Post subject: Reply with quote

Thanks HPS,

You are right I didn't see the SysGet.

It is great that you contacted Irfan and that they fix it.

Thank you for the follow up.
_________________
Ciao
toralf
Back to top
View user's profile Send private message Send e-mail Visit poster's website
hps



Joined: 19 Aug 2005
Posts: 14
Location: Germany

PostPosted: Fri Sep 23, 2005 10:44 am    Post subject: last post is from hps Reply with quote

Hi Toralf,

I have implemented some nice ( for me ) features

hard coded:
- Show Easycopy in Tray toggles show/hide
- edit button to open the last saved file in Irfanview

configurable:
- do not show Gui after capture
- do not show Gui on startup
- show/hide Gui by single click on tray icon
hide by right click on titlebar ( instead of rollup/down )
- open button shows irfanview thumbnails instead of folder


I have used HyperSnap as screencopy program until now,
and I am accustomed to these features.

moved up before " ;tray menu " :
Code:
;get previous settings
GoSub, ReadDefaultsFromIni


adapted code snippets :
Code:
Menu, Tray, Default, Show EasyCopy
If ShowGuiWithSingleCLick
 Menu, Tray, Click, 1

Code:

  Gui, 1:Add, Checkbox, xm y+6 Section vChkShowPreview Checked%ChkShowPreview%, preview
  Gui, 1:Add, Button, ys-5 vBtnEdit gBtnEdit , Edit 
  Gui, 1:Add, Button, ys-5 vBtnSave gBtnSave Disabled, Save

Code:
  ;get Gui width and height for Resize of Preview
  WinGetPos, , , Gui1Width, Gui1Height, %WinNameGui1%
  If HideGuiOnStart
  Gui, 1:Hide

Code:
ReadDefaultsFromIni:
  IniRead, HideGuiOnStart, %StartCenterIni%, EasyCopy, HideGuiOnStart, 1   
  IniRead, HideGuiAfterCapture, %StartCenterIni%, EasyCopy, HideGuiAfterCapture, 1
  IniRead, ShowGuiWithSingleCLick, %StartCenterIni%, EasyCopy,ShowGuiWithSingleCLick, 1
  IniRead, OpenThumbsInsteadofFolder, %StartCenterIni%, EasyCopy,OpenThumbsInsteadofFolder, 1
  IniRead, EdtPath,        %StartCenterIni%, EasyCopy, EdtPath,        %PathProjects%

Code:

;#############   Close Gui 1  and save settings   #############################
GuiEscape:
GuiClose:
  Gui, 1: Submit
  IniWrite, %EdtPath%,        %StartCenterIni%, EasyCopy, EdtPath
  IniWrite, %EdtFileName%,    %StartCenterIni%, EasyCopy, EdtFileName
  IniWrite, %ChkShowPreview%, %StartCenterIni%, EasyCopy, ChkShowPreview
  Gui, 1:Show
  WinGetPos, PosX, PosY, SizeW, SizeH, %WinNameGui1%
  IniWrite, x%PosX% y%PosY%, %StartCenterIni%, EasyCopy, Pos_Gui1
  ExitApp
Return

Code:
;#############   Show Gui1 from Tray menu   ###################################
RollWindowUp:
  If not ShowGuiWithSingleCLick
   {
     GoSub,RollWindowUpNoHide
     return
   }
  MouseGetPos, , , GuiID
  If ( Gui1UniqueID <> GuiID )
   {
   Send, {Rbutton}
   return
   }
TrayShowGui:
IfWinExist, ahk_id %Gui1UniqueID%
  Gui, 1:Hide
else
  Gui, 1:Show
Return


Code:
;#############   Open destination folder in explorer   ########################
BtnOpen:
  Gui, 1: Submit, NoHide
  If OpenThumbsInsteadofFolder
     Run, %ExeCapture% "%EdtPath%" /thumbs
  else
     Run, explorer /e`,"%EdtPath%"
Return


Code:
;#############   Roll Gui 1 up to its titlebar   ##############################
RollWindowUpNoHide:

Code:
  Gui, 2:Add, Tab, xm w360 r7 Section, Misc|Lines|ShortCuts|Quality|Save|ShowHide

Code:
    Gui, 2:Tab, ShowHide
      Gui, 2:Add,Checkbox,xs+10 ys+30 vHideGuiOnStart Checked%HideGuiOnStart%,Hide Gui on Startup
      Gui, 2:Add,Checkbox, xs+10 ys+60 vHideGuiAfterCapture Checked%HideGuiAfterCapture%, Hide Gui after capture
      Gui, 2:Add,Checkbox, xs+10 ys+90 vShowGuiWithSingleCLick Checked%ShowGuiWithSingleCLick%, Show Gui with single

click on tray icon`nhide with right click on titlebar
      Gui, 2:Add,Checkbox, xs+10 ys+120 vOpenThumbsInsteadofFolder Checked%OpenThumbsInsteadofFolder%, Open button shows Irfanview thumbnails instead of explorer folder

Code:
  ;store options to ini
  IniWrite, %HideGuiOnStart%, %StartCenterIni%, EasyCopy, HideGuiOnStart
  IniWrite, %HideGuiAfterCapture%, %StartCenterIni%, EasyCopy, HideGuiAfterCapture
  IniWrite, %ShowGuiWithSingleCLick%, %StartCenterIni%, EasyCopy, ShowGuiWithSingleCLick
  IniWrite, %OpenThumbsInsteadofFolder%, %StartCenterIni%, EasyCopy, OpenThumbsInsteadofFolder
  IniWrite, %ChkAutoNumber%, %StartCenterIni%, EasyCopy, ChkAutoNumber

Code:
  Else ;no preview wanted
    {
      ;give feedback
      LastSavedFile = %FileNameForImage%
      ToolTip, ScreenShot saved as`n%FileNameForImage%


Code:
  ;show Gui, autosize to fit preview (added, new or delted)
  If not HideGuiAfterCapture
   Gui, 1:Show, AutoSize 


Code:
          ;copy preview image to destination image with overwrite
          FileCopy, %PreViewFileName%, %FileNameForImage% , 1
          LastSavedFile= %FileNameForImage%
          ;give feedback

Code:
BtnEdit:
  ;get path and filename
  Gui, 1:Submit, NoHide
  run,%ExeCapture% %lastSavedFile%

Return

Code:
  Else ;no preview wanted
    {
      ;give feedback
      LastSavedFile = %FileNameForImage%
      ToolTip, ScreenShot saved as`n%FileNameForImage%

Code:
  ;show Gui, autosize to fit preview (added, new or delted)
  If not HideGuiAfterCapture
   Gui, 1:Show, AutoSize
  ;memorize this as last action
  RedoBuffer = CaptureRegion
Back to top
View user's profile Send private message
toralf



Joined: 31 Jan 2005
Posts: 3842
Location: Bremen, Germany

PostPosted: Fri Sep 23, 2005 11:46 am    Post subject: Reply with quote

Could you please send me your complete code? I'll add it to the first post.
Have you also implemented the multi screen capture?
_________________
Ciao
toralf
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions All times are GMT
Goto page Previous  1, 2, 3, 4  Next
Page 3 of 4

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group