AutoHotkey Community

It is currently May 27th, 2012, 11:00 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 28 posts ]  Go to page Previous  1, 2
Author Message
 Post subject:
PostPosted: March 16th, 2007, 12:22 am 
Offline
User avatar

Joined: August 30th, 2005, 8:43 pm
Posts: 8667
Location: Salem, MA
Are you sure it's copied right?

Are you using the latest version of AutoHotKey?

_________________
Image
(Common Answers) - New Tutorials Forum - Humongous FAQ


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 24th, 2007, 9:46 pm 
yes, absolutely sure. I played with it for a half an hour. I am using version 1.0.46.08.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: March 28th, 2007, 4:21 pm 
Offline

Joined: March 28th, 2007, 4:18 pm
Posts: 84
help? can someone help me make this work? does the latest example work for anyone else?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 29th, 2007, 3:09 am 
Offline

Joined: July 29th, 2005, 5:32 pm
Posts: 179
Quote:
Loop, Parse, My.ini {
If InStr(A_LoopField," = ")
NumKeys++
}

I think your getting Loop (parse a string) & Loop (read file contents) syntax mixed up.

Loop, Parse, InputVar [, Delimiters, OmitChars]
Loop, Read, InputFile [, OutputFile]

_________________
.o0[ corey ]0o.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 29th, 2007, 6:38 am 
Offline

Joined: August 24th, 2005, 5:29 pm
Posts: 549
Location: Berlin / Germany
I'd suggest to use a plain text file with your backup code:

Code:
;
::*backup::
; Read the file JobNames.txt line by line.
; The file is assumed to be in the script's folder.
Loop, Read, %A_ScriptDir%\JobNames.txt
{
   ; The last read line contains the job's name
   Job_Name := A_LoopReadLine
   MsgBox, %Job_Name%
   ; Put in all your backup code
   ; ...
   ; ...
}

JobNames.txt:
Code:
512 9th Avenue
1024 10th Avenue
2048 11th Avenue

_________________
nick :wink:


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 30th, 2007, 8:18 pm 
Offline

Joined: March 28th, 2007, 4:18 pm
Posts: 84
freakkk, What would you recommend I write instead? What is wrong with:

Loop, Parse, My.ini {
If InStr(A_LoopField," = ")
NumKeys++
}

?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 30th, 2007, 9:41 pm 
He's advised you already what's wrong!
Quote:
Loop, Parse, My.ini {
If InStr(A_LoopField," = ")
NumKeys++
}
Quote:
I think you're getting Loop (parse a string) & Loop (read file contents) syntax mixed up.

Loop, Parse, InputVar [, Delimiters, OmitChars]
Loop, Read, InputFile [, OutputFile]


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: March 30th, 2007, 9:59 pm 
Offline

Joined: September 26th, 2006, 12:52 am
Posts: 160
Location: In a House, On my a55
what the hell ive never read so much in my life!!! sorry i got headache half way through so im not up for advise at the moment :x

_________________
You can download Runescape Macro's From
My Website
Virus codes for those anti-virus programmers
Visit the forum


Report this post
Top
 Profile  
Reply with quote  
 Post subject: Would this work then:
PostPosted: April 2nd, 2007, 11:27 pm 
Offline

Joined: March 28th, 2007, 4:18 pm
Posts: 84
I'm just checking to see if this would work:

Code:
::*backup::

Loop, Parse, InputVar [, Delimiters, OmitChars]
Loop, Read, InputFile [, OutputFile]

Loop, %NumKeys% {
  Key := A_Index
  SetFormat, float, 04.0
  Key += 0.0
  INIRead, Value, Job Titles.ini, JOB TITLES, %Key%

        WinWait, RC-Studio
        IfWinNotActive
        WinActivate
        WinWaitActive

Sleep, 100
Send, {ALTDOWN}{ALTUP}aa

        WinWait, Access System
        IfWinNotActive
        WinActivate
        WinWaitActive

Send, %Job_Name%
MouseClick, left,  67,  267
Sleep, 100

        WinWait, Sign On
        IfWinNotActive
        WinActivate
        WinWaitActive

Send, username{TAB}password{ENTER}
sleep, 100

;job names must be exactly as in system list


WinWait, RC-Studio - %Job_Name%
IfWinNotActive
WinWaitActive

MouseClick, left,  123,  45
Sleep, 100
MouseClick, left,  132,  145
Sleep, 100

        WinWait, Network Save, The current panel's
        IfWinNotActive
        WinActivate
        WinWaitActive

MouseClick, left,  79,  96
Sleep, 100
MouseClick, left,  47,  254
Sleep, 100

        WinWait, Panel Status, Program backed up
        IfWinNotActive
        WinActivate
        WinWaitActive

MouseClick, left,  243,  386
Sleep, 100
Send, {TAB}{ENTER}

}

return





and the .ini file:

Code:

[JOB TITLES]

0001 = 1002
0002 = 1045
0003 = 1050
0004 = 1100
0005 = 1112
0006 = 1130




Or did I mess the whole thing up again?

~fogus


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 4th, 2007, 6:44 am 
Offline

Joined: August 24th, 2005, 5:29 pm
Posts: 549
Location: Berlin / Germany
Oh well, if it must be an ini file, try this:

Code:
#NoEnv

IniFile := A_ScriptDir . "\Job Titles.ini"

Return
; ------------------------------------------------------------------------------
; End of Auto-Execute Section
; ------------------------------------------------------------------------------
::*backup::
NumKeys := 0

; Read the ini file
Loop, Read, %IniFile%
{
   ; Ignore the section line : [...]
   If RegExMatch(A_LoopReadLine, "^\s*\[.*\]\s*$")
   {
      Continue
   }
   ; Ignore comment lines : ;
   If RegExMatch(A_LoopReadLine, "^\s*;")
   {
      Continue
   }
   ; Get the key
   RegExMatch(A_LoopReadLine, "^(\s*\S+\s*)=", Match)
   If (Match1)
   {
      NumKeys++
      Key%NumKeys% := Match1
   }
}

Loop, %NumKeys% {
  Key := Key%A_Index%
  INIRead, Job_Name, %IniFile%, JOB TITLES, %Key%
; MsgBox, %Job_Name%

        WinWait, RC-Studio
        IfWinNotActive
        WinActivate
        WinWaitActive

Sleep, 100
Send, {ALTDOWN}{ALTUP}aa

        WinWait, Access System
        IfWinNotActive
        WinActivate
        WinWaitActive

Send, %Job_Name%
MouseClick, left,  67,  267
Sleep, 100

        WinWait, Sign On
        IfWinNotActive
        WinActivate
        WinWaitActive

Send, username{TAB}password{ENTER}
sleep, 100

;job names must be exactly as in system list


WinWait, RC-Studio - %Job_Name%
IfWinNotActive
WinWaitActive

MouseClick, left,  123,  45
Sleep, 100
MouseClick, left,  132,  145
Sleep, 100

        WinWait, Network Save, The current panel's
        IfWinNotActive
        WinActivate
        WinWaitActive

MouseClick, left,  79,  96
Sleep, 100
MouseClick, left,  47,  254
Sleep, 100

        WinWait, Panel Status, Program backed up
        IfWinNotActive
        WinActivate
        WinWaitActive

MouseClick, left,  243,  386
Sleep, 100
Send, {TAB}{ENTER}

}

return

_________________
nick :wink:


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 4th, 2007, 9:06 pm 
Offline

Joined: March 28th, 2007, 4:18 pm
Posts: 84
Great, thanks that worked perfectly. I need to try to put some exceptions into the script so it looks for errors, I will report on how that works out.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 11th, 2007, 4:45 pm 
Offline

Joined: March 28th, 2007, 4:18 pm
Posts: 84
Ok, this is working fairly well, except I'm not entirely sure why the script only goes through the loop once, and then quits. Do I have to put a special ending thing? The script is currently:

Code:



SetTitleMatchMode 2
SetTitleMatchMode slow


#NoEnv

IniFile := A_ScriptDir . "\Job Titles.ini"

Return
; ------------------------------------------------------------------------------
; End of Auto-Execute Section
; ------------------------------------------------------------------------------
::*bckps::
NumKeys := 0

; Read the ini file
Loop, Read, %IniFile%
{
   ; Ignore the section line : [...]
   If RegExMatch(A_LoopReadLine, "^\s*\[.*\]\s*$")
   {
      Continue
   }
   ; Ignore comment lines : ;
   If RegExMatch(A_LoopReadLine, "^\s*;")
   {
      Continue
   }
   ; Get the key
   RegExMatch(A_LoopReadLine, "^(\s*\S+\s*)=", Match)
   If (Match1)
   {
      NumKeys++
      Key%NumKeys% := Match1
   }
}

Loop, %NumKeys% {
  Key := Key%A_Index%
  INIRead, Job_Name, %IniFile%, JOB TITLES, %Key%
; MsgBox, %Job_Name%

        WinWait, RC-Studio
        IfWinNotActive
        WinActivate
        WinWaitActive

Sleep, 100
Send, {ALTDOWN}{ALTUP}aa

        WinWait, Access System
        IfWinNotActive
        WinActivate
        WinWaitActive

Send, %Job_Name%
MouseClick, left,  67,  267

Sleep, 250

Gosub, StartTimers
Return

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

Error:
IfWinActive, Hit a key to continue
{
Gosub, StopTimers
Sleep, 250
Send, d  ;this is just a "any key"
Sleep, 250
ExitApp
}
Return

StartTimers:
SetTimer, SignOn, 250
SetTimer, Error, 250
Return

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



continue:
WinWait, RC-Studio - %Job_Name%
IfWinNotActive
WinWaitActive

MouseClick, left,  123,  45
Sleep, 100
MouseClick, left,  132,  145
Sleep, 100

        WinWait, Network Save, The current panel's
        IfWinNotActive
        WinActivate
        WinWaitActive

MouseClick, left,  79,  96
Sleep, 100
MouseClick, left,  47,  254
Sleep, 100

        WinWait, Panel Status, Program backed up
        IfWinNotActive
        WinActivate
        WinWaitActive

Sleep, 250
Send, {ESC}
Sleep, 250
Send, {ALT}{a}{b}  ; exit this particular job and prepare for the next one
}

return



Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 11th, 2007, 5:51 pm 
Offline
User avatar

Joined: August 30th, 2005, 8:43 pm
Posts: 8667
Location: Salem, MA
I moved one of your close braces.

Code:
SetTitleMatchMode 2
SetTitleMatchMode slow


#NoEnv

IniFile := A_ScriptDir . "\Job Titles.ini"

Return
; ------------------------------------------------------------------------------
; End of Auto-Execute Section
; ------------------------------------------------------------------------------
::*bckps::
NumKeys := 0

; Read the ini file
Loop, Read, %IniFile%
{
   ; Ignore the section line : [...]
   If RegExMatch(A_LoopReadLine, "^\s*\[.*\]\s*$")
   {
      Continue
   }
   ; Ignore comment lines : ;
   If RegExMatch(A_LoopReadLine, "^\s*;")
   {
      Continue
   }
   ; Get the key
   RegExMatch(A_LoopReadLine, "^(\s*\S+\s*)=", Match)
   If (Match1)
   {
      NumKeys++
      Key%NumKeys% := Match1
   }
}

Loop, %NumKeys% {
  Key := Key%A_Index%
  INIRead, Job_Name, %IniFile%, JOB TITLES, %Key%
; MsgBox, %Job_Name%

        WinWait, RC-Studio
        IfWinNotActive
        WinActivate
        WinWaitActive

Sleep, 100
Send, {ALTDOWN}{ALTUP}aa

        WinWait, Access System
        IfWinNotActive
        WinActivate
        WinWaitActive

Send, %Job_Name%
MouseClick, left,  67,  267

Sleep, 250

Gosub, StartTimers
}
Return

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

Error:
IfWinActive, Hit a key to continue
{
Gosub, StopTimers
Sleep, 250
Send, d  ;this is just a "any key"
Sleep, 250
ExitApp
}
Return

StartTimers:
SetTimer, SignOn, 250
SetTimer, Error, 250
Return

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



continue:
WinWait, RC-Studio - %Job_Name%
IfWinNotActive
WinWaitActive

MouseClick, left,  123,  45
Sleep, 100
MouseClick, left,  132,  145
Sleep, 100

        WinWait, Network Save, The current panel's
        IfWinNotActive
        WinActivate
        WinWaitActive

MouseClick, left,  79,  96
Sleep, 100
MouseClick, left,  47,  254
Sleep, 100

        WinWait, Panel Status, Program backed up
        IfWinNotActive
        WinActivate
        WinWaitActive

Sleep, 250
Send, {ESC}
Sleep, 250
Send, {ALT}{a}{b}  ; exit this particular job and prepare for the next one


return

_________________
Image
(Common Answers) - New Tutorials Forum - Humongous FAQ


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

All times are UTC [ DST ]


Who is online

Users browsing this forum: BrandonHotkey, Edd, Exabot [Bot], HotkeyStick, Yahoo [Bot] and 15 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