AutoHotkey Community

It is currently May 26th, 2012, 7:46 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 15 posts ] 
Author Message
PostPosted: May 6th, 2009, 4:00 pm 
Offline

Joined: December 24th, 2008, 3:25 am
Posts: 1401
Location: :noitacoL
I work in a corporate environment; I had to fight tooth and nail to even be allowed to have AHK installed on our Pc/Network. We have 14 people on my team, and I am the only one ‘in charge’ of the scripting as I am the only one smart enough to be able to tie my own shoes.

Sometimes things around here change, be it policy or rules or portal settings. Whenever a change is made, often the script needs coding updates. Currently the AHK program itself is installed on the 14 computers, and the actual custom script is in a folder on each machine. Everyone has customer screen resolutions or IE settings, the script interacts with an IE page pulling data and such. The script needs to be customized to each individual, the ‘mouse click’ coordinates [x/y] vary per person.

That said, every update means I need to make 14 individual script updates. I am looking for advice/input about what is the best way to go about updating everyone’s scripts. I cannot spend 2 hours fixing things every time there is a minor change.

I have some fileappend stuff that does low level reporting “WkOrd: %GuiWkOrd% | PRnotes: %GuiNotes%, S:\File\file\file\TEXT DATA\user_name.txt”, each person has a fileappend with their name.txt. Each person has customer x/y cords because of their screens.

I am just growing frustrated with the complexity that I’ve built into my own scripts and really just want some advice and feedback from someone who has been through something similar.

As always ,thanks all


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 6th, 2009, 4:12 pm 
Offline

Joined: May 27th, 2007, 9:41 am
Posts: 4999
Some thoughts:

- place the settings for all users in an INI, use A_UserName as section
- place the INI on the network so you only have to update one FILE
- same goes for the fileappend, use A_UserName as filename

Also A_ScreenWidth and A_ScreenHeight might be useful as is Coordmode

_________________
AHK FAQ
TF : Text files & strings lib, TF Forum


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 6th, 2009, 4:28 pm 
Offline

Joined: December 24th, 2008, 3:25 am
Posts: 1401
Location: :noitacoL
Wow, very nice. I cant recall seeing 'a_username' so I never thought about that.

So in theory, I can have the user 'sign into' my script/gui, as opposed to just launching it to use it. When they sign in, the script goes into the ini, and says "hey you are user_1, so that means your X and Y are this, and your log file should be this"?

I found a few articles using the advanced search, as opposed to the regular search, I will see what I can poach to add it to mine.


Report this post
Top
 Profile  
Reply with quote  
PostPosted: May 6th, 2009, 4:47 pm 
Offline

Joined: August 13th, 2006, 6:45 am
Posts: 355
Location: Germany
Hi Carcophan,

besides the solutions of the previous posts, store your application on a net drive and only a startup program, that should never change, on the 14 computers:
Code:
directory = <net drive>:\<application dir>
filecopy, %directory%\<application file>, %a_scriptdir%, 1
run %a_scriptdir%\<application file>


Replace <...> with your needs.

Hubert


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 6th, 2009, 5:27 pm 
Offline

Joined: April 17th, 2007, 1:37 pm
Posts: 761
Location: Florida
My 2c: Simple Auto-Update and store the user settings in an INI as mentioned above...

If you decide to use it and need help implementing let me know in this thread..

_________________
[Join IRC!]
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 6th, 2009, 6:04 pm 
Offline

Joined: May 27th, 2007, 9:41 am
Posts: 4999
You may also want to look at Automation IE7 Navigation and Scripting with Tabs:
http://www.autohotkey.com/forum/viewtopic.php?t=30599
That way you may be able to skip the click all together.
(But is is more complicated so YMMV)

_________________
AHK FAQ
TF : Text files & strings lib, TF Forum


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 6th, 2009, 6:52 pm 
Offline

Joined: December 24th, 2008, 3:25 am
Posts: 1401
Location: :noitacoL
Thank you all for your input, I have a lot of research and testing to play around with.

I like the batchfile idea, but I think that is a little outside my knowledge level. I saw this on one of the threads, it looks easier than anything else to incorporate.

Code:
Users_Hotline := "User1,User2,User3"
Users_CommCenter := "User1,User2,User3,User4,User5"
If A_UserName not in %Users_Hotline%
   If A_UserName not in  %Users_CommCenter%
   {   MsgBox, 16,UNAUTHORIZED, You are not an authorized user., 5
      exitapp
   }

If A_UserName in %Users_CommCenter%
   User_CommCenter:=true
If A_UserName in %Users_Hotline%
   User_Hotline:=true


Random question: What is 'YMMV' short for lol


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 6th, 2009, 7:25 pm 
Offline

Joined: May 27th, 2007, 9:41 am
Posts: 4999
Code:
ini= ; just to create an example ini file
(
[User1]
Key=Value1
[User2]
Key=Value2
)
FileDelete, config.ini
FileAppend, %ini%, config.ini

UserName=User1 ; don't use this line just to illustrae
IniRead, Key, config.ini, %UserName%, Key , NotFound ; change UserName to A_UserName in actual script. Note the default value NotFound here, not used because User1 is in the ini
MsgBox % Key

UserName=User2 ; don't use this line just to illustrae
IniRead, Key, config.ini, %UserName%, Key , NotFound ; change UserName to A_UserName in actual script
MsgBox % Key

UserName=User3 ; don't use this line just to illustrae
IniRead, Key, config.ini, %UserName%, Key , NotFound ; change UserName to A_UserName in actual script. Note NotFound, because User3 isn't in the INI it will assign NotFound to Key so you can:

If (Key = "NotFound")
   MsgBox NO SUCH USER ; to find if a user is or isn't a valid user

; YMMV = your milage may vary

_________________
AHK FAQ
TF : Text files & strings lib, TF Forum


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 6th, 2009, 8:54 pm 
Offline

Joined: April 8th, 2009, 7:21 pm
Posts: 16
Actually, the issue is not really storing the files, but the customization necessary on each of the machines that requires the different files.

When you are using the script to pull data from the webpage, how are you doing this? The cleanest experience I have, is to actually click on an unused area of the web page, Ctrl-A to highlight everything, and then Ctrl-C to put them into the Clipboard and use regular expressions to parse the text.

I haven't been able to figure out how to pull the HTML code right out of a browser yet...


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 6th, 2009, 9:24 pm 
Offline

Joined: December 24th, 2008, 3:25 am
Posts: 1401
Location: :noitacoL
@ Zire, that is pretty spot on, regarding my issue.

An example of how I pull my data:
Code:
;some names/data changed for security reasons, sorry.

IfWinNotExist, 'Website' - Microsoft Internet Explorer
{
                MsgBox, 'Website' is *-NOT-* active, please launch the 'website' Portal.`nOnce logged in, click the Get Ticket Data button again.
}
 
else
{                                                                                             
 
                StartTime := A_TickCount
 
                BlockInput, on                                                                   
                WinActivate, 'Website' - Microsoft Internet Explorer   
                WinMaximize
 
                send,{PgUp}                                                                                                                                                                                    ;page up to ensure consistancy, users scroll down with wheel mouse or windows change accidently
 
                Sleep 200
          ;PixelColor
                PixelGetColor, color, 17, 473                                                                       
                                                                                                     sleep 200                                                                                             ;if not blue/green than do not click
 
                if (color =  0xFFCC66 || color = 0x00CC00)
                {             
                                send, {PgUp}

             ;PixelColor
                                click 17, 473                                                                 ;clicks/opens/expands the 'website' bar
 
                                                                                                                                 clipboard := ""                                                                                                                 
                                Click 50, 481, 3                 
                                Send, ^c
                                Clipwait                                                                               
                                Gui1111 = %clipboard%                                                                                 clipboard := ""                                                                   ;clears contents of clipboard
                                                ;------------------
                                Click 120, 481, 3                 
                                Send, ^c
                                Clipwait
                                Gui111111 = %clipboard%
                                clipboard := ""
                                                ;------------------
                                Click 180, 481, 3               
                                Send, ^c
                                Clipwait
                                Gui1111111 = %clipboard%
                                clipboard := ""
                                                ;------------------
                                Click 238, 481, 3                 
                                send, ^c                                               
                                Clipwait
                                Gui111111 = %Clipboard%
                                clipboard := ""
                  ;------------------
            click 317, 481, 3       
            send, ^c
            Clipwait
            Gui11111 = %Clipboard%
            clipboard := ""
                  ;------------------
            click 423, 481, 3            
            send, ^c
            Clipwait
            Gui111111 = %Clipboard%
            clipboard := ""
                  ;------------------
            click 518, 481, 3              
            send, ^c
            Clipwait
            Gui111111 = %Clipboard%
            clipboard := ""
                  ;------------------
            click 617, 481, 3          
            send, ^c
            Clipwait
            Gui111111 = %Clipboard%
            clipboard := ""
                  ;------------------
                                Click 703, 481, 3               
                                Send, ^c
                                Clipwait
                                Gui111111 = %clipboard%
                                clipboard := ""
                       ;------------------


            BlockInput, off

                 ;------------------
                                Click 600, 529, 3
                                Send, ^c                                                                              Clipwait
                                Gui11111 = %Clipboard%
                                clipboard := ""
                                                ;------------------                                                 
                                Click 601, 555, 3
                                Send, ^c                                                                               Clipwait
                                Gui11111= %Clipboard%
                                clipboard := ""
                                                ;------------------

                 }                             
               
                else
              {



The X and Y's, are one of the variables that change fomr PC to Pc. Well not 'variable', one of the 'things' that can change.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 12th, 2009, 10:01 pm 
Offline

Joined: December 24th, 2008, 3:25 am
Posts: 1401
Location: :noitacoL
So I have been looking into, and playing around with, the ini files. I read that INI files cannot be 'nested', and ini is for information and not if/else statments.

This is a variation of my original request about log ins, which I am confident will work out well.

Code:
Example code currently in my GUI:
;this is currently a gosub.  My GUI pulls data from the site, when the GUI gets to the opID, it checks it agenst the lists we have.  Certain text/actions get done per OpID match.

CheckOpID:

 gui, submit, nohide
 winactivate, GUIv02.5.ahk
 
if(GuiOpID = "59S" or GuiOpID = "3S5" or GuiOpID = "12S" or GuiOpID = "17S" or GuiOpID = "23S" or GuiOpID = "2S6"
or GuiOpID = "3S6" or GuiOpID = "3S2" or GuiOpID = "88S" or GuiOpID = "95S" or GuiOpID = "K40" or GuiOpID = "IRK"
or GuiOpID = "ITN" or GuiOpID = "ITO" or GuiOpID = "J9Y" or GuiOpID = "ITU" or GuiOpID = "3XJ" or GuiOpID = "3XL"
or GuiOpID = "HVS" or GuiOpID = "HVK" or GuiOpID = "HVM" or GuiOpID = "HVQ" or GuiOpID = "HVP" or GuiOpID = "19A"
or GuiOpID = "19B" or GuiOpID = "19C" or GuiOpID = "19D" or GuiOpID = "19E" or GuiOpID = "RYP" or GuiOpID = "RYU"
or GuiOpID = "RYT" or GuiOpID = "LSA" or GuiOpID = "JHS" or GuiOpID = "FME" or GuiOpID = "CES" or GUiOpID = "V70"
or GuiOpID = "81S" or GuiOpID = "62S")
{   
     BlockInput, on   ;
     Do stuff bc this is true
}
else, go down to list2 in gui script
else, go down to list3 in gui script
else continue as normal



I have 5 or 6 different sets of ID's, close to 1000 in total, some get added/deleted as employment status changes.


Can I put the If{do stuff} else/{other stuff} into the INI file?

Or would I only be able to put the GuiOpID list into the INI?

Is an INI even my best choice for a situation like this?


If I put JUST the ID's into an INI file, would 'each group' need its own INI file?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 13th, 2009, 8:16 pm 
Offline

Joined: April 17th, 2007, 1:37 pm
Posts: 761
Location: Florida
I'm not 100% sure I'm following you, but I think this will do what you want... Let me know if you have any questions and I will try to help...

settings.ini:
Code:
[groups]
group1 = 59S,3S5,12S,17S,23S,2S6,3S6,3S2,88S,95S,K40,IRK,ITN,ITO,J9Y,ITU,3XJ,3XL,HVS,HVK,HVM,HVQ,HVP,19A,19B,19C,19D,19E,RYP,RYU,RYT,LSA,JHS,FME,CES,V70,81S,62S
group2 =
group3 =


Sample code:
Code:
GuiOpGroup:=

IniRead, grouplist1, settings.ini, groups, group1
IniRead, grouplist2, settings.ini, groups, group2
IniRead, grouplist3, settings.ini, groups, group3

If GuiOpID in %grouplist1%
{
  GuiOpGroup = 1
}
Else If GuiOpID in %grouplist2%
{
  GuiOpGroup = 2
}
Else If GuiOpID in %grouplist3%
{
  GuiOpGroup = 3
}
Else
{
  GuiOpGroup = ERROR
}

Gosub,action%GuiOpGroup%
return

action1:
msgbox I took this action because you are in group %guiopgroup%
return

action2:
msgbox I took this action because you are in group %guiopgroup%
return

action3:
msgbox I took this action because you are in group %guiopgroup%
return

actionERROR:
msgbox I took this action because you don't exist!
return


Here's another example of an INI that controls some settings for a vacation bid/approval app I made. There is another CSV file that stores userID, group, hire date, and name. The app first reads that CSV to determine their group, and then checks the INI to see what that group can do.

Code:
[Settings]
Cal_Start=20090101
Cal_End=20091231

[Locked]
;Cannot Add/Edit Requests (Use this once you've completed and noted your approvals)
BMT=1
QT=1
B=1
BO=1
C=1
M1=1
M2=1
MC=1
BOSS=1
Admin=0

[Denied]
;Cannot Access Bid App *At All* (Use this once bidding is closed and you are working on approvals)
BMT=1
QT=1
B=0
BO=0
C=0
M1=0
M2=0
MC=0
BOSS=0
Admin=0

_________________
[Join IRC!]
Image


Last edited by Rhys on May 13th, 2009, 8:31 pm, edited 1 time in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 13th, 2009, 8:28 pm 
Offline

Joined: March 19th, 2009, 5:08 pm
Posts: 548
Location: Texas, USA
I have the same issue, I use Dropbox (www.getdropbox.com) and place the AHK in the public folder.

Then, locally, I have a script that autoruns on startup, downloads the AHK file, and then runs it. Note that this is really easy because Dropbox will give me a static address where I can access any file in the public folder--just right-click the file in the dropbox.

This is the simplest solution that I have found, and you could even set a timer so that it not only checks for updates on startup, but also checks routinely by setting up a time interval.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 13th, 2009, 9:22 pm 
Offline

Joined: December 24th, 2008, 3:25 am
Posts: 1401
Location: :noitacoL
Code:
[Rhys"]I'm not 100% sure I'm following you, but I think this will do what you want... Let me know if you have any questions and I will try to help...

settings.ini:[groups]
group1 = 59S,3S5,12S,17S,23S,2S6,3S6,3S2,88S,95S,K40,IRK,ITN,ITO,J9Y,ITU,3XJ,3XL,HVS,HVK,HVM,HVQ,HVP,19A,19B,19C,19D,19E,RYP,RYU,RYT,LSA,JHS,FME,CES,V70,81S,62S
group2 =
group3 =

Sample code:
GuiOpGroup:=

IniRead, grouplist1, settings.ini, groups, group1
IniRead, grouplist2, settings.ini, groups, group2
IniRead, grouplist3, settings.ini, groups, group3

If GuiOpID in %grouplist1%
{
  GuiOpGroup = 1
}
Else If GuiOpID in %grouplist2%
{
  GuiOpGroup = 2
}
Else If GuiOpID in %grouplist3%
{
  GuiOpGroup = 3
}
Else
{
  GuiOpGroup = ERROR
}

Gosub,action%GuiOpGroup%
return

action1:
msgbox I took this action because you are in group %guiopgroup%
return

action2:
msgbox I took this action because you are in group %guiopgroup%
return

action3:
msgbox I took this action because you are in group %guiopgroup%
return

actionERROR:
msgbox I took this action because you don't exist!
return

Here's another example of an INI that controls some settings for a vacation bid/approval app I made.  There is another CSV file that stores userID, group, hire date, and name.  The app first reads that CSV to determine their group, and then checks the INI to see what that group can do.

[Settings]
Cal_Start=20090101
Cal_End=20091231

[Locked]
;Cannot Add/Edit Requests (Use this once you've completed and noted your approvals)
BMT=1
QT=1
B=1
BO=1
C=1
M1=1
M2=1
MC=1
BOSS=1
Admin=0

[Denied]
;Cannot Access Bid App *At All* (Use this once bidding is closed and you are working on approvals)
BMT=1
QT=1
B=0
BO=0
C=0
M1=0
M2=0
MC=0
BOSS=0
Admin=0


It's funny, i had/have 2 different problems, and they are sort of merging into one possible solution.

I a little logged with work at the moment, but when I get some free time I will play around with your ini advice.

I really do appreciate all the help/feedback everyone has given.

Now if anyone can add more time to the day.... :evil:


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 13th, 2009, 10:43 pm 
Quote:
and really just want some advice and feedback from someone who has been through something similar.
Welcome to the club. 8)

Quote:
and I am the only one ‘in charge’ of the scripting as I am the only one smart enough to be able to tie my own shoes.
If you save your company money, ask for a pay-rise (hey, you're an AHK-'one-man-show') and to point out a stand-in to ensure maintenance & support in your area. Once you've got it, tell it to someone. If people will get an reward they are more interested to join 'that kind of business'.

Try to identify a(n intelligent) lazy bone. Those like to work smart instead of hard. One hour coding (incl testing) to bypass an anoying 8hrs task. Deal! 8)

OK. I need the 'full story' of what those people have to accomplish. And btw, that webpage-copy-paste thing isn't reliable and therefore can't be accepted.

HttpQuery() AND/OR JavaScript injection/Bookmarklets OR COM (preferable) + RegExMatch() are the things you should check out.

To drop an INI file at a network share sounds ok - if you use it only once you start the script. I've hosted one in the UK, but have to access it from several countries across Europe. Hm, the performance could be better, trust me.

If you can build a more stable, less user-intervention-endangered processing you might be able to get rid of an INI file at all. Lets get fingers crossed.

OK, what about to tell us the story now ?! 8)


Report this post
Top
  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 15 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: 0x150||ISO, Azevedo, over21, perlsmith, Yahoo [Bot] and 68 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