| View previous topic :: View next topic |
| Author |
Message |
deportivo5
Joined: 05 Sep 2008 Posts: 44
|
Posted: Thu Dec 04, 2008 2:56 am Post subject: Making a variable read by all scripts |
|
|
Hi all,
Im new to autohotkey.
I would like to ask if it is possible to make a variable recognise by all scripts.
Im basically running scripts one after another.
This is my 1st script. Its called TestCase 1.ahk
| Quote: |
SetDefaults()
{
Global;
Var := 1
}
RUn C:\Documents and Settings\alice\Desktop\playback.ahk
|
This will result in automatically running the 2nd script. Its called playback.ahk
^1 is actually a hotkey as im using both autohotkey and macro express together. The main idea is that i do not wish to create a playback script specifically for each testcase as i need to record quite alot of them.
Thanks for helping. ^.^ _________________ I have lost friends, some by death... others through sheer inability to cross the street.
Virginia Woolf (1882 - 1941),
(\__/) This is Bunny.
(='.'=) Cut, copy, and paste bunny onto your sig.
(")_(") Help Bunny gain World Domination. |
|
| Back to top |
|
 |
Frankie
Joined: 02 Nov 2008 Posts: 2850
|
Posted: Thu Dec 04, 2008 3:03 am Post subject: |
|
|
You can copy it to the clipboard then read it at the start of your next probgram
Or you can combine them into one script using include. An example would be having a main script that looks like this:
| Code: |
;Main Program
#include C:\Documents and Settings\alice\Desktop\playback.ahk
#include C:\Documents and Settings\alice\Desktop\program2.ahk
#include C:\Documents and Settings\alice\Desktop\program3.ahk
|
It basicaly copys and pastes the scripts into the script when its run. All variables not in functions can be used in each part. So if one include makes the variable title equal Notepad it will be notepad until something else changes it. |
|
| Back to top |
|
 |
deportivo5
Joined: 05 Sep 2008 Posts: 44
|
Posted: Thu Dec 04, 2008 6:01 am Post subject: |
|
|
Hey Bro,
Thanks alot for helping.
I was just trying out.
Seems like the include isn't working.
instead, it runs de scripts under the list of #include _________________ I have lost friends, some by death... others through sheer inability to cross the street.
Virginia Woolf (1882 - 1941),
(\__/) This is Bunny.
(='.'=) Cut, copy, and paste bunny onto your sig.
(")_(") Help Bunny gain World Domination. |
|
| Back to top |
|
 |
[VxE]
Joined: 07 Oct 2006 Posts: 3254 Location: Simi Valley, CA
|
Posted: Thu Dec 04, 2008 7:37 am Post subject: |
|
|
Instead of using the clipboard to pass info back-and-forth between scripts, you can either use PostMessage to send data directly between scripts, or you can use guis to post info for other scripts to watch. Creating a gui with +Toolwindow and showing it with +NoActivate x-1 y-1, UniqueTitle:%info% would allow other scripts to WinWait, UniqueTitle, and then grab the data out of the gui window's title. And this would not interrupt the user in any way. _________________ Ternary (a ? b : c) guide TSV Table Manipulation Library
Post code inside [code][/code] tags! |
|
| Back to top |
|
 |
deportivo5
Joined: 05 Sep 2008 Posts: 44
|
Posted: Thu Dec 04, 2008 7:59 am Post subject: |
|
|
Thanks alot guys.
I have learn alot and many new ways to solve my problem. _________________ I have lost friends, some by death... others through sheer inability to cross the street.
Virginia Woolf (1882 - 1941),
(\__/) This is Bunny.
(='.'=) Cut, copy, and paste bunny onto your sig.
(")_(") Help Bunny gain World Domination. |
|
| Back to top |
|
 |
|