Scolring - Forum

Entraides et échanges autour de la technologie Scol - Informations and exchanges on the Scol technology

Vous pouvez changer la langue de l'interface une fois inscrit - You can change the language once registered

You are not logged in.

#1 17-Oct-2013 10:56:14

wahyu118
Member
From: jakarta
Registered: 6-Feb-2013
Posts: 35

screenshot on openspad3d

hii ... guys. I want to ask for help about this script.

  let strcatn filePrefix :: (strtrim strreplace (strreplace (ctime time) "" "_") ":" "-") :: ". jpg" :: nil -> file in

that script exist in the plugin screenshot.
what can I rename photo files by time but not on second.

for example:
-> Mon_oct_07_11-49-59_2013.jpg I want to change into mon_oct_07_11-49_2013.jpg

thnks guys

Offline

#2 17-Oct-2013 13:20:38

iri
Admin. / Scol language & Scol apps developer
From: France
Registered: 22-Feb-2009
Posts: 2,024
Website

Re: screenshot on openspad3d

Hi,

ctime time returns this string.
So, to obtains what you want, you should write something like that :

fun getWeekDayName (weekday)=
    if weekday ==  0 then "sunday"
     else if weekday == 1 then "monday"
     else if weekday == 2 then "tuesday"
     else if weekday == 3 then "wednesday"
     else if weekday == 4 then "thursday"
     else if weekday == 5 then "friday"
     else "saturday";;

fun getMonthName (month)=
    if month == 1 then "january"
    else if month == 2 then "february"
    /* to do continue ... */
    else "december";;

fun deleteOb(inst)=
  0;;

fun cbTakeShot(inst, from, action, param, rep, filePrefix) =
  let V3DgetSessionView c3dXsession -> viewstr in
  /*let strcatn filePrefix::(strtrim strreplace (strreplace (ctime time) " " "_") ":" "-")::".png"::nil -> file in*/
  let gmtime time -> [seconds minuts hours days months year weekday _] in
  let strcatn filePrefix :: (getWeekDayName  weekday) :: "_" :: (getMonthName months) :: (itoa days) :: "_" :: (itoa hours) :: "_" :: (itoa minuts) :: "_" :: (itoa year) :: ".jpg" :: nil -> file in
  (
    if (SO3BufferWriteContent viewstr.V3D_buffer (_getmodifypack file)) == nil then nil else
      _DMSevent this (getPluginInstanceEvent inst "Saved") file nil;
  ); 
  0;;

fun newOb(inst)=  
  let (getPluginInstanceParam inst "filePrefix") -> filePrefix in
  let if filePrefix == nil then "screenshots/" else filePrefix -> filePrefix in
    PluginRegisterAction inst "Take shot" mkfun6 @cbTakeShot filePrefix;
  setPluginInstanceCbDel inst @deleteOb;
  0;;

fun IniPlug(file)=
  PlugRegister @newOb nil;
  setPluginEditor @dynamicedit;
  0;;

gmtime uses the GMT/UTC time
localtime uses your local time.
More infos here :
http://www.scolring.org/files/doc_html/gmtime.html
http://www.scolring.org/files/doc_html/localtime.html

You can modify the string as you want.

Offline

#3 21-Oct-2013 03:56:30

wahyu118
Member
From: jakarta
Registered: 6-Feb-2013
Posts: 35

Re: screenshot on openspad3d

hy iri,
I've tried and succeeded

thnks very much.

Offline

Board footer

Powered by FluxBB