FlareRenamer - program to rename files

Post

Posted
Rating:
#1 (In Topic #811)
Avatar
Trainee
henry15ea is in the usergroup ‘Trainee’
Hello good day to all, this publication is to present a program that I recently finished , its name is FlareRenamer , it is a program that will help us to work with the names of the files that we have in a directory or that we add in the program, we can apply different filters as .

   *  File name in Lower Case, Upper Case, Capitalize .
   * Find and replace word.
   * Number the files .
   * Add date .
   * Add a name for all files(The numbering is enabled to avoid collisions).
   * Different languages available.
   * File filtering by extension.

The program has the RPM and DEB packages . also an OBS repository is available for openSUSE distributions where projects will be uploaded much faster . without further ado I leave you the address of the blog I made so you know about it . many thanks, suggestions to improve the program can be made at the following address.

henry151ea@yandex.com

<IMG src="https://blogger.googleusercontent.com/img/a/AVvXsEh5xnpV4jkxBWzySmf5BggM3LmT11lS2Bgh-0x6Kw_ELKwfvdkRJ6qd2i47z2u_zxwJWoCgVJmdYJqk0oXzl33GFXrpjCPHcjtjHltPbbuHaNxijTeKevWlvGPTVaKI0TdSgHWEoAkpLwlWzBNFLb-r6HREkVggTZUGdDQ9RIW4XVkE8S2NR5DP__YH=s1280"> </IMG>

as well in the blog or in this publication.
project link
 https://sourceforge.net/projects/flarerenamer/

blog in Spanish about the program https://areadevsoft.blogspot.com/
Online now: No Back to the top

Post

Posted
Rating:
#2
Avatar
Guru
cogier is in the usergroup ‘Guru’
cogier is in the usergroup ‘GambOS Contributor’
I tried your program but it crashed here: -

<IMG src="https://www.cogier.com/gambas/FlareRenamer.png"> </IMG>
Online now: No Back to the top

Post

Posted
Rating:
#3
Avatar
Trainee
henry15ea is in the usergroup ‘Trainee’
 many thanks for trying the program, it would help me a lot to know what version of package I install, if it was in rpm or the version of packages .deb, the problem is due to the lack of icon libraries .

I attach the necessary libraries and the path where it should go .


/home/henryguzman/.local/share/gambas3/lib/areadev

create folder "areadev" if not exists and change "henryguzman" by your username.


this will help me to know if the problem is when copying the libraries, again I appreciate your response in the forum.

Attachment

unzip the libs file.zip in the following path

home/henryguzman/.local/share/gambas3/lib/areadev

Online now: No Back to the top

Post

Posted
Rating:
#4
Banned
 I think you should do away with easy_icons lib and use gambas routines.

You should be able to accomplish all the easy icons lib does with gb.desktop

Desktop.GetFileIcon(sFilePath, iSize)

DesktopMime.FromFile(sFilePath).GetIcon(iSize)

Various other means

Why exactly do yo use the easy icons lib and not gambas routines?
Online now: No Back to the top

Post

Posted
Rating:
#5
Banned
Another Icon searching function for you….
(I use this class in my apps and call SearchIcons() it works for things like gambas.desktop where the icon and exe name set have no path set, just 'gambas3')


Code (gambas)

  1. ' Gambas class file
  2.  
  3.  
  4.  
  5. Public Sub SearchIcons(name As String, Optional PreferedTheme As String) As String
  6.  
  7.   Dim sTheme, sPrefered As String
  8.  
  9.   Shell "gsettings get org.gnome.desktop.interface icon-theme | tr -d \"'\"" Wait To sTheme
  10.   sTheme = "/" & RTrim(sTheme)
  11.  
  12.   If PreferedTheme Then sPrefered = GetPeferedIcon("/" & PreferedTheme, name)
  13.  
  14.   If Not sPrefered Then sPrefered = GetPeferedIcon(sTheme, name)
  15.  
  16.   ' If Not sPrefered Then sPrefered = GetPeferedIcon("/hicolor", name)
  17.   If Not sPrefered Then sPrefered = GetPeferedIcon("", name)
  18.  
  19.   Return sPrefered
  20.  
  21.  
  22. Private Sub GetPeferedIcon(theme As String, name As String) As String
  23.  
  24.   Dim sRet, sPrefered As String = "", sList, sPth As String[], c, maxsize As Integer
  25.  
  26.   Shell "find /usr/share/icons" & theme & "/ -name '" & name & ".*'" Wait To sRet
  27.   If sRet Then
  28.     sList = Split(RTrim(sRet), "\n")
  29.     If sList.Count = 1 Then Return sList[0]
  30.  
  31.     For c = 0 To sList.Max
  32.       sPth = Split(Right(sList[c], -17), "/")
  33.       If sPth.Count > 1 Then
  34.         If String.Mid(sPth[1], (sPth[1].Len / 2) + 1, 1) = "x" Then
  35.           sPth = Split(sPth[1], "x")
  36.           If Val(sPth[0]) > maxsize Then
  37.             maxsize = Val(sPth[0])
  38.             sPrefered = sList[c]
  39.           Endif
  40.         Endif
  41.       Endif
  42.       If Not maxsize Then sPrefered = sList[c]
  43.     Next
  44.  
  45.  
  46.   Return sPrefered
  47.  
  48.  
Online now: No Back to the top

Post

Posted
Rating:
#6
Avatar
Trainee
henry15ea is in the usergroup ‘Trainee’
Many thanks, I have solved the problem, since the installation file did not make the copy of the required libraries , there was also a problem of copying translation files to the destination configuration directory , I will take into account your tips .
Online now: No Back to the top

Post

Posted
Rating:
#7
Avatar
Enthusiast
PJBlack is in the usergroup ‘Enthusiast’
Image

(Click to enlarge)


second time i try … second version that did not work …
Online now: No Back to the top

Post

Posted
Rating:
#8
Banned
Here is a function from one of my apps (a file browser) that lists a folder and get's icons for all items.
It checks if a file is a .desktop file and uses it's Icon= field anf if not it uses methods to get defaults.

Maybe it will help.
(Ps, the AppIcon class is the class i posted in the previous posts)

Code (gambas)

  1. Public Sub LoadPath(Directory As String)
  2.  
  3.   $iIconSize = Me.IconSize
  4.   If Not pDirIcon Then pDirIcon = Picture["icon:/128/directory"]
  5.  
  6.   If Directory Then $sPath = Directory Else Return ' Directory = User.Home
  7.   $sItems = Dir(Directory).Sort(gb.Ascent + gb.IgnoreCase + gb.Natural)
  8.  
  9.   Dim sDirs As New String[]
  10.   Dim sFiles As New String[]
  11.   Dim  ic As Picture, df As MyDesktopFile, sVar As String, icA As New Collection
  12.  
  13.   For Each sVar In $sItems
  14.     df = Null
  15.     ic = Null
  16.  
  17.     If IsDir($sPath &/ sVar) Then
  18.       ic = pDirIcon.Image.Stretch($iIconSize, $iIconSize).Picture
  19.       sDirs.Add(sVar)
  20.     Else
  21.       Select LCase(File.Ext(sVar))
  22.         Case "zip", "tar", "gz", "bzip", "rar", "ace"
  23.           ic = Picture["icon:/" & $iIconSize & "/archive"]
  24.  
  25.         Case "desktop"
  26.           df = New MyDesktopFile($sPath &/ sVar)
  27.           If Not df Then Continue
  28.  
  29.           If (Not Exist(df.Icon)) Or If (Not InStr(df.Icon, "/")) Then
  30.             Dim sIcon As String = AppIcon.SearchIcons(df.Icon, Style.Name)
  31.             If sIcon And Exist(sIcon) Then df.Icon = sIcon
  32.           Endif
  33.           Try ic = Image.Load(df.Icon).Stretch($iIconSize, $iIconSize).Picture
  34.           sFiles.Add(sVar)
  35.         Case "png", "jpg", "bmp", "jpeg"
  36.           Try ic = Image.Load($sPath &/ sVar).Stretch($iIconSize, $iIconSize).Picture
  37.           sFiles.Add(sVar)
  38.  
  39.         Case Else
  40.           Dim mt As DesktopMime
  41.           mt = DesktopMime.FromFile($sPath &/ sVar)
  42.           If mt.Type Like "*x-compressed*" Then
  43.             ic = Picture["icon:/" & $iIconSize & "/archive"]
  44.           Else
  45.             ic = Desktop.GetFileIcon($sPath &/ sVar, $iIconSize)
  46.           Endif
  47.           sFiles.Add(sVar)
  48.       End Select
  49.     Endif
  50.  
  51.     If Not ic Then ic = Desktop.GetFileIcon($sPath &/ sVar, $iIconSize)
  52.     If Not ic Then ic = Stock["128/file"].Image.Stretch($iIconSize, $iIconSize).Picture
  53.  
  54.   ' add the icon picture to the collection under it's file name
  55.    icA.Add(ic, sVar)
  56.  
  57.   Next
  58.  
  59. '  create icons either naturally or dir's first
  60.  
  61.   Object.Lock($hView)
  62.   If $bDirsFirst Then
  63.  
  64.     For Each s As String In sDirs
  65.       mf = New MyIcon($hView, Directory &/ s, icA[s]) As "Icon"
  66.       mf.Visible = If(Left(s) = ".", $bShowHidden, True)
  67.       AddToGrid(mf)
  68.       mf.Menu = "mnuEdit"
  69.     Next
  70.     For Each s As String In sFiles
  71.       mf = New MyIcon($hView, Directory &/ s, icA[s]) As "Icon"
  72.       mf.Visible = If(Left(s) = ".", $bShowHidden, True)
  73.       mf.Menu = "mnuEdit"
  74.        AddToGrid(mf)
  75.     Next
  76.  
  77.   Else
  78.     For Each s As String In $sItems
  79.       mf = New MyIcon($hView, Directory &/ s, icA[s]) As "Icon"
  80.       mf.Visible = If(Left(s) = ".", $bShowHidden, True)
  81.       mf.Menu = "mnuEdit"
  82.       AddToGrid(mf)
  83.     Next
  84.  
  85.   $hView.Refresh
  86.   $hView.Scroll(iScroll[0], iScroll[1])
  87.   Raise Loaded
  88.  
  89.   Debug Error.Text & gb.Lf & Error.Backtrace.Join("\n") & "'''"
  90.  
  91.  
Online now: No Back to the top

Post

Posted
Rating:
#9
Avatar
Trainee
henry15ea is in the usergroup ‘Trainee’
 i've been reviewing and trying to maintain the icon library, but as you say I'm going to remove the libraries and I'm going to check if I can load the icons with the example I put here, the versions in sourceforge remove them until all the modifications are complete . thank you for taking the time to test .
Online now: No Back to the top

Post

Posted
Rating:
#10
Banned

henry15ea said

i've been reviewing and trying to maintain the icon library, but as you say I'm going to remove the libraries and I'm going to check if I can load the icons with the example I put here, the versions in sourceforge remove them until all the modifications are complete . thank you for taking the time to test .

Honestly dude forget about libraries , nothing but headaches and lots of time trying to explain to people how to install them.

Here's a present for ya..

I just made a simple app that has a FileChooser object , just click a file and it loads it's icon at the bottom.

It has a function LoadIcon(Path As String)
It's basically the code i sent before but all cleaned up

It finds the icon and loads it into PictureBox1

You can see the difference in the picturebox and the filechooser icons, FileChooser just uses Desktop.GetFileIcon() i think.

My function checks .desktop files and loads their icons and also loads image icons as previews.

for a faster app just use a set (existing) icon size like 32 and change all the
Picture["icon:/128/iconname"].Image.Stretch($iIconSize, $iIconSize).Picture
statements to just…
Picture["icon:/32/iconname"]

My application can use any icon size so it loads an existing 128px icon and shrinks it
Online now: No Back to the top

Post

Posted
Rating:
#11
Avatar
Trainee
henry15ea is in the usergroup ‘Trainee’
yes, as you say the libraries in Gambas are costing me a lot of work, yesterday I was doing tests with the code that you put and I have managed to load the icons very easily, now with the code that just shared I will study it to include it, if you give me permission truth .
Online now: No Back to the top

Post

Posted
Rating:
#12
Avatar
Trainee
henry15ea is in the usergroup ‘Trainee’
<IMG src="https://i.ibb.co/rxFPYJQ/ksnip-20220130-110210.png"> </IMG>

well I have implemented the code that you have placed and this is the result, it works very well   :D
Online now: No Back to the top

Post

Posted
Rating:
#13
Banned

henry15ea said

yes, as you say the libraries in Gambas are costing me a lot of work, yesterday I was doing tests with the code that you put and I have managed to load the icons very easily, now with the code that just shared I will study it to include it, if you give me permission truth .

Yes of course,
To be honest it is not the fastest of functions. I thought you would probably just want to load the loaded file to be renamed icon.
Just using Desktop.GetFileIcon(sPath, iSize, bPreview) may be much faster (but not as thorough) to load a whole dirs icons.

You're welcome :)
Online now: No Back to the top

Post

Posted
Rating:
#14
Avatar
Trainee
henry15ea is in the usergroup ‘Trainee’
thank you very much !! , a moment ago I made a new committee to the git of the project in sourceforge, I also uploaded the source code of the project so that if they can help me if it gives them more problems, well welcome the comments, I have left a section where I want to thank them and add their names because they have helped me a lot reporting the problems that existed in the previous version.
Online now: No Back to the top
1 guest and 0 members have just viewed this.