AutoHotkey Community

It is currently May 24th, 2012, 6:46 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 28 posts ]  Go to page 1, 2  Next
Author Message
PostPosted: February 23rd, 2007, 12:52 am 
Hello All,

I have several questions about AutoHotkey, some of which may prove to be very easy to answer and others which might be impossible (I’m not sure if I can do everything that I want to do with this program).

First off, I wanted to make a script that would wait for any of several conditions, namely, the existence of a certain window, and then do a certain action. My trouble is that I cannot get the script to wait for all possibilities at the same time. If I ask the program to do a command like:

;--------------------------------------
IfWinExist, Sign On
{
IfWinNotActive, Sign On, WinActivate, Sign On
WinWaitActive, Sign On
Sleep, 10
Send, username{TAB}password{ENTER}
return
}
Else, return
;--------------------------------------



What happens is the command executes (i.e. my username and password is automatically entered) the first time the window “Sign On” appears, but after that it just ends up waiting forever. What confuses me is that the following script does work:

;--------------------------------------
loop
{
winwait, Sign On
IfWinNotActive
WinActivate
WinWaitActive
Sleep, 10
Send, username{TAB}password{ENTER}
}
;--------------------------------------


The problem with this looping is that I cannot get a second command to execute and I cant think of a way I could.



Then if I want to make a second command I would write:

;--------------------------------------
IfWinExist, Sign On
{
IfWinNotActive
WinActivate
WinWaitActive
Sleep, 10
Send, username{TAB}password{ENTER}
return
}
Else, gosub, Error

Error:
IfWinExist, There has been an error
{
IfWinNotActive,
WinActivate
WinWaitActive
Sleep, 1000
Send, {ENTER}
return
}
Else, return
;--------------------------------------


(so, the username and password are entered, and if an error happens it automatically acknowledges the error after 1 second)

What happens is that the first time the “Sign On” prompt appears my username and password are entered, but after that nothing happens. Errors are not acknowledged and no more usernames or passwords are entered.

Is there some generic problem with the “IfWinExist” “gosub” and “else” commands? Why do these never work for me?

Chiefly, how can I get a number of triggers to each signal a different reaction, with out waiting for them all to be done consecutively? Say I want to sign on, then acknowledge two errors, then sign on to a different job (they all have the same user/pass). How do I do that?


The bigger job I have is to create a GUI. I am so new to doing this its scary. 2 weeks ago I had no idea any of this was possible for me to learn in my lifetime. I’ve already made a lengthy script that is helping a lot of people do their jobs faster around here. I’ve defined many hotkeys, and I am really liking the hotstrings approach, where I can open any of the common directories in windows by scripting:

::*progs::
Run C:\Program Files\
Return

It makes windows feel wonderfully like Autocad.


Anyway, about the GUI. I need to create a program that works with a user-created, predefined text file to execute a large amount of repetitions of the same action, differing by one variable each time. I don’t know the correct syntax for the script yet, but my intuition tells me to use variables like the following:

(I have read all the docs on the AutoHotkey website, but im not exactly clear on how I should make this happen)

Loop
{

Send, F2 ;this opens a dialogue that asks something to the effect of “where do you want to go?”

Send, %current_pannel%
;this would be a variable created by the database.
;For example, it would start at, “1-A1GRP1” and then go to “1-A2GRP2” and so on
;down the 1-A1 section until it got to 1-B1. However it would not be necessarily
;sequential. It would, for example, start at 1-A16, then 1-A17, then 1-A24,
;then 1-A25 etc. These would be written in a database file, starting with the first
;alphabetically and proceeding to the last, however the order is not important,
;except for organization to the person creating it.

<some sleep function that would wait for any part of that window title to change to, for 1-A%num%GRP1, “num”>

Sleep 250 ;just to wait for a little extra time for it to load

Loop %points per group%
;where %points per group% would come from the amount of points
;to be inserted per group

{

<move mouse to %mx%,%my%> ; where the %mx% and %my% are the mouse x-cordinates and the mouse y-cordinates of the first point to be inserted

Send, {INS}%point%{ENTER}
WinWait, Edit Point Entry
Send, {ENTER}
;where %point% is the first point to create on that page. It would look something
;like “VAR17”, which would, after {ENTER} was pressed, convert automatically
;to “1-A16VAR17”. That conversion is already done by the program I am
;making the script for.
}


;----------------------------------------------------------------------
;the second iteration of the above loop would look like this


; <move mouse to %mx%,%my%>
; this would be different predefined coordinates of different a
;different predefined point


;Send, {INS}%point%{ENTER}{ENTER}
; this would be different %point% than the first one. For example “VAR18”

;----------------------------------------------------------------------

Send, {ESC}
WinWait, Save Changes?
Send, {ENTER}


}





Other things that this program would have to include is that for all “VAR18”s entered, a sequence would have to be entered that would change the point to a different type of point. For example a yellow text one. The script for this is:


;---------------------------------------------------------------
;“change to yellow”

WinWait, Edit Reliable Point,
IfWinNotActive, Edit Reliable Point, , WinActivate, Edit Reliable Point,
WinWaitActive, Edit Reliable Point,
MouseClick, left, 208, 164
Sleep, 10
WinWait, Select Color,
IfWinNotActive, Select Color, , WinActivate, Select Color,
WinWaitActive, Select Color,
MouseClick, left, 206, 86
Sleep, 10
MouseClick, left, 93, 276
Sleep, 10
WinWait, Edit Reliable Point,
IfWinNotActive, Edit Reliable Point, , WinActivate, Edit Reliable Point,
WinWaitActive, Edit Reliable Point,
MouseClick, left, 183, 188
Sleep, 10
WinWait, Select Color,
IfWinNotActive, Select Color, , WinActivate, Select Color,
WinWaitActive, Select Color,
MouseClick, left, 208, 94
Sleep, 10
MouseClick, left, 76, 270
Sleep, 10
WinWait, Edit Reliable Point,
IfWinNotActive, Edit Reliable Point, , WinActivate, Edit Reliable Point,
WinWaitActive, Edit Reliable Point,
MouseClick, left, 178, 214
Sleep, 10
WinWait, Select Color,
IfWinNotActive, Select Color, , WinActivate, Select Color,
WinWaitActive, Select Color,
MouseClick, left, 210, 97
Sleep, 10
MouseClick, left, 85, 271
Sleep, 10
WinWait, Edit Reliable Point,
IfWinNotActive, Edit Reliable Point, , WinActivate, Edit Reliable Point,
WinWaitActive, Edit Reliable Point,
MouseClick, left, 71, 376
Sleep, 10
;---------------------------------------------------------------



Also, all “TL%num%”, “PRG%num%” and “GRP%grpnum%” points would have to be invisible and sized to a specific size.

For example,


; ---------------------------------------------------------------


<move mouse to %mx%,%my%>
;where the top left corner of that TL invisible link is supposed to be

Send, {INS}%point%{ENTER}{ENTER}
;this would be like, “TL1”

<move mouse to %mx-1%,%my-1%>
;this would move the mouse to one below and one across from
;where the original top left corner of the point was palced

Send, s
;this allows sizing of the point

Send, {SHIFTDOWN}
;this allows the point to be sized in X and Y coordinates independently
; i.e. not in proportion to eachother

<move mouse to %mx2%,%my2%>
;this would be the lower right hand corner of where the TL invisible
;link would cover

Send, mouseclick, left
;locks the lower right corner

Send, {SHIFTUP}

;the program would then move to the next point to be inserted
; ---------------------------------------------------------------



I would like the resulting GUI to have an interface that allows the creation of the %mx%,%my% for all the points on a given graphic. Im not sure how to get this data to append it self to the end of a text file in an orderly fassion, and then store that data as a variable that changes with each iteration of the loop.

The interface would have a look similar to:
http://img86.imageshack.us/my.php?image ... ionor3.png

Where links with values would have any size that would allow the link number to fit, and links that were invisible would be the size of the desired invisible link. In that graphic, 42, 44, 46, 48, and 50 are menu links which are invisible, 28, 32, and 30 are program links (also invisible), and 36, 34 are other invisible links. Number 0 is an exception to the GRP rule (where “GRP” links have to be invisible) This link should be a larger text size than the other text points. This data can be entered after in the place of %text size% the command {Send, {INS}1a1grp1{ENTER}%text size%}. Where %text size% would include a command string similar to the “change to yellow” command (they use the same control box when inserted).

Perhaps it would be better just to have the links created each individually rather than a rule and exceptions? This would not be too much work, as the resulting script (that would run all the iterations) would be saving several days of work and doing it all in under an hour.

Anyway, I can get into more specifics later. Im just looking for some initial feedback on this now. Anyone have some basic structure I should follow? Comments?

Thanks

fogus


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: February 23rd, 2007, 2:32 am 
Quote:
Anyway, I can get into more specifics later.
:shock: GOSH, even more specifics !!!

Quote:
Anyone have some basic structure I should follow?
Yes. KISS = keep it stupid simple or keep it simple stupid. :wink:

Two sentences about the idea in general (where to go).
A fraction of what you provided already. Why? I guess your 'novel' will keep several supporters away ... :roll:


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: February 23rd, 2007, 4:13 am 
For the first part about checking if window exist/are active, just set up some timers:
Code:
Gosub, StartTimers
Return

SignOn:
IfWinActive, Sign On
Gosub, StopTimers
Sleep, 100
Send, username{TAB}password{ENTER}
Gosub, StartTimers
Retrun

Error:
IfWinActive, Error
Gosub, StopTimers
Sleep, 100
Send, username{TAB}password{ENTER}
Gosub, StartTimers
Retrun

StartTimers:
SetTimer, SignOn, 500
SetTimer, Error, 500
Return


StopTimers:
SetTimer, SignOn, Off
SetTimer, Error, Off
Return


For the rest, sending click and moving the mouse and all, play around with AutoIt3 Window Spy in your AHK folder. Then read up in the help file on ControlGetPos, Control Click etc. Try ControlSetFocus on the edit fields maybe.

Looks like about everything you are asking about is possible. It will just take time and some trial and error :D


Report this post
Top
  
Reply with quote  
 Post subject: part 2. don't be scared
PostPosted: February 27th, 2007, 12:21 am 
Hey, thanks for the advice so far. I was afraid no one would ever respond to something so crazy long. You guys are great!

Ok, here goes a simplified version of what I wrote yesterday.

What the GUI program is designed to do:

>>Create a script<< (that’s it)

The script would be executed by a hotkey, paused by another, and terminated by another. The script would take into account “point” locations, created in a GUI by a “point and click” interface and a predefined database of “groups”. The point locations would either be the upper left hand corner of a point (when that is all that is needed) or the upper left and then the lower right.


I envision something similar to the following:



|| FILE || IMPORT || EXPORT (these are menus)
---------------------------------------------------------------------
//PLACEMENT//LIST//GLOBAL // (these are tabs)
---------------------------------------------------------------------
|| INS. POINT ||
-------------------------
||DELETE POINT || <GRAPHIC GOES HERE> (we are in the placement tab)
-------------------------
|| CREATE ITTR ||
---------------------------------------------------------------------





In the PLACEMENT tab (as shown above):

When one of the placement buttons (ie. INS. POINT ) were clicked, a crosshair would replace the mouse and the next click would automatically record the x and y coordinates of that pixel on the graphic. A window would then come up asking what type of point would be entered there. The user would enter one of several predefined options, such as “white”, “yellow”, “title”, or “invisible”. (the next time that box opened it would have the previous information in it). The user would be prompted for the mnemonic, which he would enter in text. A number would then appear on the graphic (just like the picture in my previous post) and the user could then insert another point.

I’m not sure how to get user mouse input on a click, or how to replace the mouse with a crosshair. I need some help with this code.

I also don’t know how to get data to be deleted from the memory, or how this “memory” idea will work. Is everything written to the hard drive? Can you keep stuff in RAM? How do you do this? How do you get it back? How do you clear the data after you are finished with it? Do I have to make a unique stack?




In the LIST tab (not shown):

The list of all points for this job would be shown in a table form.

I have no idea how to get the contents of a text file and dump them into a chart in the GUI. Please help me with this.



In the GLOBAL tab (not shown):

The global offset would be created. By clicking a “define global offset” button, the user would be prompted to click on the uppermost left hand pixel in an open graphic. All points would take this offset into effect. These values would be displayed, and could be edited manually. Also, a global STOP command and a RUN command would be defined, whether these were hotkeys or hot strings. The resulting iterations that this script would make would have to be able to be stopped by this command at anytime. I’m not sure how to make a global stop command or how to recalculate all of the mouse (x,y) coordinates yet (these inputs would have to be inputted before the iterations were created). Any ideas?




Under the FILE menu:

There would be a “Create Iterations” option, which would dump the results of the user inputs (defined by the INS. POINT) and the range of groups to access (defined in the list tab).

There would be an exit option. How do I get a command like “exit” to execute in a menu when clicked? Anyone have an example of a really basic GUI that has just an exit command? How about a “create iterations” command?




Under the IMPORT menu:

There would be an option to import all the “group” mnemonics (the things that tell my other program where to go to, after F2 is pressed) into the memory the program uses. Be it a text file or something in the RAM. Not clear on how to import from a text file to usable program memory.



Under the EXPORT menu:

There would be an option to export the points in the “memory” into a text file.




Another program I have recently been asked to create is the following, which makes a backup of all of the files stored in the panel on the job site. Basically the following works, but I need to know how to reference a textfile for the variables, so that my variables can be filled in as the various iterations are executed.




loop %num_of_jobs%

;%num_of_jobs% would be calculated based on how many
;lines of job names there were in the text file that
;the program was being pointed to, when the iterations were created.
;there would be one job per line. Not sure on how to count lines in a
;text file yet.

{
WinWait, RC-Studio
IfWinNotActive, RC-Studio
WinActivate
WinWaitActive
Sleep, 100
Send, {ALTDOWN}{ALTUP}aa

WinWait, Access System
IfWinNotActive
WinActivate
WinWaitActive
Send, %Job_Name%
; %Job_Name% would be from that same textfile

MouseClick, left, 67, 267
;This is the location of an “OK” button

Sleep, 100
WinWait, Sign On
IfWinNotActive
WinActivate
WinWaitActive
Send, username{TAB}password{ENTER}

WinWait, RC-Studio - %Job_Name%
IfWinNotActive
WinWaitActive
Sleep, 100
Send, {ALTDOWN}{ALTUP}nb

WinWait, Network Save
IfWinNotActive
WinActivate
WinWaitActive
MouseClick, left, 79, 96
Sleep, 100
MouseClick, left, 47, 254
Sleep, 100

;those previous mouse clicks define what kind of backup
;this is going to be. They are static and don’t need to change

; at this point I need to be able to have the program
;wait for two different events. One is an error, the other
;is the success. I’m still pretty unclear on how to get it to wait
;for two different things. How do those timers work?
;is it that they wait for one event, and then switch to wait
;for the other? You gave it 0.5s for one and then 0.5s for the
;other right? What’s the theory?

WinWait, Panel Status, Program backed up

;this is the success. If an error happened I need it to
;immediately jump to “Bye:”

Bye:
IfWinNotActive, Panel Status
WinActivate, Panel Status
WinWaitActive, Panel Status
Sleep, 100
Send, {ESC}
wait, 1000
Send, {ALT}{a}{b}

;The “Send, {ALT}{a}{b}” exits the job

Sleep, 10000
}

Return


The last question I have this time: how to get those nifty code boxes that have scroll bars on them in these forums? That makes the message much easier to read.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: February 27th, 2007, 12:34 am 
Offline

Joined: December 11th, 2006, 4:11 pm
Posts: 242
Location: Orlando, FL
use without the dots...

.[.code] enter code here .[./code]

looks like this...

Code:
 enter code here


Also, another solution to your problem with waiting for a certain condition to arise before your script does something is to use a directive, such as #IfWinActive. You can find out more about this and other directives in the help file.


Report this post
Top
 Profile  
Reply with quote  
 Post subject: text reference
PostPosted: February 27th, 2007, 7:49 pm 
Thanks for pointing out directives, those will be very useful.

How do I reference sequential lines from a text file to fill out a variable imbedded in another script? Such that a script that looked like the following…

Code:
Loop, 6
{
Send, %job_name%
Send, {ENTER}
}



…would run as follows…

Code:
Send, 123 Friendly Ave.
Send, {ENTER}
Send, YMCA
Send, {ENTER}
Send, YWCA
Send, {ENTER}
Send, Langley
Send, {ENTER}
Send, Police
Send, {ENTER}
Send, Maple
Send, {ENTER}



…when it was pointed to a text file (how do I do the pointing?) that had the following lines in it…

Code:
123 Friendly Ave
YMCA
YWCA
Langley
Police
Maple


?


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: February 27th, 2007, 8:12 pm 
Offline

Joined: December 11th, 2006, 4:11 pm
Posts: 242
Location: Orlando, FL
"FileReadLine" but perhaps storing the info in an ini file would be best.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 27th, 2007, 9:38 pm 
Jaytech,

I read about directives.

The following was an attempt to have two annoyances be dealt with:

Code:
loop
{

#IfWinActive, Sign On
Send, username{TAB}password{ENTER}

#IfWinActive, Macromedia FreeHand MX, The current target p
Send, {ENTER}
sleep, 100
send, {ENTER}

;}



This does not work, as my username and password are simply strewn over every window in existence.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: February 27th, 2007, 10:46 pm 
Offline

Joined: December 27th, 2005, 1:46 pm
Posts: 6837
Location: France (near Paris)
You are mixing up #IfWinActive (directive) and IfWinActive (command).
The former is to define hotkeys and shouldn't be in a loop!
The later might be what you are trying to use, you should add a little Sleep in the loop to avoid hogging the CPU...
Oh, and if you need 3 lines after the second test, put them in braces!

_________________
Image vPhiLho := RegExReplace("Philippe Lhoste", "^(\w{3})\w*\s+\b(\w{3})\w*$", "$1$2")


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 28th, 2007, 9:37 pm 
Ok, so I can see now that directives are only for hotkeys. Thanks, PhiLho.

How do I make an “if, then, else” statement about a window being active in the auto-execute section? Like:

Code:
Sign on:
Ifwinactive, sign on
{
Send, username{tab}password{enter}
Return
}
Else, gosub, printer

Printer:
Ifwinactive, wrong printer
{
Send, {enter}{enter}
Return
}
Else, gosub, error

Error:
Ifwinactive, annoyingerror
{
Send, {enter}
Return
}
Else, return


I don’t understand why this does not work. Shouldn’t this just skip by all windows until it finds one that there is a command for, if one of those is active? If not, why not?


Great idea with a the .ini file! I will use an .ini file instead of the text file idea. I read up on the .ini read and write, but I cannot figure out how to get sequential key reads. How can I get it to read the first key off, use that info for a variable in the first loop, and then use the second key for the variable in the second loop, etc.?

Code:
[job_names]
0001 = 512 9th Avenue
0002 = 1024 10th Avenue
0003 = 2048 11th Avenue
etc…


Into my backup program:

Code:
;
::*backup::
loop %num_of_jobs%

;%num_of_jobs% is calculated, based on all the
;entries in the .ini file.  I don’t know how to do this yet either
;any ideas for summing number of key entries?

{
WinWait, RC-Studio
IfWinNotActive, RC-Studio
WinActivate
WinWaitActive
Sleep, 100
Send, {ALTDOWN}{ALTUP}aa
WinWait, Access System
IfWinNotActive
WinActivate
WinWaitActive
Send, %Job_Name%

; %Job_Name% is found in the .ini file
;job names must be exactly as in system list
;example "1140 W Pender R1" (no quotes)

MouseClick, left,  67,  267
Sleep, 100
WinWait, Sign On
IfWinNotActive
WinActivate
WinWaitActive
Send, username{TAB}password{ENTER}
WinWait, RC-Studio - %Job_Name%

; %Job_Name% is found in the .ini file
;job names must be exactly as in system list
;example "1140 W Pender R1" (no quotes)

IfWinNotActive
WinWaitActive
Sleep, 100
Send, {ALTDOWN}{ALTUP}nb

WinWait, Network Save
IfWinNotActive
WinActivate
WinWaitActive
MouseClick, left,  79,  96
Sleep, 100
MouseClick, left,  47,  254
Sleep, 100
WinWait, Panel Status, Program backed up
IfWinNotActive, Panel Status
WinActivate, Panel Status
WinWaitActive, Panel Status
Sleep, 100
Send, {ESC}
sleep, 1000
Send, {ALT}{a}{b}
}
;



thanks again guys,
fogus


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: March 10th, 2007, 8:31 pm 
Hey,

Does anyone have some experience that they can share with me regarding the INI files? I really am clueless as to how to use them with a script. I have lots of questions about them, maybe someone has some answers? I would really appreciate it.

Some questions (plus the above from my previous post):

1. How do I get a script to reference sequential lines from an INI? (such that it would read line 1, then line 2, then line 3, moving one down each time it did a cycle of a loop in a script)
2. How do I get these values that are read from the INI to fit themselves into the script where the variables are?
3. How do I add all the lines in an INI, such that I get a number representing the total iterations to take place? For example, if each line represents a job that I want my program to access, how do I figure out how many times the loop is to take place? Or is there a way to just say “Keep doing the iterations until there are no more job names in the INI”?
4. How do I define the file path? Can I use a relative file path? Can I have the script just look automatically in the folder it is in the for the INI file? Is there a way to have a dialogue pop up and ask me to locate the INI file (like the “open” dialogue in most programs)?
5. How do I make a global stop command in a script?

I have read the help files on these functions, but I am not sure how to proceed in my particular case because there is a general lack of examples. Could someone give me a tiny example that I could look at that is doing what I want? Maybe,

Code:
Loop, %numofjobs%  ;this is calculated from the number of lines in the INI (in this case 7)
Run, Notepad
Send, %jobname%  ;this is read from the INI
Send, {altdown}F4{altup}   ;attempts to close program
Send, {enter}   ;selects save
Send, {enter}   ;saves it to desktop or where ever


Where %jobname% are sequentially read from the INI file with the following:

Code:
[job_names]
Bentall
Concert
Sun life
Semiamoo
Camebridge
Care life building



Please help,

~fogus


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: March 10th, 2007, 10:25 pm 
Offline

Joined: November 13th, 2004, 4:08 am
Posts: 2951
Location: Minnesota
fogus wrote:
1. How do I get a script to reference sequential lines from an INI? (such that it would read line 1, then line 2, then line 3, moving one down each time it did a cycle of a loop in a script)
2. How do I get these values that are read from the INI to fit themselves into the script where the variables are?
3. How do I add all the lines in an INI, such that I get a number representing the total iterations to take place? For example, if each line represents a job that I want my program to access, how do I figure out how many times the loop is to take place? Or is there a way to just say “Keep doing the iterations until there are no more job names in the INI”?

The correct format of an .ini file is something like this:
Code:
[Section1]
Key1=Value1
Key2=Value2

;a comment

[AnotherSection]
Key=Value

Keys, values, and even section names can be anything. AutoHotkey's 'Ini' commands can easily manipulate a file in this format. However, if it's more convenient for you to have the file in a different format, it would be better to use the simpler file-reading commands.

fogus wrote:
4. How do I define the file path? Can I use a relative file path? Can I have the script just look automatically in the folder it is in the for the INI file?

Yes, paths can be relative, and the script's default current directory is the one it was started in.

fogus wrote:
Is there a way to have a dialogue pop up and ask me to locate the INI file (like the “open” dialogue in most programs)?

See the FileSelectFile command.

fogus wrote:
5. How do I make a global stop command in a script?

With the ExitApp command.


Report this post
Top
 Profile  
Reply with quote  
 Post subject: sequentialness
PostPosted: March 15th, 2007, 10:29 pm 
Hey,

What is the command for sequential reads to be imputed for a single variable? (such that it would read line 1, then line 2, then line 3, moving one down each time it did a cycle of a loop in a script)

How do I add all the lines in an INI, such that I get a number representing the total iterations to take place? For example, if each line represents a job that I want my program to access, how do I figure out how many times the loop is to take place? Or is there a way to just say “Keep doing the iterations until there are no more job names in the INI”?

I know I am reposting this, but I really need an answer. The documentation's examples are far too simplistic for me to see how to solve this problem. Can someone give me an example, please? Something that works for the example I gave in my last post?


Thanks,

fogus


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: March 15th, 2007, 10:50 pm 
Quote:
How can I get it to read the first key off, use that info for a variable in the first loop, and then use the second key for the variable in the second loop, etc.?
Code:
Loop, Parse, My.ini {
   If InStr(A_LoopField," = ")
      NumKeys++
   }

Loop, %NumKeys% {
  Key := A_Index
  SetFormat, float, 04.0
  Key += 0.0
  INIRead, Value, My.ini, job_names, %Key%
  MsgBox Loop: %A_Index% - %Key% = %Value%
  }
My.ini
Code:
[job_names]
0001 = 512 9th Avenue
0002 = 1024 10th Avenue
0003 = 2048 11th Avenue
Not tested.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: March 16th, 2007, 12:21 am 
Help,

In the line: "Loop, Parse, My.ini { "

When I load it, it says that both the "." and the "{" are illegal characters.


Report this post
Top
  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 28 posts ]  Go to page 1, 2  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: 0x150||ISO, Alpha Bravo, janopn, Kgalv, Kirtman, kwfine and 72 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group