Is AutoHotKey what I need?

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Bellzemos
Posts: 17
Joined: 22 Jan 2014, 17:30

Is AutoHotKey what I need?

22 Jan 2014, 17:37

Hello good people!

I would like to automate a certain procedure I have to do quite often on my PC. I wonder if that's possible with AHK.

So, what I would like to do is - I have (Windows 7) an icon in the system tray which when clicked on opens a window with settings for my external USB sound interface. There I have to manually change a setting (it's a drop down menu) and then click on OK and then close the window back to tray.

Is there a way to make all this happen by creating an AHK scrips (later I'd also like to make it into an executable file).

If I wasn't clear enough I'll record the procedure I'd like to automate with Camtasia and link the video here.

Thank you for your answer in advance! :)
timeFlies
Posts: 146
Joined: 22 Oct 2013, 20:54
Location: Somewhere in the northern hemisphere.

Re: Is AutoHotKey what I need?

22 Jan 2014, 18:40

Yes, this is possible using AutoHotkey! Is the dialogue you need to open the standard Windows Playback devices one, and you just need to switch playback devices? If so, there is a reliable way to do this programmatically without opening the window. If this is what you need, I'll explain it below.

Otherwise you may need to manipulate the window using various commands, such as simulating mouse clicks, changing drop-down list selections, etc.. Really, there are any number of different ways of going about it, and if you need help doing this, there are a lot of people willing to answer your questions here.
Last edited by timeFlies on 22 Jan 2014, 19:45, edited 1 time in total.
User avatar
FanaticGuru
Posts: 1908
Joined: 30 Sep 2013, 22:25

Re: Is AutoHotKey what I need?

22 Jan 2014, 19:03

Bellzemos wrote:I would like to automate a certain procedure I have to do quite often on my PC. I wonder if that's possible with AHK.
It is certainly possible.

There are basically four ways I see to go about this.

The most mundane is to simple have the script move the mouse and go through the same clicking that you would do with the mouse. This can be somewhat unreliable if the windows do not always open in the same positions.

You can navigate through the menus using keyboard shortcuts the same as a human would do if using only the keyboard. This is better if the process can be done entirely with just the keyboard but many things cannot be done entirely with the keyboard.

Then there is a way of simulating mouse clicks and keyboard input by knowing the "names" of the button and tabs. There are utilities that allow you to get these names. This way works pretty good.

The final, best and most complicated way is through the use of COM Objects. Which basically means the program was designed to be accessed programmatically and is set up to be interfaced with directly. Many programs do not allow a COM interface. They were simply not coded to be controlled by other programs. Stuff like Microsoft Office have a robust COM interface.

Method 3 is probably your best bet and below is an example of it to turn a microphone on and off.

Code: Select all

Run mmsys.cpl 
WinWait Sound
ControlSend SysTabControl321, {Right}
WinWait,, Select a recording
ControlSend SysListView321, {Down}
ControlClick Button3
WinWait Microphone Properties
ControlSend SysTabControl321, {Right}
WinWait,, You can listen
ControlClick Button1
ControlClick Button7
WinWait,, Select a recording
ControlClick Button4
First you will need to know what program is being run when you click on that icon so that you can run it directly. Is it a part of Windows or third party software that came with some headphones or something like that? Can you access the same window through your control panel?

The example above runs mmsys.cpl which is actually the program that is run when you click on Control Panel > Hardware and Sound > Manage audio devices.

FG
Hotkey Help - Help Dialog for Currently Running AHK Scripts
AHK Startup - Consolidate Multiply AHK Scripts with one Tray Icon
Hotstring Manager - Create and Manage Hotstrings
[Class] WinHook - Create Window Shell Hooks and Window Event Hooks
timeFlies
Posts: 146
Joined: 22 Oct 2013, 20:54
Location: Somewhere in the northern hemisphere.

Re: Is AutoHotKey what I need?

22 Jan 2014, 19:53

To add to that, to use the script that FG wrote, you need some way to launch it. Once you have AHK installed, you could simply use the script like above and simply double-click on the file to run it (it will close automatically when it reaches the end).

Alternatively, you could use create a hotkey, like this:

Code: Select all

#s::	; <- this means Windows key + s will launch the script
	Run mmsys.cpl
	WinWait, Sound
	ControlSend, SysTabControl321, {Right}
	WinWait, , Select a recording
	ControlSend, SysListView321, {Down}
	ControlClick, Button3
	WinWait, Microphone Properties
	ControlSend, SysTabControl321, {Right}
	WinWait, , You can listen
	ControlClick, Button1
	ControlClick, Button7
	WinWait, , Select a recording
	ControlClick, Button4
return		; <- important!
Bellzemos
Posts: 17
Joined: 22 Jan 2014, 17:30

Re: Is AutoHotKey what I need?

22 Jan 2014, 20:24

Thank you so much for your immediate help, you guys are great!

I made a video about exactly what I'd like the script to do, because I'm novice at that and I'm not able to figure it out alone (yet). :)

http://youtu.be/L-jAURRrUbY (Sorry for the low video quality, my file has better quality, I don't know why Youtube lessens it like that.)

So this is what I would like to happen automatically upon executing the script:
Click on that taskbar icon (the program is in two locations though - C:\Windows\SysWOW64\firefaceusb.exe AND C:\Windows\System32\firefaceusb.exe).
Change buffer size from 128 to 512 samples.
Click OK (that also closes the window).
Run Skype (C:\Program Files (x86)\Skype\Phone\Skype.exe) and then the script should pause.
After I'm done skyping and log out I'd like the script to continue and repeat the procedure (but this time change from 512 to 128 and OK).

I'd make that into an EXE file and put it on my desktop instead of the original Skype icon.

So what would be the best way to go about it for my case? How do I know if COM objects can be used in this script?

Thank you! :)
Bellzemos
Posts: 17
Joined: 22 Jan 2014, 17:30

Re: Is AutoHotKey what I need?

23 Jan 2014, 08:04

How should I go about it? Anyone, please?

Also, do you think that for my case I'm better of with AHK or AutoIt?

Thank you!
User avatar
FanaticGuru
Posts: 1908
Joined: 30 Sep 2013, 22:25

Re: Is AutoHotKey what I need?

23 Jan 2014, 14:08

Bellzemos wrote:How should I go about it? Anyone, please?

Also, do you think that for my case I'm better of with AHK or AutoIt?
AHK and AutoIt will both probably require about the same amount of effort. I prefer AHK. Also in my experience the AHK forums are more helpful.

This is going to require some effort and learning on your part as most people do not have firefaceusb.exe installed so can not write the script for you.

I would install the newest version of AHK.

Create this script:

Code: Select all

#Persistent
Run firefaceusb.exe
Esc::ExitApp
Executing that script should start the firefaceusb interface. If not then you might have to use the entire path to the exe.

You should also have a H icon in your system tray. If you right click on that icon you should see "Window Spy". With Window Spy you should be able to get the name of Windows, Buttons, etc.

Using the example script I posted above you should be able to modify it to move through tabs, click on buttons, etc. to get the results that you want.

Pushing Esc will terminate the script.

After you get the firefaceusb thing working you can add to it for the Skype part, create a shortcut key to activate the script and other additions.

FG
Hotkey Help - Help Dialog for Currently Running AHK Scripts
AHK Startup - Consolidate Multiply AHK Scripts with one Tray Icon
Hotstring Manager - Create and Manage Hotstrings
[Class] WinHook - Create Window Shell Hooks and Window Event Hooks
Bellzemos
Posts: 17
Joined: 22 Jan 2014, 17:30

Re: Is AutoHotKey what I need?

23 Jan 2014, 14:59

I decided I'm gonna go with AutoHotKey I think! You seem to be more helpful and I kinda like the program more (even though I haven't even installed it yet, but I watched some tutorials etc.).

Why does AHK have two forums though?
http://www.autohotkey.com/board/

I'm going to ask some stupid questions, but I have to: does AHK use a lot of system resources when running? Does it start with Windows and runs all the time (maybe as a background process/service) or only when you manually run it? Does it do anything unfavorable (callinng home maybe)? I know it surely doesn't ask to install adware, so I'm not gonna ask that. Can I screw up something by using it? If I record mouse-click macros, what happens if I change the screen resolution? What if the mouse in the script accidentaly changes some important Windows setting and I won't even know it. Sorry for my paranoia.

About the script I want to make (FireFaceUSB & Skye) - you mentioned in your first post on this thread that there are utilities which can get the "names" fo the buttons and tabs. I'm interested in that, how would I record the script that way? Is one of those utilities the Windows Spy you mentioned in the last post? Does it come with the AHK installation? The macro recorder too?

Thank you so much! :)
kon
Posts: 1756
Joined: 29 Sep 2013, 17:11

Re: Is AutoHotKey what I need?

23 Jan 2014, 15:54

Bellzemos wrote:Why does AHK have two forums though?
http://www.autohotkey.com/board/
That's a loaded question. The short answer is here: http://ahkscript.org/boards/viewtopic.p ... 9087#p8131
Bellzemos wrote:does AHK use a lot of system resources when running?
AHK is tiny, generally about 2000 k of memory.
Bellzemos wrote:Does it start with Windows and runs all the time (maybe as a background process/service) or only when you manually run it?
It starts only when you tell it to. Some people have "always on" scripts that they have set to start with windows, this is accomplished by putting the script in the windows "Startup" folder.
Bellzemos wrote:Does it do anything unfavorable (callinng home maybe)?
Nope. The code is open source,with many people looking at it and rewiewing it. You are free to view the source and investigate for yourself also.
Bellzemos wrote:Can I [foul/derogatory language] up something by using it?
Only if you write a script that messes around with something important, like the registry, or deletes system files. But that's on you. You are very unlikely to do anything harmful accidentally.
Bellzemos wrote:If I record mouse-click macros, what happens if I change the screen resolution? What if the mouse in the script accidentaly changes some important Windows setting and I won't even know it.
That's why it is more reliable to write scripts that click buttons/controls/etc. based on the name of the control, as opposed to the coordinates.
Bellzemos wrote:About the script I want to make (FireFaceUSB & Skye) - you mentioned in your first post on this thread that there are utilities which can get the "names" fo the buttons and tabs. I'm interested in that, how would I record the script that way? Is one of those utilities the Windows Spy you mentioned in the last post? Does it come with the AHK installation?
Yes Window Spy is the most common utility for getting information about a window that you normally can't see. It comes with AHK. With an AHK script running, right click on the tray icon and select "Window Spy". Part 2 of this video shows some ways to use window spy.
Bellzemos wrote:The macro recorder too?
Available at: http://ahkscript.org/boards/viewtopic.php?f=6&t=143

When you install AHK, the first thing I would suggest is get SciTE4AutoHotkey. It makes editing your scripts a lot easier.
Also, the docs and the Quick-Start Tutorial are your friends. ;)

Hope that helps. :D
Bellzemos
Posts: 17
Joined: 22 Jan 2014, 17:30

Re: Is AutoHotKey what I need?

23 Jan 2014, 17:36

I know it's more reliable to write scripts but I'm really new to it, I will start with recording macros.

Which is the most simple to use script recoreder? I don't even really understand how an external macro recorder and AHK work together, that's all so new to me. Is there no internal script recorder?

I have Notepad++, so should I install SciTE4 too?

And yes, your post helped me a lot! Thanx! :)
User avatar
FanaticGuru
Posts: 1908
Joined: 30 Sep 2013, 22:25

Re: Is AutoHotKey what I need?

23 Jan 2014, 22:51

Bellzemos wrote:Which is the most simple to use script recoreder? I don't even really understand how an external macro recorder and AHK work together, that's all so new to me. Is there no internal script recorder?
A recorder, recorders your keystrokes and mouse movements and then creates the code for you that would replicate what was recorded.

It then allows you to edit and add to the code while it tries to help you along by letting you basically generate code from a graphic interface without having to know the actually coding commands. You don't have nearly the flexibility that writing the code directly would allow but it can be easier if you don't know anything about coding.

Pulover's Macro Creator seems to be the one most actively supported by its author.

http://ahkscript.org/boards/viewtopic.php?f=6&t=143
Bellzemos wrote:I have Notepad++, so should I install SciTE4 too?
AHK scripts are stored and edited as plain text so Notepad++ will work but SciTE4AutoHotkey adds a tremendous amount of functionality. If you ever do decide to write AHK scripts directly or just edit other peoples scripts then SciTE4AutoHotkey is the way to go. For starts it allows you to highlight any AHK command and access help documents on that command. It is a text editor specifically tailored for writing AHK scripts.

http://fincs.ahk4.net/scite4ahk/

FG
Hotkey Help - Help Dialog for Currently Running AHK Scripts
AHK Startup - Consolidate Multiply AHK Scripts with one Tray Icon
Hotstring Manager - Create and Manage Hotstrings
[Class] WinHook - Create Window Shell Hooks and Window Event Hooks
timeFlies
Posts: 146
Joined: 22 Oct 2013, 20:54
Location: Somewhere in the northern hemisphere.

Re: Is AutoHotKey what I need?

23 Jan 2014, 23:11

SciTE4AutoHotkey is a customised version of SciTE that includes:
  • Syntax highlighting
  • Calltips (also known as IntelliSense)
  • AutoComplete
  • AutoIndent
  • AutoHotkey help integration
  • Abbreviations
  • Editing macros
  • Interactive debugging
  • Tools for AutoHotkey scripting
  • Powerful extension mechanisms
So this is better than Notepad++, unless you've customised it for AHK by yourself. Installing it is a one-step process.


Okay, here we go. I never do this for anybody, especially for people who beg (not you), but you seem willing to learn. I wrote a basic template that you can follow to do what you need. Follow the steps I've explained in the script one-by-one. After this you should be able to figure most things out just by reading the help file.

Download the script file and make sure it has the extension .ahk.

Edit: I made a couple minor changes.

Code: Select all

; Here's a basic template for your script that you can use to fill in all the details.
; I based it off your video at http://www.youtube.com/watch?v=L-jAURRrUbY&feature=youtu.be.

; For now we're going to open a MsgBox in between each step. This will pause the script
; and allow you to see if each command worked. If it didn't work something needs to be changed.
; Clicking OK will continue the script. Afterwards we'll delete all the MsgBox lines.

; 1. First we need to open Fireface USB Settings. We can do this by running the .exe file
Run, C:\Windows\System32\firefaceusb.exe
MsgBox, Opened Settings

; 2. Next, we need to wait for the window to open. This can be done using the WinWait command,
; followed by the name of the window. To make the script more reliable we're not going to
; use the name, but the window class instead. You can find this using Window Spy
; (in the AutoHotkey Start Menu folder). Simply focus the Fireface USB window, then get
; the name near the top that says "ahk_class __________".
; Add it in the line below.
WinWait, ahk_class putNewNameHere
MsgBox, FirefaceUSB window has now opened.

; 3. Now we need to change the Buffer Size CombBox.
; "ComboBox1" is most likely the name of the control. You can verify this by opening Window Spy
; (in the AutoHotkey Start Menu folder) and putting your cursor over the ComboBox. In Window Spy
; where it says "Now Under Mouse Cursor", look at the name beside "ClassNN". If it's different than
; what we already have, put the new name in place of "ComboBox1".
Control, ChooseString, "512", ComboBox1
MsgBox, Selected ComboBox entry (512)

; 4. Next we'll press the OK button to save changes.
ControlClick, OK
MsgBox, Saved settings.

; 5. Now we need to run Skype.
Run, C:\Program Files (x86)\Skype\Phone\Skype.exe
MsgBox, Skype opened.

; 6. Here, we want the script to wait until the Skype window has closed. This step is similar to
; Step 2, except this time we're waiting for the window to close, not open. Using Window Spy,
; get the window class of Skype and replace it in the line below.
WinWaitClose, ahk_class putNewNameHere
MsgBox, Skype window has now closed.

; 7. Here, quit Skype from running in the background. You mught need to change the name if it's
; different than the one that we ran. If applicable, find the skype executable name using Task Manager
; (right-click on taskbar -> Task Manager -> Process tab, sort it and find Skype in the list).
Process, Close, Skype.exe
MsgBox, Skype background process has been exited.

; 8. These steps are the same as steps 1, 2, and 3, except a different ComboBox entry. Make sure if you had
; to change the name above that you change it here too.
Run, C:\Windows\System32\firefaceusb.exe
WinWait, ahk_class putNewNameHere
Control, ChooseString, "128", ComboBox1

; Now, exit the script.
ExitApp
Last edited by timeFlies on 25 Jan 2014, 13:22, edited 1 time in total.
Bellzemos
Posts: 17
Joined: 22 Jan 2014, 17:30

Re: Is AutoHotKey what I need?

24 Jan 2014, 20:09

Wow, thank you so much! Yes, I will try to learn because I am interested! I've just been very busy repairing some laptop (and will still be for the weekend), but as soon as I get some free time I'm gonna dive into AHK. :) By the way, is any truth in this comment here (last one) - could this be done by simply changing the registry?
http://www.autoitscript.com/forum/topic ... at-i-need/
timeFlies
Posts: 146
Joined: 22 Oct 2013, 20:54
Location: Somewhere in the northern hemisphere.

Re: Is AutoHotKey what I need?

25 Jan 2014, 12:14

Bellzemos wrote:Wow, thank you so much! Yes, I will try to learn because I am interested! I've just been very busy repairing some laptop (and will still be for the weekend), but as soon as I get some free time I'm gonna dive into AHK. :) By the way, is any truth in this comment here (last one) - could this be done by simply changing the registry?
http://www.autoitscript.com/forum/topic ... at-i-need/
Wow. They seem quite the AHK-haters. Best thing to do is to never mention AutoHotkey on AutoIT. AutoHotkey is a fork of AutoIT from about twelve years ago (when AutoIT was GPL and still quite under-developed), but they seem like they still haven't gotten rid of the bitterness, especially because I think AHK ended up being quite popular and well-known. I and most people from AHK don't feel the same way toward them.

There's a possibility you could do it from the registry, but often this does not work and it can be difficult to find the correct key. Furthermore, very often settings are not even stored in the registry, and if they are, sometimes for changes to the registry to take affect some service or program needs to be restarted. What you can do is to is hide the firefaceUSB window as soon as it opens so you never see it. Even if a window is hidden, it can still be manipulated.

If I was doing it myself I might attempt to do it via the registry, but your code will likely be shorter and easier to write if you don't (unlike what was said on AutoIt).

Edit: What was said about the language being "hokey" is not really true, especially about variable declarations, which is completely bogus. There are some quirks, but those exist precisely because the syntax of AHK was based on AutoIT. Version 2 of AHK (still in beta) does a complete overhaul of the syntax and gets rid of all the quirks and backwards-compatibility measures done in v1 at the expense of backwards-compatibility.
User avatar
FanaticGuru
Posts: 1908
Joined: 30 Sep 2013, 22:25

Re: Is AutoHotKey what I need?

25 Jan 2014, 22:38

Yea, like chaz said a lot of hate over on the AutoIT board.

AutoHotkey branched off from AutoIT a long time ago when AutoIT stopped being open source. The developers of AutoIT are very much against AutoIT being open source. I also notice that their forums and site has advertisements. It is nice that AHKscript.org has been able to stay donation only completely open source.

I can kind of understand the developers having bad blood toward AutoHotkey because it is an offshoot that came from AutoIT and does compete with it in a fashion but I never understood why the average user over there is so anti-AutoHotkey.

And as one commenter implied over there that they frown very much on people asking for too much help or wanting people to write the scripts for them. You get some of that over here but not to the same degree. Heck I mean I would have already written the script for you as I did for the person wanting to turn there microphone on and off, but I don't have firefaceUSB on my computer so cannot actually write and test the script. It would probably only take a few minutes.

I would not go fooling with the registry for simple automation like this.

Also the variable declaration thing being "hokey" is completely hokey as variables generally are not declared or typed.
AutoHotkey Help wrote:AutoHotkey has no explicitly defined variable types ... variables do not need to be declared; they come into existence simply by using them
FG
Hotkey Help - Help Dialog for Currently Running AHK Scripts
AHK Startup - Consolidate Multiply AHK Scripts with one Tray Icon
Hotstring Manager - Create and Manage Hotstrings
[Class] WinHook - Create Window Shell Hooks and Window Event Hooks
timeFlies
Posts: 146
Joined: 22 Oct 2013, 20:54
Location: Somewhere in the northern hemisphere.

Re: Is AutoHotKey what I need?

26 Jan 2014, 01:19

FanaticGuru wrote:And as one commenter implied over there that they frown very much on people asking for too much help or wanting people to write the scripts for them. You get some of that over here but not to the same degree. Heck I mean I would have already written the script for you as I did for the person wanting to turn there microphone on and off, but I don't have firefaceUSB on my computer so cannot actually write and test the script. It would probably only take a few minutes.
I do this on a case-by-case basis. If the person is not rude, writes a lot of detail about what they have done, and seems genuinely interested in learning how to do it, I will write a script and/or template script for them, making it as simple as possible and commenting on all key parts. This last part is important. I feel that unless they can understand what it is the script is actually doing enough so that they can later apply it themselves, it's not worth it for me to write it for them (this is one reason why I dislike macro recorders).

However, if somebody asks, "can somebody write a script that does this this and this for me, and get it done as fast as you can because I really really need it?", I'm going to completely ignore it. Related to this are gaming-related questions. If the question is obviously for automating or cheating in a game, again, I'll ignore it.

chaz
Bellzemos
Posts: 17
Joined: 22 Jan 2014, 17:30

Re: Is AutoHotKey what I need?

26 Jan 2014, 17:01

Hello again!

@ FanaticGuru

Code: Select all

; I tried this:
#Persistent
Run firefaceusb.exe
Esc::ExitApp
; It creates another tray icon of that program but it doesn't open it (like when I click on it).
I also run Window Spy and it said (among other things that I don't understand yet):
ClassNN: ComboBox1
That was when I had the mouse pointer over that box with the setting I want to change.

Is it possible to make all AHK scripts/shortcuts/programs this way (using names instead of recording macros by using mouse adn keyboard)? Because if the answer is yes I won't even install a macro recorder (or should I?).[/color]


@ chaz

I modified your script and tried it but it doesn't work properly. The firefaceUSB window doesn't open - the script proceeds if I open it manually and then it doesn't change the value to 512. Skype launches and closes though. Here is your script (modofied by me):

Code: Select all

; Here's a basic template for your script that you can use to fill in all the details.
; I based it off your video at http://www.youtube.com/watch?v=L-jAURRrUbY&feature=youtu.be.

; For now we're going to open a MsgBox in between each step. This will pause the script
; and allow you to see if each command worked. If it didn't work something needs to be changed.
; Clicking OK will continue the script. Afterwards we'll delete all the MsgBox lines.

; 1. First we need to open Fireface USB Settings. We can do this by running the .exe file
Run, C:\Windows\System32\firefaceusb.exe
MsgBox, Opened Settings

; 2. Next, we need to wait for the window to open. This can be done using the WinWait command,
; followed by the name of the window. To make the script more reliable we're not going to
; use the name, but the window class instead. You can find this using Window Spy
; (in the AutoHotkey Start Menu folder). Simply focus the Fireface USB window, then get
; the name near the top that says "ahk_class #32770".
; Add it in the line below.
WinWait, ahk_class #32770
MsgBox, FirefaceUSB window has now opened.

; 3. Now we need to change the Buffer Size CombBox.
; "ComboBox1" is most likely the name of the control. You can verify this by opening Window Spy
; (in the AutoHotkey Start Menu folder) and putting your cursor over the ComboBox. In Window Spy
; where it says "Now Under Mouse Cursor", look at the name beside "ClassNN". If it's different than
; what we already have, put the new name in place of "ComboBox1".
Control, ChooseString, "512", ComboBox1
MsgBox, Buffer size is now 512.

; 4. Next we'll press the OK button to save changes.
ControlClick, OK
MsgBox, Saved settings.

; 5. Now we need to run Skype.
Run, C:\Program Files (x86)\Skype\Phone\Skype.exe
MsgBox, Skype opened.

; 6. Here, we want the script to wait until the Skype window has closed. This step is similar to
; Step 2, except this time we're waiting for the window to close, not open. Using Window Spy,
; get the window class of Skype and replace it in the line below.
WinWaitClose, ahk_class TLoginForm
MsgBox, Skype window has now closed.

; 7. Here, quit Skype from running in the background. You mught need to change the name if it's
; different than the one that we ran. If applicable, find the skype executable name using Task Manager
; (right-click on taskbar -> Task Manager -> Process tab, sort it and find Skype in the list).
Process, Close, Skype.exe
MsgBox, Skype background process has been exited.

; 8. These steps are the same as steps 1, 2, and 3, except a different ComboBox entry. Make sure if you had
; to change the name above that you change it here too.
Run, C:\Windows\System32\firefaceusb.exe
WinWait, ahk_class #32770
Control, ChooseString, "128", ComboBox1
MsgBox, Buffer size is 128 again.

; Now, exit the script.
ExitApp
Could it be wrong because I'm running it all in a sandboxed environment (but I don't think so)? Also, ExitApp quits the script, right? How come you didn't have to use command return in the script?

And again, thank you so much for help!
Last edited by tank on 26 Jan 2014, 18:20, edited 1 time in total.
Reason: added code tags
Bellzemos
Posts: 17
Joined: 22 Jan 2014, 17:30

Re: Is AutoHotKey what I need?

26 Jan 2014, 19:09

Thank you, tank. How do I do that myself?

Another note about my script - I'd like the script to check if winamp.exe is running and terminate it before modifying the value from 128 to 512. That would be impossible with macro recorder because WinAmp window moves a lot on my PC. So how do I do all that? What should I change in the script in order to make it work? Should I record a video executing the script in my previous post?
Bellzemos
Posts: 17
Joined: 22 Jan 2014, 17:30

Re: Is AutoHotKey what I need?

26 Jan 2014, 23:02

I was testing more and I think I got out some new info I should consider.

The Fireface USB is already running (starts with startup of Windows), so the script should just open it's windows. I don't know how to do that, it doesn't happen. Before all that the script should check if winamp.exe is running and terminate it. Also the setting in the first box don't change from 128 to 512. Skype opens fine and for closing it I think there's one line too much becasue when I exit Skype the process skype.exe closes. And then the re-setting from 512 to 128 doesn't work either.

I learned what return is about - it's used only when you make 2-or-more lines of code. I would like some more help on the script, if possible. :)

Thank you!
timeFlies
Posts: 146
Joined: 22 Oct 2013, 20:54
Location: Somewhere in the northern hemisphere.

Re: Is AutoHotKey what I need?

27 Jan 2014, 00:48

For changing the combobox entry, try removing the quotations ("") around the number. I'm not sure if it needs them or not.

For opening the Fireface USB settings window, try this when the settings window is open (I can't guarantee this will work):
1. Open Task Manager.
2. In the Applications tab (first), right click the firefaceUSB list item and click "Go to process".
3. In the View (?) menu, click Select Columns and check the Full Path / Command line (I'm not exactly sure what it's called), then click OK.
4. Manually copy the full command line (the column you just added) of the selected row.
5. Try using this in the first [Run] command in the script.


______
return is used when you want the code to "return" from where it started. In this case technically there might be a returnafter the ExitApp, but since the script is being closed (and therefore no more code is being run), it doesn't actually do anything so is generally not included. In fact, since the script has reached the last line by the time it reaches the ExitApp, it would exit anyway so ExitApp really could also be omitted and it would work the same (best to include it for clarity).

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: madensuyu1, peter_ahk and 344 guests