SHARE
TWEET

set-cam-time.ahk -- SQ11 MINICAM

mgis90 Apr 2nd, 2020 524 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ;SQ11 mini camera time setting script
  2. ;written and tested on ahk version 1.1.29.00 by Mgis
  3. ;this short script sets time inside a textfile stored on removable drive of connected camera
  4. ;currently a bit comparing what is exactly in the file
  5. ;and not giving user  a choice each time about watermark Y/N setting, you can set it here in the script.
  6. ;--------------------------------------
  7. ;--------------------------------------
  8.                 ;please just set next line accordingly to your drive
  9. file = E:\TIMEREST.TXT
  10.                 ;here you can set if you want N or Y option to be written
  11. yesorno=N
  12. ;--------------------------------------
  13. ;--------------------------------------
  14. #SingleInstance force
  15. replace:=false          ;variable, if the contents seem to be bad
  16.  
  17.  
  18. if FileExist(file) {
  19.     Loop, read, %file%              ;using reading loop
  20.     {
  21.         ;this is the timestamp which appears in the file when connected to pc, it seems hardcoded somehow in firmware of camera
  22.         ;it gets reset there every time.
  23.         if A_LoopReadLine contains 20180115235959
  24.             replace:=true           ;then we can overwrite it without a doubt
  25.         Break
  26.     }
  27. } else {
  28.     MsgBox,48,,File %file% doesnt seem to exist`nPlease check connection, drive letter, or in-script configured path to the file.
  29.     ExitApp
  30. }
  31.  
  32.  
  33. if replace {
  34.     GoSub,replace
  35. } else {
  36.     MsgBox,File exists but contents do not contain recognized text
  37.     ;at this point we could parse and compare the timestamp from file with current time
  38.     ;but its shorter for this script to just show those and ask user
  39.     ;Read text file into Var.
  40.     FileRead, allcontents, %file%
  41.     MsgBox,% 4+32,Answer me this,Not replacing.`n`nDo you want to replace anyway?`n`nCurrent contents:`n%allcontents%`n`nNew timestamp:`n%A_Now% %yesorno%
  42.     ;replacing anyway?
  43.     ifmsgbox,yes
  44.         GoSub,replace
  45. }
  46.  
  47. Sleep 2000
  48. ExitApp
  49. return  ;end of autoexec section
  50.  
  51.  
  52. replace:
  53.     FileDelete,%file%
  54.     ToolTip, File deleted
  55.     Sleep 1500
  56.     FileAppend,%A_Now% %yesorno%,%file%
  57.     ToolTip,Successfully set time`n`n%A_Now% %yesorno%
  58. return  ;replace
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top