Applies To:
  • Microsoft Windows 7 Professional v6.1.7601 32-bit
  • AutoHotkey v1.1.33.02

What?
This is a copied article just to store a permanent reference for if I ever need to build an app similar to the file explorer in the Microsoft Windows OS.

Why?
I had an app for use in MS Windows 7 to display the properties of sound files though this is also applicable to media files in general.

Windows File Explorer: Audio File Windows File Explorer: Video File

How?
So first I'm going to list a function I use called "Filexpro()", then list some examples of usage. And in the second-to-last section, I'll quickly convert a 100 nanoseconds unit to display Hours : Minutes : Seconds.

Applies to:
  • Microsoft Windows 7 Professional - Service Pack 1
  • AutoHotkey v1.1.33.02
What?
So this is the documentation for a snippet of code that will list files of a directory using an AutoHotkey GUI and display what it will name them. The app needs to rename files but append an incremented count if the name of a file already exists. The original file needs to keep its original name.

What I have
copyraw
EDIT 0_00 0_30 My File 1 00_00 00_30.txt
edIT 0_00 0_31 My File 2 00_00 00_30.txt
eDIT 0_00 0_30 My File 3 00_00 00_31.wav
My File 3.wav
My File 3 - Copy.wav
  1.  EDIT 0_00 0_30 My File 1 00_00 00_30.txt 
  2.  edIT 0_00 0_31 My File 2 00_00 00_30.txt 
  3.  eDIT 0_00 0_30 My File 3 00_00 00_31.wav 
  4.  My File 3.wav 
  5.  My File 3 - Copy.wav 
What I want
copyraw
My File 1.txt
My File 2.txt
My File 3 (2).wav
My File 3.wav
My File 3 (3).wav
  1.  My File 1.txt 
  2.  My File 2.txt 
  3.  My File 3 (2).wav 
  4.  My File 3.wav 
  5.  My File 3 (3).wav 

How?
So if you copy the following code into an AutoHotkey file and execute it, it will popup an app with 3 buttons: 1st to generate or populate a list of the files in the script directory, the 2nd to do the actual renaming. A text field is provided (defaults to A_ScriptDir) to specify what folder to scan for files. The 3rd button simply reloads the app (used mostly for testing/development). Lastly, a listview that has 2 columns: the 1st lists the files in that directory, the 2nd displays the new filenames of the files.
Category: AutoHotkey :: Article: 723

Applies To:
  • MS Windows 10 Pro v10.0.18362 Build 18362 (64-bit)
  • Google Chrome Browser v79.0.3945.88 (Official Build) (64-bit)
  • AutoHotkey v1.1.30.01
What?
This is an article to create a standalone application which lists all the Google Chrome Profiles on your Windows 10 workstation in alphabetical order.

Why?
This program will be redundant if Google ever update their Chrome browser to list the multiple profiles in alphabetical order like it used to be... but to date they have not. So I made a program that lists the profiles in alphabetical order and can be double-clicked to open the Chrome browser with that profile.

How?
So you will need to be able to run AutoHotkey or create executables from an AHK file.

Applies to:
  • Microsoft Windows 10
  • AutoHotkey 1.1.30
What?
Yay for Microsoft Windows 10 in joining the rest of the Operating Systems in implementing multiple desktops. So if you have a Mac or Linux system, you will know of a feature where you can have another virtual desktop on your device.

For those that don't know it, the feature is similar to mobile phones where you swipe left/right to reveal another screen of app icons. The same can be done to the desktop versions with open applications instead of just their icons.

Why?
MS Windows 10 has made a major step but when you close down your PC and log back in, all the applications are grouped into the one desktop. If you have a multiple monitor setup (ie. more than 1 monitor), then MS Windows will almost remember which apps were open on which screen but always on Desktop 1.

In addition, there are some developments on AutoHotkey forums where people are having difficulties opening an app on their second monitor. So I thought I'd jot down some notes here on how I've achieved this across multiple monitors... and now multiple desktops.

How?
The following example is assuming you have 3 monitors and 3 desktops. I'm going to cover the basic code to: 1) get all monitors, 2) open an app on a specified monitor, 3) switch to another desktop.

What?
So I needed to clear space on a workstation's C drive. There are other programs about and even some built-in to MS Windows that could potentially be used.

This is a quick article on how to write an AutoHotkey program to simply return the folders in the drive and display the size of all the files/folders contained within.

How?
So I'll be putting this program for download from the download section of this website but I don't expect anyone to trust an executable EXE so here's the code of what it's doing which you can copy and paste to an AutoHotkey script:

Applies to:
  • Microsoft Windows 7 Enterprise
  • AutoHotkey (see code for AHK version)

What?
Someone suggested an app that counts the days I have left serving my notice. I thought I'd go one better and have it calculate to the nearest second. I call this latest app "byeBU" and this is version 0.4 Beta (unofficial app).

Why?
Something to do...

How?

What?
So this is an article to list methods of retrieving the number of files in a folder/directory.

Why?
Why can't we just use a loop and file pattern native to the Autohotkey programming language:
copyraw
UserFolder:="C:"
-- UserFolder := RegExReplace( MyInputField, "\\$")  ; gets rid of trailing slash if required

-- Method #1
count := 0
Loop, %UserFolder%\*.*, 0, 1 
  count++

-- note for future use:
; if A_LoopFileAttrib contains H,R,S
;	continue
  1.  UserFolder:="C:" 
  2.  -- UserFolder := RegExReplace( MyInputField, "\\$")  ; gets rid of trailing slash if required 
  3.   
  4.  -- Method #1 
  5.  count :0 
  6.  Loop, %UserFolder%\*.*, 0, 1 
  7.    count++ 
  8.   
  9.  -- note for future use: 
  10.  ; if A_LoopFileAttrib contains H,R,
  11.  ;    continue 
This works fine at home on your local host on a local drive. Try using this over a networked drive and more time will be spent counting the files then the actual processing (or whatever your script is trying to do).

Category: AutoHotkey :: Article: 512

Well yes you could just use the Unicode version of Autohotkey. If you're looking for some up and down arrows which is all I wanted, then you don't have to use Unicode and you can use the Chr() function:

copyraw
msgbox % Chr(24) ; upwards arrow
msgbox % Chr(25) ; downwards arrow, unstable
  1.  msgbox % Chr(24) ; upwards arrow 
  2.  msgbox % Chr(25) ; downwards arrow, unstable 

Category: AutoHotkey :: Article: 389

Ok so there are more fun things to do out there. If you're the type of AutoHotkey programmer that doesn't like having to use the command prompt to write to an extra text file which your program has to read, then this is for you. DllCall will usually run contained in the program and can be hidden from the end-user.

The one to rule them all:
This is a function I pulled from the Autohotkey forums submitted by SKAN which lists all the functions for a specified Dynamic Link Library (DLL) along with an inputbox for convenience:

As you can tell these are my messed up functions that convert dates into seconds and vice-versa. They're a little disorganised but they're the ones I copy and paste to my scripts then modify.

In it's straightforward form
copyraw
FormatTime( TimeString, Format )
{
     FormatTime, FormattedTime , TimeString, %Format% 
     return Formattedtime
}
  1.  FormatTime( TimeString, Format ) 
  2.  { 
  3.       FormatTime, FormattedTime , TimeString, %Format% 
  4.       return Formattedtime 
  5.  } 


Category: AutoHotkey :: Article: 384

Just a quick note as I use this function in various scripts. This adds the 1000th separator comma:

    	FormatAddCommas(val) {
    		Result:=val
    		StringLen, OutputVar, Result
    		NumLoop := (OutputVar // 3)
    		DNum = 3
    		Loop, % (NumLoop+1)
    		{
    		   StringRight,Digit,Result,%DNum%
    		   StringReplace, Result, Result, %Digit%,`,%Digit%
    		   DNum += 4
    		}
    		StringLen, OutputVar, Result
    		Loop, %OutputVar%
    		{
    			FirstChar:=Substr(Result, 1, 1)
    			IfEqual, FirstChar, `,
    			{
    				Result:=Substr(Result, 2)
    			} else {
    				break
    			}
    		}
    		Return Result
    	}

Credit where Credit is Due:


Feel free to copy, redistribute and share this information. All that we ask is that you attribute credit and possibly even a link back to this website as it really helps in our search engine rankings.

Disclaimer: Please note that the information provided on this website is intended for informational purposes only and does not represent a warranty. The opinions expressed are those of the author only. We recommend testing any solutions in a development environment before implementing them in production. The articles are based on our good faith efforts and were current at the time of writing, reflecting our practical experience in a commercial setting.

Thank you for visiting and, as always, we hope this website was of some use to you!

Kind Regards,

Joel Lipman
www.joellipman.com

RSS Feed

Related Articles

Joes Revolver Map

Joes Word Cloud

data   name   would   work   parameter   client   system   time   files   record   list   script   source   uploaded   license   form   mysql   windows   used   database   code   field   file   function   using   page   table   following   creator   value   joomla   zoho   report   version   where   website   create   need   user   find   error   display   order   first   note   date   server   case   deluge   added   JoelLipman.Com

Accreditation

Badge - Certified Zoho Creator Associate
Badge - Certified Zoho Creator Associate

Donate & Support

If you like my content, and would like to support this sharing site, feel free to donate using a method below:

Paypal:
Donate to Joel Lipman via PayPal

Bitcoin:
Donate to Joel Lipman with Bitcoin bc1qf6elrdxc968h0k673l2djc9wrpazhqtxw8qqp4

Ethereum:
Donate to Joel Lipman with Ethereum 0xb038962F3809b425D661EF5D22294Cf45E02FebF
© 2024 Joel Lipman .com. All Rights Reserved.