I am completely new on AutoHotKey ..
I would like to make a Script that creates two directories
I would like the first directory to be:
2019-12-11, 01-14-56
and then two more directories inside that one:
1.- VHF Band (30-300 MHz)
2.- UHF Band (300-3,000 MHz)
I was trying to do this:
FileCreateDir, % A_Now ; Time in the Format 20191211011456
FileCreateDir, Channel Scan Date\1.- VHF Band (30-300 MHz)
FileCreateDir, Channel Scan Date\2.- UHF Band (300-3,000 MHz)
But is not working, help
AutoHotKey Script for creating a Directory with Date Topic is solved
- DieDauphin
- Posts: 4
- Joined: 11 Dec 2019, 02:06
Re: AutoHotKey Script for creating a Directory with Date
Welcome to the forum
For dynamic dates use FormatTime.
I then stored the date stamp in a variable and used an expression in the FileCreateDir commands like this:Please ask if you have questions
For dynamic dates use FormatTime.
I then stored the date stamp in a variable and used an expression in the FileCreateDir commands like this:
Code: Select all
FormatTime, DateStamp,, yyyy-MM-dd`, hh-mm-ss
; DateDir := A_ScriptDir "\" DateStamp ; to create date directory in script folder
DateDir := DateStamp
VhfDir := DateDir "\VHF Band (30-300 MHz)"
UhfDir := DateDir "\UHF Band (300-3,000 MHz)"
FileCreateDir % DateDir
FileCreateDir % VhfDir
FileCreateDir % UhfDir
- DieDauphin
- Posts: 4
- Joined: 11 Dec 2019, 02:06
Re: AutoHotKey Script for creating a Directory with Date
yes, as the matter of fact, I have some questions .. I am using a software called HDSDR and the Snipping Tool from Windows .. I am trying to do a script that cuts the screen
So, what I have to do is run HDSDR and the Snipping Tool, then make click on "New" then, it is going to happen this: and then I have to cut so that I get this image: So, this is the code I have so far
Edit by TLM: please place your code in [code][/code] tags!
But, I am not exactly sure about how should I code the other steps
So, what I have to do is run HDSDR and the Snipping Tool, then make click on "New" then, it is going to happen this: and then I have to cut so that I get this image: So, this is the code I have so far
Code: Select all
FormatTime, DateStamp,, yyyy-MM-dd`, hh-mm-ss
; DateDir := A_ScriptDir "\" DateStamp ; to create date directory in script folder
DateDir := DateStamp
VhfDir := DateDir "\1.- VHF Band (30-300 MHz)"
UhfDir := DateDir "\2.- UHF Band (300-3,000 MHz)"
FileCreateDir % DateDir
FileCreateDir % VhfDir
FileCreateDir % UhfDir
Run, C:\Program Files (x86)\HDSDR\HDSDR.exe
Run, C:\Windows\System32\SnippingTool.exe
But, I am not exactly sure about how should I code the other steps
Re: AutoHotKey Script for creating a Directory with Date
1st off when you're posting code, always use [code][/code] tags!.
2nd, it's a good idea to start a new topic for an additional question.
While you can use AutoHotkey to automate SnippingTool.exe, it can be cumbersome and even unreliable.
The good news is that there are existing scripts that can do it for you directly in AHk
For instance, take a close look at CGDipSnapShot
Assuming HDSDR.exe starts maximized, you just have to know the dimensions of the area you're trying to capture.
For example:If HDSDR doesn't start maximized, you will have to add WinGetPos after the WinWait command
and then use the WinGetPos's output variables in CGdipSnapshot()
Give it a try and let us know if you run into issues.
2nd, it's a good idea to start a new topic for an additional question.
While you can use AutoHotkey to automate SnippingTool.exe, it can be cumbersome and even unreliable.
The good news is that there are existing scripts that can do it for you directly in AHk
For instance, take a close look at CGDipSnapShot
Assuming HDSDR.exe starts maximized, you just have to know the dimensions of the area you're trying to capture.
For example:
Code: Select all
; THIS EXAMPLE ASSUMES YOU'VE INCLUDED CGDipSnapShot AND ITS DEPENDENCIES
FormatTime, DateStamp,, yyyy-MM-dd`, hh-mm-ss
DateDir := DateStamp
VhfDir := DateDir "\1.- VHF Band (30-300 MHz)"
UhfDir := DateDir "\2.- UHF Band (300-3,000 MHz)"
FileCreateDir % DateDir
FileCreateDir % VhfDir
FileCreateDir % UhfDir
Run, C:\Program Files (x86)\HDSDR\HDSDR.exe
WinWait ahk_exe HDSDR.exe ; wait for HDSDR window
; I used 433 pixels high as that was the size of your image
; feel free to adjust this if the snapshot isn't the right size!
snap := new CGdipSnapshot( 0, 0, A_ScreenWidth, 433 ) ; x, y, width, height
snap.TakeSnapshot()
snap.SaveSnapshot( "myfile.png" )
and then use the WinGetPos's output variables in CGdipSnapshot()
Give it a try and let us know if you run into issues.
- DieDauphin
- Posts: 4
- Joined: 11 Dec 2019, 02:06
Re: AutoHotKey Script for creating a Directory with Date
Is it possible to place a delay so that the script waits for the software I want to cut to load completely?
Also, is it possible to use for loops? because I would like to make the same cut many times
Also, How do I use a variable to save the image .. I was doing this:
Also, is it possible to use for loops? because I would like to make the same cut many times
Also, How do I use a variable to save the image .. I was doing this:
Code: Select all
ImageName := 1.-9600-12,000_MHz.png
snap := new CGdipSnapshot( 0, 0, A_ScreenWidth, 433 ) ; x, y, width, height
snap.TakeSnapshot()
snap.SaveSnapshot( DateDir "\1.- VHF Band (30-300 MHz)\"ImageName )
Re: AutoHotKey Script for creating a Directory with Date Topic is solved
Add Sleep for delays.DieDauphin wrote: ↑12 Dec 2019, 09:39Is it possible to place a delay so that the script waits for the software I want to cut to load completely?
Because the filename is a string, you have to assign the variable either 1 of 2 ways:
Code: Select all
; In quotes, or as an expression
ImageName := "1.-9600-12,000_MHz.png"
; Using an equal sign only, no colon, or the legacy approach
ImageName = 1.-9600-12,000_MHz.png
Yes, please see Loop, While Loop. A For Loop in AutoHotkey is for Arrays and Objects.DieDauphin wrote: ↑12 Dec 2019, 09:39Also, is it possible to use for loops? because I would like to make the same cut many times
- DieDauphin
- Posts: 4
- Joined: 11 Dec 2019, 02:06
Re: AutoHotKey Script for creating a Directory with Date
So, for example, if I would like to take three photos, I would do a loop like this, right?
I would like to place at the beginning of the image the A_Index (So there are going to be the next images: 1.- 9600-12,000_MHz.png, 2.-9600-12,000_MHz.png, 3.-9600-12,000_MHz.png) .. But I am not sure how to code that ..
I also tried this:
But it didn't work neither .. How do I use A_Index as a String
Edit.
oh, solve it, it is just A_Index, not %A_Index%
Code: Select all
Loop, 3
{
ImageName := %A_Index% ".-9600-12,000_MHz.png"
snap := new CGdipSnapshot( 0, 0, A_ScreenWidth, 433 ) ; x, y, width, height
snap.TakeSnapshot()
snap.SaveSnapshot( DateDir "\1.- VHF Band (30-300 MHz)\"ImageName )
Sleep, 100
}
I also tried this:
Code: Select all
snap.SaveSnapshot( DateDir "\1.- VHF Band (30-300 MHz)\" %A_Index% ImageName )
Edit.
oh, solve it, it is just A_Index, not %A_Index%
Who is online
Users browsing this forum: Google [Bot] and 145 guests