Friday, April 25, 2014
   
Text Size
Login

Autohotkey Count Number of Files/Folders in a Directory

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:

  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,S 
  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).

Parse a HTML Table into a ListView

What?
A quick article on if you were given a webpage coded in HTML, what methods in AutoHotkey could you use to separate out the HTML Tables into a ListView.

Why?
I want a snippet of code that replicates any HTML table.

How?
I've been trying various ways so I'm posting them here. My opinions on them change with the weather so until I do some benchmarking I won't know which ones best:

Alternative method of displaying Unicode in Autohotkey GUI

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:


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

Fun with DllCall in AutoHotkey

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:

Functions to convert Hex 2 RGB and vice-versa

These are for autohotkey and in AHK code. Taken from Autohotkey forums topic 1878:

  • From Hexadecimal to RGB
  • From RGB to Hexadecimal
  • Check for a valid hexadecimal value

Latest Posts

  • 301 Redirect using htaccess file

    • Tue 15-Apr-14
      Further suggestion:
      RewriteRule ^(.*/)?assets/s 2dmain.html\?/( .*/)? $2 [R=301,L]
      Webmaster  
    • Thu 10-Apr-14
      Playing with some RegEx testers
      RewriteRule ^(.*\?/)?(?:$|( .+?)(?:(\.[^.]$ )|$)) $2 [R=301,L] ...
      Webmaster  
    • Wed 09-Apr-14
      I tried to redirect links from my old site to my new site, based on what I read in this thread. The old ...
      pelle
  • Joes Revolver Map (JRM)

    • Tue 22-Apr-14
      Hi Manfred, Some downloaders have reported that the version of this module intended for Joomla 2.5.x ...
      Webmaster  
    • Sun 20-Apr-14
      Hello, is it possible to use this module also in joomla 3.2? Thanks Manfred
      Manfred V.