AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Syntax-Tidy for scripts (indentation and case correction)
Goto page Previous  1, 2, 3, 4  Next
 
Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions
View previous topic :: View next topic  
Author Message
BoBo
Guest





PostPosted: Tue Mar 01, 2005 1:39 pm    Post subject: Reply with quote

Quote:
I wonder what Rajat thinks of it?

@ toralf
spekulierst du auf Heiligsprechung ? Laughing
Da werden wir wohl erstmal deine Frau zu deinen nächtlichen Coding-Sessions befragen müssen ! Wink
Back to top
Rajat



Joined: 28 Mar 2004
Posts: 1687

PostPosted: Tue Mar 01, 2005 7:15 pm    Post subject: Reply with quote

toralf wrote:
I wonder what Rajat thinks of it?

*sorry for being late* i must say toralf that this is coming along really well. and as i once started doing a similar script, i know that ahk's syntax poses certain difficulties, which are being well handled by u!

a li'l section from one of my codes where brackets are not accurately placed is here for you. it might help u to improve your script.
Code:

Loop
{
PixelSearch, PosX, PosY, 1, %A_Index%, %A_ScreenHeight%, %A_Index%, %11%

Loop
{
Y = %A_Index%

Loop
{
X = %A_Index%
StringTrimRight, CurrClr, %X%%Y%, 0
IfEqual, CurrClr,, Break

CurrX := PosX + X
Found = 1
PixelGetColor, CheckCol, %CurrX%, %Y%
IfNotEqual, CheckClr, %CurrClr%
{
Found = 0
Break
}
}

Y ++
StringTrimRight, YCheck, 1%Y%, 0
IfEqual, YCheck,
{
MsgBox, %PosX% %PosY%
}
}
}


@BoBo
this is what google offered. how accurate is it?
Quote:
do you speculate on holy speaking? There we will have to ask probably first times your wife to your nocturnal Coding sessions

_________________
Back to top
View user's profile Send private message
toralf



Joined: 31 Jan 2005
Posts: 3910
Location: Bremen, Germany

PostPosted: Tue Mar 01, 2005 9:16 pm    Post subject: Reply with quote

Pretty good translation with google.

I will have a look at the code you posted.
_________________
Ciao
toralf
Back to top
View user's profile Send private message Send e-mail Visit poster's website
toralf



Joined: 31 Jan 2005
Posts: 3910
Location: Bremen, Germany

PostPosted: Tue Mar 01, 2005 9:33 pm    Post subject: Reply with quote

Dear Rajat,

I had a look at the snippet you posted. It works ok on my machine.
Here is what I got
Code:
Loop
{
   PixelSearch, PosX, PosY, 1, %A_Index%, %A_ScreenHeight%, %A_Index%, %11%
   Loop
   {
      Y = %A_Index%
      Loop
      {
         X = %A_Index%
         StringTrimRight, CurrClr, %X%%Y%, 0
         IfEqual, CurrClr,
            Break
         CurrX := PosX + X
         Found = 1
         PixelGetColor, CheckCol, %CurrX%, %Y%
         IfNotEqual, CheckClr, %CurrClr%
         {
            Found = 0
            Break
         }
      }
      Y ++
      StringTrimRight, YCheck, 1%Y%, 0
      IfEqual, YCheck,
      {
         MsgBox, %PosX% %PosY%
      }
   }
}


Please note that the one-liners like "ifequal,something,somethingelse,break" are not supported by my script. therefore I changed it in the code. I deleted the empty lines for smaller size.

This indentation is 1Tab with Rajat style.
_________________
Ciao
toralf
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Rajat



Joined: 28 Mar 2004
Posts: 1687

PostPosted: Tue Mar 01, 2005 10:02 pm    Post subject: Reply with quote

my bad! i forgot abt the note that one line if cmds don't work well. by the way can't u parse the if cmd line and check the number of commas to determine how to format it?
_________________
Back to top
View user's profile Send private message
toralf as guest
Guest





PostPosted: Wed Mar 02, 2005 5:26 am    Post subject: Reply with quote

How?
The somethingelse is a value. There might be literal commas in it, right?
So I do not see any chnace to parse it correctly.
Unless someone writes that peace of code, I will not work on it. My main concern was to get rid of a lot of manual modifications. That's what it does. This relatively small shortcome is fine with me.

Does anyone know how to parse these if cmds without regex?
Back to top
Rajat



Joined: 28 Mar 2004
Posts: 1687

PostPosted: Wed Mar 02, 2005 6:20 am    Post subject: Reply with quote

when parsing the cmd line check for the last char of A_LoopField and see if it is `. and if its so then keep A_LoopField in a buffer and add it to next one as its the same parameter and the comma was escaped.

this is just from the top off my head, there might be some aspect that i've not yet thought of.
_________________
Back to top
View user's profile Send private message
Rajat



Joined: 28 Mar 2004
Posts: 1687

PostPosted: Wed Mar 02, 2005 6:27 am    Post subject: Reply with quote

and toralf, it'd be nice if u make settings available to individually select what changes we'd like your script to do... as u've already made some things optional, other settings like just case-correction, or just indentation etc. should be nice.

and now that u've already made a GUI for your script, i think what would be optimum is u move all settings to another tab and keep the report (its nice btw!) etc on first tab.

thanx.
_________________
Back to top
View user's profile Send private message
toralf



Joined: 31 Jan 2005
Posts: 3910
Location: Bremen, Germany

PostPosted: Wed Mar 02, 2005 6:50 am    Post subject: Reply with quote

I'm very sorry Rajat, but I stopped developing that script any further. I will only look for bugs. As for the options: All options are in the GUI. CaseCorrection is not in the script, so there is no option for it.
I have a new project. This one was just a side product. And I already spend too much time on it.
If anyone feels like it: make a mod.
_________________
Ciao
toralf
Back to top
View user's profile Send private message Send e-mail Visit poster's website
jonny



Joined: 13 Nov 2004
Posts: 2951
Location: Minnesota

PostPosted: Wed Mar 02, 2005 3:50 pm    Post subject: Reply with quote

Like I said a while ago, I'll be making a script like this, and now that toralf's already done some very nice work I'll have something to build on. It's on my todo list, but I'm not sure when I'll get to it.
Back to top
View user's profile Send private message
Rajat



Joined: 28 Mar 2004
Posts: 1687

PostPosted: Wed Mar 02, 2005 8:20 pm    Post subject: Reply with quote

its sad that u're leaving the project toralf... but probably jonny (as he said) will take it up. nice work!
_________________
Back to top
View user's profile Send private message
toralf



Joined: 31 Jan 2005
Posts: 3910
Location: Bremen, Germany

PostPosted: Thu Mar 03, 2005 2:54 pm    Post subject: Reply with quote

Ok you got me, Rajat. I found a way to parse the one-line if statements. The script in first post is updated. Please try it, I haven't tested it heavily.
_________________
Ciao
toralf
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Rajat



Joined: 28 Mar 2004
Posts: 1687

PostPosted: Thu Mar 03, 2005 9:34 pm    Post subject: Reply with quote

hey toralf!

with the latest update to your script i din't do any heavy testing yet... i just ran it on the old piece of code... the brackets aren't rightly placed. except that it looks great!

Code:

Loop
{
   PixelSearch, PosX, PosY, 1, %A_Index%, %A_ScreenHeight%, %A_Index%, %11%
   Loop
   {
      Y = %A_Index%
      Loop
      {
         X = %A_Index%
         StringTrimRight, CurrClr, %X%%Y%, 0
         IfEqual, CurrClr,
         Break
         CurrX := PosX + X
         Found = 1
         PixelGetColor, CheckCol, %CurrX%, %Y%
         IfNotEqual, CheckClr, %CurrClr%
         {
            Found = 0
            Break
         }
   }
   Y ++
   StringTrimRight, YCheck, 1%Y%, 0
   IfEqual, YCheck,
   {
      MsgBox, %PosX% %PosY%
   }
}
}

_________________
Back to top
View user's profile Send private message
toralf



Joined: 31 Jan 2005
Posts: 3910
Location: Bremen, Germany

PostPosted: Fri Mar 04, 2005 10:34 am    Post subject: Reply with quote

Dear Rajat,
I can't reproduce it on my machine.

- Please check if you have specified the syntax file correctly (just below the #singleinstance). In the script I use the path "Programme" due to german OS. You might need %Program Files%.
_________________
Ciao
toralf
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Rajat



Joined: 28 Mar 2004
Posts: 1687

PostPosted: Fri Mar 04, 2005 6:01 pm    Post subject: Reply with quote

that was it toralf! now it runs great!...actually i never really went through the code... just ran it as it was..

and the cmd case correction can be a nice feature... its just a simple function to replace the occurrances of cmdnames in script with the ones in list... a li'l check to not modify items with less than 5 char length would b better as they might be part of text on msgbox etc. (eg. run, sort, menu)... i can code it for u if u say.
_________________
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions All times are GMT
Goto page Previous  1, 2, 3, 4  Next
Page 2 of 4

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group