AutoHotkey Community

It is currently May 27th, 2012, 8:22 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 40 posts ]  Go to page Previous  1, 2, 3
Author Message
 Post subject:
PostPosted: January 7th, 2010, 5:19 pm 
Offline

Joined: May 12th, 2009, 2:37 pm
Posts: 640
Location: Gloucester UK
We're still running the physical copies along side testing the new digital system,or at least will be for while. The security is a minor concern as the data that is collected is public domain information anyway so there would be no need to hack into the system. The main concern of my superiours is that digital information can be lost in a system crash. I've built redundancy into the system so that the data is stored simultaniously in several locations at the moment all the original paper records are stored in one location which a fire couldjust as easily wipe out.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 12th, 2010, 6:24 pm 
I'm a pharmacist as well & I use AHK every day at my pharmacy (shout out to Tomo_Uehara). No real computer programming training to speak of. My 1st big project was to create GUI interface via AHK that I use to record telephone Rx's phoned to my pharmacy from MD offices--way better than trying to write them out by hand!!
(Thanks Autohotkey).


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: January 12th, 2010, 6:48 pm 
Offline
User avatar

Joined: September 5th, 2009, 2:06 pm
Posts: 1713
Location: Somewhere near you
tidbit wrote:
is Tx you tomoe? or a buddy?

Well.. That's just another user who uses ahk in the real life =)

And that's good to hear another pharmacist who also use ahk too.. Image

_________________
Image
The quick onyx goblin jumps over the lazy dwarf


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 20th, 2010, 2:59 am 
Offline

Joined: October 15th, 2007, 3:10 pm
Posts: 790
Location: England
tank wrote:
i pull data from several telnet sessions a web site and an odbc connection into a common web interface


@tank: if you don't mind me asking, what method do use for telnet with AKH? I have tried the send/expect from DerRaphael, and I can't seem to get it to work*... "Well post in that thread then" you might think, but I just wanted to check whether you were using that kind of thing, or whether you were using another program or some other cool trick to pull stuff out of a box via telnet... and have you had any luck (or had the need to use) SSH to perform the same thing? Our boxes are being slowly hardened one-by-one, so it would be nice to know whether someone else has gotten a similar thing working via SSH before I attempt it.

I noticed you said you also used ODBC - again, I think I would probably be able to do this via PHP and then get the info back into AHK, or maybe use a separate exe to do the actual querying, or a number of other (much more messy and unreliable) ways, but I was wondering about this also, do you use something similar to the ADO COM thread to do this directly in AHK? Not sure if you use oracle databases or something less commercial or not, so it maybe depends on the database being used?

I'm not asking you to give away all your tricks, or write me a load of code, I just wondered about the methods so I can try to learn, and at least I will be spending my time and effort in a potentially fruitful way :)



Anyway, back on topic - I use AHK whenever I can at work, I have made a touch-screen based app to control a web page with automatic printer installation for some web terminal users, log file cleaning/parsing and sql-generating scripts, a script that creates custom Code-128 and EAN-13 barcodes using postscript, another that pulls data out of XML files, another that reads data from a bluetooth COM port for a barcode scanner and captures barcodes, an app that checks a wireless connection and the state of a scanner and reconnects automatically when the connection fails, and at the moment I am working on a monitoring application to monitor states of servers and databaes, count orders, etc (hence my questions above!), and loads of other small apps.

Nothing as fancy as tank, and not as special as most of the stuff that gets posted on here by the real pros, but they work really well. Most of it has been helped by the great community and example scripts that people post on this forum! I love how you can check the forum most weeks and it seems there is something new someone has found a way to do in AHK :)


*by the way, I can get the actual connection to work (no winsock errors), and I get the initial "ÿû" characters (sometimes only 2, sometimes a load of them), but I can't seem to get the initial 'prompt' (expect) to work, and when I try to send a string back as per the examples, nothing happens... I will probably enquire a bit more on that thread. It also seems that I must do something else special to get that to work with SSH...


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 20th, 2010, 4:50 am 
Offline
User avatar

Joined: December 21st, 2007, 3:14 pm
Posts: 3826
Location: Louisville KY USA
the telnet sessions are don thru shell windows that are com accessable so as far as true telnet i cant offer much help

I use javascript executed via COM_ScriptControl to interact with odbc you can find many examples

Code:
sCode=
(
   var strConnection = "Data Source=HYDRA;User Id=%A_UserName%;Password=%pass%;";
   var param1="%param1%";
   var param2="%param2%";
   var param3="%param3%";
   var ErrorLevel=false;
   var conn = new ActiveXObject("ADODB.Connection");
   var rs = new ActiveXObject("ADODB.Recordset");
   
   connect();
   result = exec_query(param1, param2, param3);
   close_conn();
   
   function connect(){
      try{
         conn.open(strConnection, "", "");
      }//end try
      catch(e){
         ErrorLevel="Couldn't connect error: " + e.description;
      }//end catch
   }//end function

   function close_conn(){
      try{
         conn.close();
      }//end try
      catch(e){
         //do nothing
      }//end catch
   }//end function

   function exec_query(param1, param2, param3){
      
      var query="sql statement"
      try{
      rs.open(query, conn);
      }
      catch(e){
         ErrorLevel="Couldn't Query error: " + e.description;
         // this js error would need to be handled
      }//end catch
      
      if(!rs.bof) {
         rs.MoveFirst();
         var results="";
         while(!rs.eof) {            results+=rs.fields("feild_name").value;            rs.MoveNext();
         }
      rs.close();
      return   results;

   }//end function

   
   result=result+"";
)
   If   InStr(r:=COM_ScriptControl(sCode, "JScript", 1),"Couldn't connect error:")
   ;;some action in ahk
;~    r will be the result of the function
Obviously the above is more demonstration and isnt working code one could do this with com and ahk but havent had a need to convert it

setting up an oracle connection in odbc uses the following ahk
Code:
RegWrite,REG_SZ,HKLM,SOFTWARE\ODBC\ODBC.INI\hydra,Driver,C:\WINNT\system32\msorcl32.dll
RegWrite,REG_SZ,HKLM,SOFTWARE\ODBC\ODBC.INI\hydra,DSN,hydra
RegWrite,REG_SZ,HKLM,SOFTWARE\ODBC\ODBC.INI\hydra,Description,
RegWrite,REG_SZ,HKLM,SOFTWARE\ODBC\ODBC.INI\hydra,UID,username here
RegWrite,REG_SZ,HKLM,SOFTWARE\ODBC\ODBC.INI\hydra,PWD,
RegWrite,REG_SZ,HKLM,SOFTWARE\ODBC\ODBC.INI\hydra,SERVER,db.table
RegWrite,REG_SZ,HKLM,SOFTWARE\ODBC\ODBC.INI\hydra,BufferSize,65535
RegWrite,REG_SZ,HKLM,SOFTWARE\ODBC\ODBC.INI\hydra,SynonymColumns,1
RegWrite,REG_SZ,HKLM,SOFTWARE\ODBC\ODBC.INI\hydra,Remarks,0
RegWrite,REG_SZ,HKLM,SOFTWARE\ODBC\ODBC.INI\hydra,StdDayOfWeek,1
RegWrite,REG_SZ,HKLM,SOFTWARE\ODBC\ODBC.INI\hydra,GuessTheColDef,0
RegWrite,REG_SZ,HKLM,SOFTWARE\ODBC\ODBC.INI\hydra,StripTrailingZero,0
same disclamer better edit the red before using

Yes you can also do with php
Code:
<?
   
   @$odbccnx = odbc_connect("connectiondsn","usernames","password");
   $query = "sql";
   
   $result = odbc_exec($odbccnx,$query);
   
   //opend the file
   $the_file = "output.csv";
   $fh = fopen($the_file, 'w') or die("can't open file");
   
   while ($data[] = odbc_fetch_array($result));
   
   odbc_free_result($result);
   foreach($data as $value){
      if(!empty($value)){
         fwrite($fh, $value["feildname"]."\r\n");
      }//end if
   }//end foreach
   unset($data);
   
   fclose($fh); ?>

dont seel yourself short any one who uses ahk in an enterprise endeavor successfully small or big is pitting earning potential against failure. this isnt the work of idiots so if your suing it in your livelyhood you have earned your rights
:P

_________________
No matter what your oppinion Please join this discussion
Formal request to Polyethene
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 20th, 2010, 5:56 am 
Offline

Joined: October 15th, 2007, 3:10 pm
Posts: 790
Location: England
tank wrote:
the telnet sessions are don thru shell windows that are com accessable so as far as true telnet i cant offer much help

Ah OK, so you're scraping the actual console window, rather than using some win32 API call to do it? Well, I guess if it works reliably for you, I should look into doing it that way!

tank wrote:
I use javascript executed via COM_ScriptControl to interact with odbc you can find many examples

Code:
sCode=
(
   var strConnection = "Data Source=HYDRA;User Id=%A_UserName%;Password=%pass%;";
   var param1="%param1%";
   var param2="%param2%";
   var param3="%param3%";
   var ErrorLevel=false;
   var conn = new ActiveXObject("ADODB.Connection");
   var rs = new ActiveXObject("ADODB.Recordset");
   
   connect();
   result = exec_query(param1, param2, param3);
   close_conn();
   
   function connect(){
      try{
         conn.open(strConnection, "", "");
      }//end try
      catch(e){
         ErrorLevel="Couldn't connect error: " + e.description;
      }//end catch
   }//end function

   function close_conn(){
      try{
         conn.close();
      }//end try
      catch(e){
         //do nothing
      }//end catch
   }//end function

   function exec_query(param1, param2, param3){
      
      var query="sql statement"
      try{
      rs.open(query, conn);
      }
      catch(e){
         ErrorLevel="Couldn't Query error: " + e.description;
         // this js error would need to be handled
      }//end catch
      
      if(!rs.bof) {
         rs.MoveFirst();
         var results="";
         while(!rs.eof) {            results+=rs.fields("feild_name").value;            rs.MoveNext();
         }
      rs.close();
      return   results;

   }//end function

   
   result=result+"";
)
   If   InStr(r:=COM_ScriptControl(sCode, "JScript", 1),"Couldn't connect error:")
   ;;some action in ahk
;~    r will be the result of the function
Obviously the above is more demonstration and isnt working code one could do this with com and ahk but havent had a need to convert it


Ah I see, I have used the execScript side of COM_Invoke before, but didn't see the COM_ScriptControl - you can just execute JS in there without setting up a browser object or anything like that? Interesting... :)

tank wrote:
setting up an oracle connection in odbc uses the following ahk
Code:
RegWrite,REG_SZ,HKLM,SOFTWARE\ODBC\ODBC.INI\hydra,Driver,C:\WINNT\system32\msorcl32.dll
RegWrite,REG_SZ,HKLM,SOFTWARE\ODBC\ODBC.INI\hydra,DSN,hydra
RegWrite,REG_SZ,HKLM,SOFTWARE\ODBC\ODBC.INI\hydra,Description,
RegWrite,REG_SZ,HKLM,SOFTWARE\ODBC\ODBC.INI\hydra,UID,username here
RegWrite,REG_SZ,HKLM,SOFTWARE\ODBC\ODBC.INI\hydra,PWD,
RegWrite,REG_SZ,HKLM,SOFTWARE\ODBC\ODBC.INI\hydra,SERVER,db.table
RegWrite,REG_SZ,HKLM,SOFTWARE\ODBC\ODBC.INI\hydra,BufferSize,65535
RegWrite,REG_SZ,HKLM,SOFTWARE\ODBC\ODBC.INI\hydra,SynonymColumns,1
RegWrite,REG_SZ,HKLM,SOFTWARE\ODBC\ODBC.INI\hydra,Remarks,0
RegWrite,REG_SZ,HKLM,SOFTWARE\ODBC\ODBC.INI\hydra,StdDayOfWeek,1
RegWrite,REG_SZ,HKLM,SOFTWARE\ODBC\ODBC.INI\hydra,GuessTheColDef,0
RegWrite,REG_SZ,HKLM,SOFTWARE\ODBC\ODBC.INI\hydra,StripTrailingZero,0
same disclamer better edit the red before using
OK, thanks for that. I assume I could just use a system DSN that already exists on the machine instead? (oracle 10g forced drivers, unfortunately) - I will have to have a play with that. I realise the connection string will probably be completely different too :)

tank wrote:
Yes you can also do with php
Yeah I have made a few php scripts that query stuff so the users can run them and see whats going on for certain things, and I guess I could run those and get the data out of the browser using COM/iWeb, etc, but I would prefer to find a nice reliable way of doing it without relying on IE, directly via AHK/COM, so I'll give the JavaScript business above a shot, see what happens.
Quote:
dont seel yourself short any one who uses ahk in an enterprise endeavor successfully small or big is pitting earning potential against failure. this isnt the work of idiots so if your suing it in your livelyhood you have earned your rights
:P


Appreciate that :D I know how difficult it can be sometimes to get stuff working correctly and reliably in the first place, but once it is working, it's rock solid - that's another thing I love about AHK! Some (non-programmer) colleagues of mine keep insisting that AHK is going to take over the business because I keep automating repetitive boring tasks, or if someone says 'we need this', I can say 'I'll just write a quick script to do that', (I'm sure you get the same kinda thing) but then I get addicted to adding new features and just can't put it down until the next little project is complete!

Thanks again for the tips, I'll have to see how I get on :D


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 22nd, 2010, 4:31 am 
har19 wrote:
Too bad there aren't any good advanced tutorials like cool Win API examples and Com.

As far as WIN API, there are examples in the forum. However, AHK is designed for windows scripting - hence many of the built-in commands already use the WIN API.

As far as COM, how about this or that?


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: January 24th, 2012, 3:36 am 
I am a new Autohotkey user with no scripting experience, but i was able to learn it quick and automate a 13 page test procedure written originally in Python. Thank you all for your cooperation. Let us keep helping one another.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: January 24th, 2012, 3:38 am 
Offline

Joined: August 24th, 2011, 6:32 pm
Posts: 39
I am a new Autohotkey user with no scripting experience, but i was able to learn it quick and automate a 13 page test procedure written originally in Python. Thank you all for your cooperation. Let us keep helping one another.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 31st, 2012, 7:16 pm 
Offline

Joined: January 31st, 2012, 5:43 pm
Posts: 1
It's very useful for gaming. like haxing without need a hax program :lol:


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

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 7 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