| View previous topic :: View next topic |
| Author |
Message |
bmg08031
Joined: 02 May 2004 Posts: 3 Location: Bellmawr, Nj
|
Posted: Sun May 02, 2004 3:09 am Post subject: New to scripting |
|
|
i was hoping to find out if there is going to be a more in depth tutorial on AHK. i have never done scripting before and i don't know how to use this program. the current tutorial seems to be written for folks with experience. i am not one of those. i tried messing around with it, but i cannot figure out how to associate scripts with programs. i learn very quickly but i need a push in the right direction.
thankyou. |
|
| Back to top |
|
 |
Beastmaster
Joined: 15 Apr 2004 Posts: 181
|
Posted: Sun May 02, 2004 9:24 am Post subject: |
|
|
Where's the beef ?
Would you mind to specify a current task/issue you want to accomplish like:
a) open a document in MS Word
b) replace all "&" characters with "and"
c) scroll down 2 times
d) insert an image object
e)...
We're standby to support you  |
|
| Back to top |
|
 |
Chris Site Admin
Joined: 02 Mar 2004 Posts: 10474
|
Posted: Sun May 02, 2004 10:53 am Post subject: |
|
|
You might try using the included macro recorder, AutoScriptWriter, to record your keystrokes and mouse clicks. This might help you get started.
In addition, the examples in the the tutorial are all functional. If you copy & paste one of them into notepad and save the file as Example.ahk, you can run that file by double clicking it.
Learning by example is probably the best approach. |
|
| Back to top |
|
 |
bmg08031
Joined: 02 May 2004 Posts: 3 Location: Bellmawr, Nj
|
Posted: Sun May 02, 2004 3:03 pm Post subject: |
|
|
what i do not understand is how to associate the .ahk files with a specific program. for example if i am using internet explorer and i want to save a picture from a web site to "my pictures". how can i make a hot-key to select "save picture as..." and then "save" and either "go back" or "close current window". this isn't the only thing i want ot do with the program but it seems simple enough to get me familiar with using it. right now i don't know where to begin. the biggest hurdle for me is to overcome is understanding how these .ahk files are associated with a specific program. also can i save them all to one master .ahk folder or do they each have to be saved in their respective program's folder? like i said i am new at this, perhaps i should have said that i have never done anything like this, and i saw your program while browsing around download.com.
thankyou, again. |
|
| Back to top |
|
 |
jamestr
Joined: 05 Apr 2004 Posts: 96 Location: Connecticut USA
|
Posted: Sun May 02, 2004 4:20 pm Post subject: IfWinActive, sdfasdfasdfsadfsadfsdfdsfsmart Explorerelseelse |
|
|
F15 performs different stuff depending on foreground window.
| Code: |
F15::
IfWinActive, MyIE2
send, !v{n}
else
IfWinActive, Smart Explorer
send, !v{x}
else
IfWinActive, Opera
send, ^g
else
send, {enter}
return
|
|
|
| Back to top |
|
 |
bmg08031
Joined: 02 May 2004 Posts: 3 Location: Bellmawr, Nj
|
Posted: Sun May 02, 2004 4:33 pm Post subject: |
|
|
| thanks for the help. i copied and pasted the code you posted then i realized that i do not have an f15. my keyboard stops at f12. also what about saving the .ahk files does it matter where i save them to? do they automatically work? i really don't have any experience with writting code. i tried to learn JAVA on my own once but it gave me a migraine. |
|
| Back to top |
|
 |
Chris Site Admin
Joined: 02 Mar 2004 Posts: 10474
|
Posted: Sun May 02, 2004 4:38 pm Post subject: |
|
|
| Quote: | | for example if i am using internet explorer and i want to save a picture from a web site to "my pictures". how can i make a hot-key to select "save picture as..." and then "save" and either "go back" or "close current window". |
With AutoHotkey, scripts aren't specific to certain programs unless you write them that way. So to make a script specific to MSIE, something like jamestr's example or this might be a good starting point:
| Code: | ^!s:: ; Ctrl+Alt+S
IfWinNotActive, ahk_class IEFrame ; Title is from Window Spy.
return
; Otherwise (the user should be hovering the mouse over a picture):
MouseClick, right ; Invoke context menu.
Sleep, 50
Send, s{enter} ; Save
WinWaitActive, Save Picture
Send, {enter}
MsgBox, 4, , Close this MSIE window?
IfMsgBox, Yes
WinClose, ahk_class IEFrame
return |
Last edited by Chris on Sun May 02, 2004 5:16 pm; edited 1 time in total |
|
| Back to top |
|
 |
Beastmaster
Joined: 15 Apr 2004 Posts: 181
|
Posted: Sun May 02, 2004 4:49 pm Post subject: |
|
|
Do you need a step by step tutorial ?
Like ...
Manual:
| Quote: | a) Run Internet Explorer
b) Input web adress
c) Wait till webpage has been loaded
d) Move with the cursor to the image
e) Right Mouse Click
f) select "Save As..." option
g) wait till "Save Picture" dialog opens
h) input the name of the image
i) Tab to the "Save" button
j) Press the "Save" button |
Script:
| Quote: | a+b) Run, iexplore "www.autohotkey.com/forum/index.php",,Max
c) WinWaitActive, AutoHotkey :: Index - Microsoft Internet Explorer
d+e) MouseClick, R, 130, 180
f) Send, s
g) WinWaitActive, Save Picture
h) Send, AutoHotkeyBBLogo
i) Send, {TAB 2}
j) Send, {ENTER} |
Scripting is a l'ill like explaining your grandma what to do with a computer.
Hope that helps  |
|
| Back to top |
|
 |
Chris Site Admin
Joined: 02 Mar 2004 Posts: 10474
|
Posted: Sun May 02, 2004 5:18 pm Post subject: |
|
|
| Quote: | | also what about saving the .ahk files does it matter where i save them to? do they automatically work? |
You can have as many .ahk files as you want, in any folder. Double-click the file to launch it. You can have more than one script running concurrently. |
|
| Back to top |
|
 |
zridling
Joined: 28 Jun 2005 Posts: 9 Location: St. Louis, US
|
Posted: Sun Aug 07, 2005 9:20 am Post subject: |
|
|
Another newbie here. Just writing to say thanks. Did a search and found several topics on how to close windows without closing the program. The insights here showed me the way. Good analogy with the Grandma reference — consider my brain a calcified grandma. _________________ - Zaine Ridling, THE GREAT SOFTWARE LIST |
|
| Back to top |
|
 |
|