AutoHotkey Community

It is currently May 27th, 2012, 1:01 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 7 posts ] 
Author Message
 Post subject: Lookup table question
PostPosted: November 21st, 2011, 2:12 am 
Offline

Joined: November 27th, 2006, 3:06 pm
Posts: 69
I'm curious how you pros would handle this "want" of mine:

I very routinely have to collect log files from a specific directory on several remote computers. Basically if a certain program fails, I need to go to that computer and grab some specific log files.

The computer names are fairly cryptic, so most users as well as myself only know the computer by the workstation number: 5601, 5644, etc.

I want to make a script where I can just enter the 4 digit common name, then the script would use the UNC path to the actual spot where the logs are, such as \\ncdsp-10202\c$\programdata\anotherlevel\logs\

Right now I'm handling it with substitutions like ::5601::\\ncdsp-10103\etc and manually opening windows explorer, clicking in the address bar and using the sub, but I'd prefer to make a little gui or something for it where I could enter the 4 digit code and the script would use some kind of table or something to get the right variable to go open in explorer.exe.

The alternative would be to have a different function for each and every workstation which doesn't seem as efficient as a simple table I could add to as we expand.

How would you do it?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 21st, 2011, 2:18 am 
Offline

Joined: December 26th, 2010, 7:40 pm
Posts: 4172
Location: Awesometown, USA
I'd do it with AutoHotkey_L and Arrays...
Code:
List := {5601: "\\ncdsp-10103\c$\programdata\anotherlevel\logs\"
        ,5644: "\\ncdsp-10202\c$\programdata\anotherlevel\logs\"
        ,1234: "some other path"}
InputBox, num
MsgBox % List[num]

_________________
Autofire, AutoClick, Toggle, SpamWindow Control Tools
Recommended: AutoHotkey_L


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 21st, 2011, 2:28 am 
Offline

Joined: November 27th, 2006, 3:06 pm
Posts: 69
I appreciate the quick reply, but it seems when I installed ahk_L it broke my other scripts and I'm not savvy enough to fix them :(

I'll have to figure out a way to do it semi efficiently with normal AHK unfortunately.

Thanks though!


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 21st, 2011, 2:36 am 
Offline

Joined: December 26th, 2010, 7:40 pm
Posts: 4172
Location: Awesometown, USA
AHK Basic? Hmm...
Code:
List =
(LTrim
   5601 \\ncdsp-10103\c$\programdata\anotherlevel\logs\
   5644 \\ncdsp-10202\c$\programdata\anotherlevel\logs\
   1234 some\other\path
)
Loop Parse, List, `n
   n := SubStr(A_LoopField, 1, 4), s := SubStr(A_LoopField, 6)
  ,List%n% := s

InputBox, num
MsgBox % List%num%

_________________
Autofire, AutoClick, Toggle, SpamWindow Control Tools
Recommended: AutoHotkey_L


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 21st, 2011, 3:05 am 
Offline

Joined: November 27th, 2006, 3:06 pm
Posts: 69
Hrm, this seems to work well but I'm getting an error when I adjust it to try to open windows explorer to the folder I want.

I changed the msgbox line to run, explorer.exe % List%num% and it says: The following variable name contains an illegal character: " List".

I'm sure I'm just abusing what the run command is looking for compared to the msgbox command though. Need to find how I can use the List variable in other commands :)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 21st, 2011, 3:24 am 
Offline

Joined: December 26th, 2010, 7:40 pm
Posts: 4172
Location: Awesometown, USA
I was forcing an Expression
Code:
run, % "explorer.exe " . List%num%

_________________
Autofire, AutoClick, Toggle, SpamWindow Control Tools
Recommended: AutoHotkey_L


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 21st, 2011, 4:42 am 
Offline

Joined: November 27th, 2006, 3:06 pm
Posts: 69
Thanks a lot Nimda, this is working great. Now I'm tweaking it trying to make it a GUI with options to download the log and place it right on the local desktop.


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

All times are UTC [ DST ]


Who is online

Users browsing this forum: Amandaville, Bing [Bot], BrandonHotkey, chaosad and 16 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