»Xog Posted December 11, 2009 Report Posted December 11, 2009 (edited) I work in the Records department here at Bingham Mccutchen LLP and all of our records are encoded with a barcode, and we use a scanner connected to the computer to look up / check in/out documents to clients. We recently absorbed another company and what I'm in charge of is recreating everything from their records department into our database. The files were all converted over from their old database (FileSurf) in to ours (AccutracXE) however all of their files are classified as "Folders" when they should be "Wallets" so my job is to recreate everything as a Wallet (has to be done manually because some files are Boxes/whatever else and need to stay that way). I literally have tens of thousands of files to go through right now, and using the scanner I can look up the barcode. However, the barcodes they used in this firm prior to the absorption is different from ours. When a FileSurf label is scanned it will come out as "f111208" however the accutrac barcodes need to be in a different format such as "1002590739". The problem this causes is when I do a search for the file by scanning the barcode, the file cannot be found but I found a trick. if I delete the "f" and put four zeros in front of the number, that's the barcode it was converted to in Accutrac. Example: FileSurf barcode: f111208. A search for this barcode won't give me any results. but if I do this:barcode: 0000111208 it will find the file. One tiny tiny problem with making a script is that sometimes I need to put five zeros in front of the numbers because it has one less digit in it. 4 zeros Example: f111208 converts to 00001112085 zeros Example: f86832 converts to 0000086832 The reason is because each Accutrac barcode needs to have exactly ten digits. When I scan over the barcode, all it simply does is enter in the digits and then press enter. When I'm doing mass scanning I usually open up notepad. This is what it comes out to (without me even touching the keyboard) f109030 f109014 f109012 f109042 f111974 f111881 f103142 f123059 f86832 f113410 f113411 f109025 f109015 f113408 f109024 f111966 f113409 f109183 f111208 So now that I've explained the situation, now I can ask the question. Can someone make a script so that when I scan a barcode, it replaces the f with four zeros if there are 6 digits after the f, and five zeros if there are 5 digits after the f? This would make everything go about 500% faster. I was given a timeframe of 1.5 years to do this whole file room. If someone can make this script I can do it in 2 months. Thanks Note: Very rarely, some files use a "t" instead of an "f" so please have the 0s replace an "f" or "t" in the barcode. Edited December 11, 2009 by Xog Quote
Testtube Posted December 11, 2009 Report Posted December 11, 2009 That would be pretty easy to do with a linux script Quote
»Xog Posted December 11, 2009 Author Report Posted December 11, 2009 (edited) is it possible to run a linux script in XP? The firm uses XP edit: may not have been clear on that; is there a windows version of the bash shell that can execute its commands via a program? Edited December 11, 2009 by Xog Quote
Dr Brain Posted December 11, 2009 Report Posted December 11, 2009 Here's a very dumb python script: #!/usr/bin/python import sys for line in sys.stdin: line = line.strip() # remove the leading f if line[0] == 'f': line = line[1:] while len(line) < 10: line = '0' + line; print(line) Save it as barcode.py. Run it with 'python barcode.py'. Type in your f barcodes, one line at a time. Press Ctrl+D. That's how I did it on linux. Windows may need minor tweaks (might be a different key than Ctrl+D to end input). Quote
»Xog Posted December 11, 2009 Author Report Posted December 11, 2009 (edited) Here's a very dumb python script: #!/usr/bin/python import sys for line in sys.stdin: line = line.strip() # remove the leading f if line[0] == 'f': line = line[1:] while len(line) < 10: line = '0' + line; print(line) Save it as barcode.py. Run it with 'python barcode.py'. Type in your f barcodes, one line at a time. Press Ctrl+D. That's how I did it on linux. Windows may need minor tweaks (might be a different key than Ctrl+D to end input). Scanned an item into the prompt, came out corrected by your script, then did Ctrl+D but got the ^D.. Also, I need this to run in the background and run in real time so that wherever I scan it makes the correction. I had to click on the python window and scan a barcode for it to work. And, if this helps: http://win-bash.sourceforge.net/ PS: I'm very thankful you're helping me Dr. Brain. You may not remember me but I'm a close friend of picano He hired me as an smod in hyperspace before it was ASSS lol Edited December 11, 2009 by Xog Quote
Dr Brain Posted December 11, 2009 Report Posted December 11, 2009 If you don't need the ctrl+d to have it output the correction, then great. I had to use it to get any output at all. I don't know what you mean about running in the background. You dump a text file into the program, and it spits out a corrected version. Quote
»Xog Posted December 11, 2009 Author Report Posted December 11, 2009 (edited) If you don't need the ctrl+d to have it output the correction, then great. I had to use it to get any output at all. I don't know what you mean about running in the background. You dump a text file into the program, and it spits out a corrected version. what do u mean dump a text file into the program? All I did was open up the barcode.py and then scan a file and it corrected it automatically (Perhaps because it presses Enter after it's done entering the numbers) And what I mean by having the program run in the background is.. when I have accutrac open, and I want to search for a file, I click on the Search Field, and then scan the barcode on the label. I want it to correct it right then and there in real time without hopping through another program first. I was originaly scanning into a notepad file because it was easier to edit that way when I did mass file scans. Edited December 11, 2009 by Xog Quote
»jabjabjab Posted December 11, 2009 Report Posted December 11, 2009 I still talk to picano every day ^_^ Quote
»Blocks Posted December 11, 2009 Report Posted December 11, 2009 (edited) I gather that Xog needs to intercept "keyboard input" that the barcode scanner creates and modify it before it spits it out to the active window. This would probably be hard to do in Python (?). A better strategy might be to scan the barcode to Python, do the modification, switch windows, paste the new code in, and switch back to the running Python script, all automatically. That still might be difficult. You could do the switching and pasting yourself pretty easily, but that would be kind of gimp. Are you certain you won't run into trouble with conflicting code numbers with this modification scheme? Seems to me like it could be a problem.Never mind, I read your post more clearly. I think you should remove a lot of your specific information in the first post as well as that screenshot. If I was your employer, I might not be too happy about the specificity of information you've released. Edited December 11, 2009 by Blocks Quote
»Xog Posted December 11, 2009 Author Report Posted December 11, 2009 (edited) I gather that Xog needs to intercept "keyboard input" that the barcode scanner creates and modify it before it spits it out to the active window. This would probably be hard to do in Python (?). A better strategy might be to scan the barcode to Python, do the modification, switch windows, paste the new code in, and switch back to the running Python script, all automatically. That still might be difficult. You could do the switching and pasting yourself pretty easily, but that would be kind of gimp. Are you certain you won't run into trouble with conflicting code numbers with this modification scheme? Seems to me like it could be a problem.Never mind, I read your post more clearly. I think you should remove a lot of your specific information in the first post as well as that screenshot. If I was your employer, I might not be too happy about the specificity of information you've released. All the information I provided was non confidential and the files that were displayed were not contained under an ethical wall and are available to anyone upon request. I'll take down the picture anyway since Dr.B already saw it A better strategy might be to scan the barcode to Python, do the modification, switch windows, paste the new code in, and switch back to the running Python script, all automatically. If someone can make the script, there is no need to do multiple scans at a time like that. After the scan, it will search for the barcode attached to the file in the database. After it does that, I'd wind up spending a few minutes re-creating a copy of that file with the correct classification (because we can't edit the classification of a file after it's created) and then delete the older one. It's just a pain in the arse to do this without the script. Here's what I do without notepad:1. Open up the matter the file is located under2. Click the "All Fields" search field3. Scan the barcode [then it presses enter automatically, and takes about 30 seconds to finish, telling me the file couldn't be found]4. Edit the barcode manually, replacing the f with four or five zeros.5. Search again. All of that would be completely unnecessary. All I would have to do if I had the script is 1,2,3. Thanks Edited December 11, 2009 by Xog Quote
»Blocks Posted December 11, 2009 Report Posted December 11, 2009 What is the final destination for each barcode you've scanned? If it's a big list in a text file, the problem is a lot easier as you can just save the file and parse through the whole thing later. If you want to do the conversion "on-the-fly," like to input to some text field in some program, the problem is harder. Quote
»Xog Posted December 11, 2009 Author Report Posted December 11, 2009 What is the final destination for each barcode you've scanned? If it's a big list in a text file, the problem is a lot easier as you can just save the file and parse through the whole thing later. If you want to do the conversion "on-the-fly," like to input to some text field in some program, the problem is harder. Yes what I'd like to do is the on-the-fly conversion. The whole records department will be using the script if someone can make it, and they're not all too computer savvy, so it would be better this way. Quote
Dr Brain Posted December 11, 2009 Report Posted December 11, 2009 Something that runs in the background is, almost by definition, not a script. Making a program to intercept keystrokes is beyond my 5 minute helping mark. It's beyond my capability to do in 5 hours, even. Quote
»Blocks Posted December 12, 2009 Report Posted December 12, 2009 Okay, I created an AutoHotkey script for you, quoted and attached below. It's a pretty cool program and I'm glad I discovered it. ; Xog's Script by Blocks #InstallKeybdHook ; Run the macro on either an "f" or "t" from the barcode scanner. f:: t:: ; Capture the input, terminated by a newline or Enter. Input Barcode, ,`n{Enter} ; Prepend the leading zeroes. while StrLen(Barcode) < 10 { Barcode := % "0" . Barcode } ; Type out the new barcode followed by an Enter. SendInput %Barcode%{Enter} When it's running, all you can do is scan barcodes, unless you avoid use of the "f" and "t" keys. If you want, you can modify it so it's only activated by some other keypress. Run it by downloading AutoHotkey and loading the AHK file in the ZIP archive attached. Or you can use the executable also in the ZIP file if you trust me.Xog\'s Script.zip Quote
»Xog Posted December 12, 2009 Author Report Posted December 12, 2009 Okay, I created an AutoHotkey script for you, quoted and attached below. It's a pretty cool program and I'm glad I discovered it. ; Xog's Script by Blocks #InstallKeybdHook ; Run the macro on either an "f" or "t" from the barcode scanner. f:: t:: ; Capture the input, terminated by a newline or Enter. Input Barcode, ,`n{Enter} ; Prepend the leading zeroes. while StrLen(Barcode) < 10 { Barcode := % "0" . Barcode } ; Type out the new barcode followed by an Enter. SendInput %Barcode%{Enter} When it's running, all you can do is scan barcodes, unless you avoid use of the "f" and "t" keys. If you want, you can modify it so it's only activated by some other keypress. Run it by downloading AutoHotkey and loading the AHK file in the ZIP archive attached. Or you can use the executable also in the ZIP file if you trust me. Thanks, I've had some experience with autohotkey (actually got banned from EG because of it, they thought i was a bot lool) I'll have to try this out at work on Monday. Quote
»Blocks Posted December 12, 2009 Report Posted December 12, 2009 Okay, I created an AutoHotkey script for you, quoted and attached below. It's a pretty cool program and I'm glad I discovered it. ; Xog's Script by Blocks #InstallKeybdHook ; Run the macro on either an "f" or "t" from the barcode scanner. f:: t:: ; Capture the input, terminated by a newline or Enter. Input Barcode, ,`n{Enter} ; Prepend the leading zeroes. while StrLen(Barcode) < 10 { Barcode := % "0" . Barcode } ; Type out the new barcode followed by an Enter. SendInput %Barcode%{Enter} When it's running, all you can do is scan barcodes, unless you avoid use of the "f" and "t" keys. If you want, you can modify it so it's only activated by some other keypress. Run it by downloading AutoHotkey and loading the AHK file in the ZIP archive attached. Or you can use the executable also in the ZIP file if you trust me.It's occurred to me now that this script might not actually work. I tested it by manually keying in barcode strings like f-1-1-1-1-1-1-enter. If the barcode scanner sequentially streams in characters, then it will probably work. If it just dumps the whole barcode sequence like a paste operation, then it won't work. One could create a smarter script to properly handle that input though. Quote
»Xog Posted December 14, 2009 Author Report Posted December 14, 2009 (edited) Okay, I created an AutoHotkey script for you, quoted and attached below. It's a pretty cool program and I'm glad I discovered it. ; Xog's Script by Blocks #InstallKeybdHook ; Run the macro on either an "f" or "t" from the barcode scanner. f:: t:: ; Capture the input, terminated by a newline or Enter. Input Barcode, ,`n{Enter} ; Prepend the leading zeroes. while StrLen(Barcode) < 10 { Barcode := % "0" . Barcode } ; Type out the new barcode followed by an Enter. SendInput %Barcode%{Enter} When it's running, all you can do is scan barcodes, unless you avoid use of the "f" and "t" keys. If you want, you can modify it so it's only activated by some other keypress. Run it by downloading AutoHotkey and loading the AHK file in the ZIP archive attached. Or you can use the executable also in the ZIP file if you trust me.It's occurred to me now that this script might not actually work. I tested it by manually keying in barcode strings like f-1-1-1-1-1-1-enter. If the barcode scanner sequentially streams in characters, then it will probably work. If it just dumps the whole barcode sequence like a paste operation, then it won't work. One could create a smarter script to properly handle that input though. it works! I can pause the script with F9 to type out file descriptions or whatever. THANK YOU from me and the rest of Records !! I added F9::Suspend Edited December 14, 2009 by Xog Quote
Samapico Posted December 14, 2009 Report Posted December 14, 2009 Autohotkey is surprisingly flexible to do a lot of stuff I even use it to be able to use the left windows key on my keyboard as a macro key in continuum Quote
»Xog Posted December 14, 2009 Author Report Posted December 14, 2009 (edited) Autohotkey is surprisingly flexible to do a lot of stuff I even use it to be able to use the left windows key on my keyboard as a macro key in continuum haha. i made a little looping AHK script that made my ship fly around and shoot bullets/bombs at random, then warp back to the center, rinse and repeat.. it did get me banned for having it run over night though :\ Edited December 14, 2009 by Xog Quote
»Blocks Posted December 14, 2009 Report Posted December 14, 2009 Okay, I created an AutoHotkey script for you, quoted and attached below. It's a pretty cool program and I'm glad I discovered it. ; Xog's Script by Blocks #InstallKeybdHook ; Run the macro on either an "f" or "t" from the barcode scanner. f:: t:: ; Capture the input, terminated by a newline or Enter. Input Barcode, ,`n{Enter} ; Prepend the leading zeroes. while StrLen(Barcode) < 10 { Barcode := % "0" . Barcode } ; Type out the new barcode followed by an Enter. SendInput %Barcode%{Enter} When it's running, all you can do is scan barcodes, unless you avoid use of the "f" and "t" keys. If you want, you can modify it so it's only activated by some other keypress. Run it by downloading AutoHotkey and loading the AHK file in the ZIP archive attached. Or you can use the executable also in the ZIP file if you trust me.It's occurred to me now that this script might not actually work. I tested it by manually keying in barcode strings like f-1-1-1-1-1-1-enter. If the barcode scanner sequentially streams in characters, then it will probably work. If it just dumps the whole barcode sequence like a paste operation, then it won't work. One could create a smarter script to properly handle that input though. it works! I can pause the script with F9 to type out file descriptions or whatever. THANK YOU from me and the rest of Records !! I added F9::SuspendCool. That'll be $10 per computer. Quote
whalz Posted December 14, 2009 Report Posted December 14, 2009 for each f123456 delete the first letter, count remaining , 10-remaining = X.. add X amount of 0's.. next (REPEAT X 100000 Depending on how many u got left o_O of course its alot more complicated than i made it out to be! but thats ur algoritym in its total jds symplicity Quote
»Xog Posted December 14, 2009 Author Report Posted December 14, 2009 (edited) My co-worker got really confused by this simple little program. Apparently she denies not reading the **READ ME** in the email I sent with the file.. but she wound up scanning an item (then it suspends) then she pressed F9 to unsuspend, and started typing.. needless to say she pressed an "f" or "t" and the macro took action.. making her keyboard useless until she pressed enter. she didn't know this and thought the computer froze. so she cold booted and proceeded to bark on me and argue that the program isn't working right... all she had to do was press enter to fix her problem.... edit: here's the readme After you scan a barcode, the script will go into SUSPEND mode, which basically means that it won't work. This feature was added to prevent the script from interrupting your typing when you're not scanning. F9 toggles suspend on/off. The icon on your task bar will either be a green icon with an "H" or an "S".If the icon is an H, it means the script is NOT suspended and you should be able to scan a barcode.If the icon is an S, it means the script is suspended and you should be able to type without any problems. If you try typing while the icon is an "H" then it will seem like your computer is frozen - It's not. Just press Enter, which will then enter a few 0s and then suspend the script, turning it into an S. Then you may continue typing. Edited December 14, 2009 by Xog Quote
»Blocks Posted December 14, 2009 Report Posted December 14, 2009 so she cold booted and proceeded to bark on me and argue that the program isn't working right...Should tell her not to use it then. Quote
»Xog Posted December 14, 2009 Author Report Posted December 14, 2009 (edited) anyone know if this would be viable? i know absolutely nothing about databases / servers and running scripts on them.. incorrect code by try to understand and not laugh at my pathetic code generalizations:(Assuming the database is taken down for a night)Stage 1:----Scan all database entries...if Item Type=Folders, Classification=UNCLASSIFIED, Barcode=0000* then copy Barcode number, paste to AllMcKeeFiles.txt, press Enter----Stage 2:----Read AllMcKeeFiles.txtCopy line 1Paste in search field, press EnterEdit Item Type to WalletsEnter, EnterCopy line 2, all the way to the end of the file---- would that be really difficult? I mean.. honestly.. I've gotten pretty buddy buddy with the firmwide records manager that's in charge of all this stuff. If it's possible to make a script that would do this, our job would be done literally overnight... I'm not asking you guys to make the script as you'd probably have to get field IDs or something and that's something you can't do without the program itself.. however the firmwide manager knows quite a bit about computers and can probably throw a script like this together without much of an issue.. i've got no idea what kind of program this would run from, how it would run it, or anything o_O.. Edited December 14, 2009 by Xog Quote
»Blocks Posted December 14, 2009 Report Posted December 14, 2009 anyone know if this would be viable?I'm going to go out on a limb here and say yes. However, it would be probably be more difficult (but still worth the effort) to read the database directly from the script. It would also be much more dangerous. I suggest you use an AutoHotkey script to let the database-reading-program do all the database reading and writing. AHK seems to be extremely versatile, and with a little ingenuity, a script could do what you've described. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.