Joined: January 24th, 2005, 3:37 pm Posts: 36
|
I am trying to make a little inventory program for a hand held scanner in order to track servers in my data center. The program works fine in Windows XP, but I get some strange results in CE.
Here's a little info about the device.
Manufacture: Datalogic
Model: Memor
Operating system: Microsoft Windows CE 5.0
Here is a link to the device web site.
http://memor.datalogic.com/
Here is the program I wrote.
Code: ; ; AutoHotkey Version: 1.0.47.06 ; Language: English ; Platform: WinXP ; Author: ; ; Script Function: ; Template script (you can customize this template by editing "ShellNew\Template.ahk" in your Windows folder) ;
#NoTrayIcon ; Disables the showing of a tray icon. #SingleInstance ,Force ; Determines whether a script is allowed to run again when it is already running. #NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases. SendMode Input ; Recommended for new scripts due to its superior speed and reliability. SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
Gui, 9:Add, Text, cblue center x6 y10 w200 h75,Data Center Inventory Program V1.0`n`nCreated by: Jay Curcillo Gui, 9:Show,,DC Inventory sleep, 2000
winclose, DC Inventory
winwaitclose, DC Inventory
Time: FormatTime, timestamp,,yyyyMMdd
Gosub , DataCenter Return
DataCenter: Gui, 1:Add, Text,x6 y7 w200 ,Is this inventory being taken in the North or South Data Center? Gui, 1:Add, Button,x6 y50 w200 h70 gNorth default, North Gui, 1:Add, Button,x6 y130 w200 h70 gSouth, South Gui, 1:Show,, Data Center? Return
1GuiEscape: ExitApp
North: Gui, 1:Submit, NoHide Gui, 1:Destroy location=north goto, NorthInventory
South: Gui, 1:Submit, NoHide Gui, 1:Destroy location=south goto, SouthInventory
;North Inventory-----------------------------------------
NorthInventory: NorthFile: IfExist,North Inventory %timestamp%.csv { MsgBox,3,North Inventory File Exists,An Inventory file already exists for today's date. Would you like to continue this inventory? (Yes) to continue. (No) to delete file and create a new inventory. (Cancel) to exit program. IfMsgBox Yes FileAppend,,North Inventory %timestamp%.csv IfMsgBox No { FileDelete,North Inventory %timestamp%.csv FileAppend, ( Server,Location, ),North Inventory %timestamp%.csv } IfMsgBox Cancel Exitapp } else { FileAppend, ( Server,Location, ),North Inventory %timestamp%.csv }
Gosub , GUIGridNorth Gosub , GuiRackNorth Return
GuiGridNorth: Gui, 2:Add, Button, x6 y100 w130 h70 gEnter2 default, Enter Gui, 2:Add, Button, x146 y100 w80 h70 gCancel2, Cancel Gui, 2:Add, Text, x6 y7 w220, Scan or type grid location.`nExample: AB38 Gui, 2:Add, Edit, x6 y70 h20 w130 vGrid, Gui, 2:Show, , North Grid Location? GuiControl, 2:focus, Edit1 Return
2GuiEscape: ExitApp
Cancel2: ExitApp
Enter2: Gui, 2:Submit, NoHide Gui, 2:Destroy if grid = { MsgBox,,Invalid Grid Location, You have not entered a grid location. Please try again. goto, guigridNorth } else { goto,guirackNorth }
GuiRacknorth: WinWaitClose ,North Grid Location? Gui, 3:Add, Edit, x6 y62 w220 h117 Gui, 3:Add, Button, x21 y190 w190 h70 gNextRack3, Next Rack Gui, 3:Add, Button, x6 y7 w130 h30 gSavenExit3, Save and Exit Gui, 3:Add, Button, x166 y7 w60 h20 gHelp3, Help Gui, 3:Add, Text, x6 y43 w200, Scan inventory at grid %grid%. Gui, 3:Show,, North Inventory %timestamp% GuiControl, 3:focus, Edit1 Return
3GuiEscape: msgbox,4,Save Data?,Would you like to save before exiting the program? ifmsgbox yes { goto SavenExit3 } else { ExitApp }
3GuiClose: msgbox,4,Save Data?,Would you like to save before exiting the program? ifmsgbox yes { goto SavenExit3 } else { ExitApp }
NextRack3: GuiControlGet,servers,,Edit1, loop, parse, servers, `n, `r { ifequal,a_loopfield,, continue newservers .= (( A_Index = 1 ) ? "" : "`n" ) a_loopfield "," grid } FileAppend, ( `n%newservers% ),North Inventory %timestamp%.csv servers = newservers = gui, 3:destroy goto,guigridnorth
SavenExit3: GuiControlGet,servers,,Edit1, loop, parse, servers, `n, `r { ifequal,a_loopfield,, continue newservers .= (( A_Index = 1 ) ? "" : "`n" ) a_loopfield "," grid } FileAppend, ( `n%newservers% ),North Inventory %timestamp%.csv ExitApp
Help3: Gui, 7:Add,edit,ReadOnly Center w200,Data Center Inventory Progam V1.0`n`nCreated by `nWriten in AutoHotkey Version: 1.0.47.06`nRuns through AutoHotkeyCE 20`nDesigned to run on Datalogic Memor with Windows CE 5.0 operating system.`n`nInventory files are stored on root of Mobile Device.`n`nFor additional help contact `n`nPress ESC to exit Help. Gui, 7:Show,,Help return
7GuiClose: 7guiescape: gui, 7:destroy winwaitclose,Help goto,guiracknorth
;South Inventory----------------------------------------------
SouthInventory: SouthFile: IfExist,South Inventory %timestamp%.csv { MsgBox,3,South Inventory File Exists,An Inventory file already exists for today's date. Would you like to continue this inventory? (Yes) to continue. (No) to delete file and create a new inventory. (Cancel) to exit program. IfMsgBox Yes FileAppend,,South Inventory %timestamp%.csv IfMsgBox No { FileDelete,South Inventory %timestamp%.csv FileAppend, ( Server,Location, ),South Inventory %timestamp%.csv } IfMsgBox Cancel Exitapp } else { FileAppend, ( Server,Location, ),South Inventory %timestamp%.csv }
Gosub , GUIGridSouth Gosub , GuiRackSouth Return
GuiGridSouth: Gui, 4:Add, Button, x6 y100 w130 h70 gEnter4 default, Enter Gui, 4:Add, Button, x146 y100 w80 h70 gCancel4, Cancel Gui, 4:Add, Text, x6 y7 w220, Scan or type grid location.`nFloor=6`nGrid=AB38`nExample: 6AB38 Gui, 4:Add, Edit, x6 y70 h20 w130 vGrid, Gui, 4:Show, , South Grid Location? GuiControl, 4:focus, Edit1 Return
4GuiEscape: ExitApp
Cancel4: ExitApp
Enter4: Gui, 4:Submit, NoHide Gui, 4:Destroy if grid = { MsgBox,,Invalid Grid Location, You have not entered a grid location. Please try again. goto, guigridSouth } else { goto,guirackSouth }
GuiRackSouth: WinWaitClose ,South Grid Location? Gui, 5:Add, Edit, x6 y62 w220 h117 Gui, 5:Add, Button, x21 y190 w190 h70 gNextRack5, Next Rack Gui, 5:Add, Button, x6 y7 w130 h30 gSavenExit5, Save and Exit Gui, 5:Add, Button, x166 y7 w60 h20 gHelp5, Help Gui, 5:Add, Text, x6 y43 w200, Scan inventory at grid %grid%. Gui, 5:Show,, South Inventory %timestamp% GuiControl, 5:focus, Edit1 Return
5GuiEscape: msgbox,4,Save Data?,Would you like to save before exiting the program? ifmsgbox yes { goto SavenExit5 } else { ExitApp }
5GuiClose: msgbox,4,Save Data?,Would you like to save before exiting the program? ifmsgbox yes { goto SavenExit5 } else { ExitApp }
NextRack5: GuiControlGet,servers,,Edit1, loop, parse, servers, `n, `r { ifequal,a_loopfield,, continue newservers .= (( A_Index = 1 ) ? "" : "`n" ) a_loopfield "," grid } FileAppend, ( `n%newservers% ),South Inventory %timestamp%.csv servers = newservers = gui, 5:destroy goto,guigridSouth
SavenExit5: GuiControlGet,servers,,Edit1, loop, parse, servers, `n, `r { ifequal,a_loopfield,, continue newservers .= (( A_Index = 1 ) ? "" : "`n" ) a_loopfield "," grid } FileAppend, ( `n%newservers% ),South Inventory %timestamp%.csv ExitApp
Help5: Gui, 8:Add,edit,ReadOnly Center w200,Data Center Inventory Progam V1.0`n`nCreated by `nWriten in AutoHotkey Version: 1.0.47.06`nRuns through AutoHotkeyCE 20`nDesigned to run on Datalogic Memor with Windows CE 5.0 operating system.`n`nInventory files are stored on root of Mobile Device.`n`nFor additional help contact `n`nPress ESC to exit Help. Gui, 8:Show,,Help return
8GuiClose: 8guiescape: gui, 8:destroy winwaitclose,Help goto,guirackSouth
My finished file should look like this. And it does in Windows XP.
Server,Location, RONTGEN,6AB81 MILLIKAN,6AB82 LUPINE,6AB82 KOMBI,6AB86 MICROBUS,6AB87 TSROBK,6AB90 WESROBK,6AB90 NYROBK,6AB90 NEEDLE,6AB90 CLASS HA,6AB90 SEROBK,6AB90 PENNROBK,6AB90 NONSTOPS,6U105 AAW27600,6U106 AAW27601,6U106 AAW27602,6U106 AAW27603,6U106 AAW27604,6U106 AAW27605,6U106 AAW27606,6U106 AAW27607,6U106 But this is what I get in Windows CE. Server,Location, RONTGEN,6AB81 MILLIKAN,6AB82 LUPINE,6AB82 KOMBI,6AB86 N,6AB86 LUPINE,6AB86 MICROBUS,6AB87 PINE,6AB87 TSROBK,6AB90 WESROBK,6AB90 NYROBK,6AB90 NEEDLE,6AB90 CLASS HA,6AB90 SEROBK,6AB90 PENNROBK,6AB90 NONSTOPS,6U105 ROBK,6U105 NYROBK,6U105 NEEDLE,6U105 CLASS HA,6U105 SEROBK,6U105 PENNROBK,6U105 AAW27600,6U106 AAW27601,6U106 AAW27602,6U106 AAW27603,6U106 AAW27604,6U106 AAW27605,6U106 AAW27606,6U106 AAW27607,6U106 =,6U106
I don't know where all of the extra data comes from. Please help!
Last edited by Hedonist on July 29th, 2008, 12:42 pm, edited 1 time in total.
|
|