Sign in to follow this  
Followers 0
BinaryBrother

Urgent

5 posts in this topic

I've brain fried ATM, and I can't seem to get this going, does anyone have an idea on how I can list transposed arrays...

The first column will consist of product names on an inventory list, and the second column will consist of the count. This is part of a very simplistic, dynamic, inventory application. My Boss caught wind of it, and wants me to finish it for him, and have a DEMO going by tomorrow.... and I just so happen to be stuck with something so simple... (With a twist)

The first column of product names that will be going into the array is dynamic, it changes when new products are listed so an accurate count of the files in the directory is essential. The program writes the additional products to a directory as a file... and inside that file, the number of that product in contained. So listing that to an Array has me stumped...

If Not FileExists("C:\LCC\") Then; Creates a working LCC Directory on host computers harddrive
    DirCreate("C:\LCC\")
EndIf
$ProductList =_FileListToArray("C:\LCC\"); Creates an Array based on the directory listing.
$NODP = $ProductList[0]; Counts the number of products, because the [0] is about to get deleted.
_ArrayDelete($ProductList, 0); The product count in $ProductList[0] was moved to $NODP
$ProductListing = _ArrayToString($ProductList, "|");Split the Array to a String with "|" seperator for GUI combo list to be dynamic

That being said... How? :) Thank you guys for all your help!

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

I've brain fried ATM, and I can't seem to get this going, does anyone have an idea on how I can list transposed arrays...

The first column will consist of product names on an inventory list, and the second column will consist of the count. This is part of a very simplistic, dynamic, inventory application. My Boss caught wind of it, and wants me to finish it for him, and have a DEMO going by tomorrow.... and I just so happen to be stuck with something so simple... (With a twist)

The first column of product names that will be going into the array is dynamic, it changes when new products are listed so an accurate count of the files in the directory is essential. The program writes the additional products to a directory as a file... and inside that file, the number of that product in contained. So listing that to an Array has me stumped...

If Not FileExists("C:\LCC\") Then; Creates a working LCC Directory on host computers harddrive
    DirCreate("C:\LCC\")
EndIf
$ProductList =_FileListToArray("C:\LCC\"); Creates an Array based on the directory listing.
$NODP = $ProductList[0]; Counts the number of products, because the [0] is about to get deleted.
_ArrayDelete($ProductList, 0); The product count in $ProductList[0] was moved to $NODP
$ProductListing = _ArrayToString($ProductList, "|");Split the Array to a String with "|" seperator for GUI combo list to be dynamic

That being said... How? :) Thank you guys for all your help!

You give to give a clearer explanation fo rme to understand what you have to do. Where do th eproduct names come from? How do the files get into the directory. How do you expect there to be files to be counted in a directory that you have just created?

EDIT: missread so deleted incorrect answer.

Edited by martin

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Alright, sorry I wasn't clear enough. When you open the 'Modify Inventory' section of my application, the combo list is generated by a directory listing in 'C:\LCC\' All files that are in this directory are product names with no extensions, so no file type associations... The directory listing would be like...

soap

febreze

speakers

etc

and inside those files, I've placed numbers in relation to how much of that product I have. You can also modify this number via my application, and even add new products, which in turn, adds a new file to the directory. If I add 22 Bic lighters to my inventory... It creates a file called 'Bic Lighters' and inside that file will only be the number 22. I'm trying to display the different products on the left hand column of a transposed array, and the numbers in the right hand column, but it's proving to be quite difficult... After I've got the DEMO going, I'll post the entire script so that some of you can give me some helpful criticism, which is actually appreciated. As of right now, the script is so 'rigged' and pieced together that anyone of you would probably laugh, and have a small book worth of corrections. That's the only reason I've not posted the entire script yet, but I will, I promise... :)

and may I just add that I appreciate a reply from someone as experienced as yourself Martin, you've gained quite a reputation here on the AutoIt forums.

Edited by BinaryBrother

Share this post


Link to post
Share on other sites

Alright, sorry I wasn't clear enough. When you open the 'Modify Inventory' section of my application, the combo list is generated by a directory listing in 'C:\LCC\' All files that are in this directory are product names with no extensions, so no file type associations... The directory listing would be like...

soap

febreze

speakers

etc

and inside those files, I've placed numbers in relation to how much of that product I have. You can also modify this number via my application, and even add new products, which in turn, adds a new file to the directory. If I add 22 Bic lighters to my inventory... It creates a file called 'Bic Lighters' and inside that file will only be the number 22. I'm trying to display the different products on the left hand column of a transposed array, and the numbers in the right hand column, but it's proving to be quite difficult... After I've got the DEMO going, I'll post the entire script so that some of you can give me some helpful criticism, which is actually appreciated. As of right now, the script is so 'rigged' and pieced together that anyone of you would probably laugh, and have a small book worth of corrections. That's the only reason I've not posted the entire script yet, but I will, I promise... :)

and may I just add that I appreciate a reply from someone as experienced as yourself Martin, you've gained quite a reputation here on the AutoIt forums.

Maybe something like this

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <File.au3>
#include <array.au3>

$productList = _FileListToArray("C:\LCC")
Local $listview, $button, $item1, $item2, $item3, $input1, $msg

GUICreate("listview products", 220, 250, 100, 200, -1, $WS_EX_ACCEPTFILES)

$listview = GUICtrlCreateListView("product   |stock qty ", 10, 10, 200, 150);,$LVS_SORTDESCENDING)
For $n = 1 To $productList[0]
    $fr = FileRead("C:\LCC\" & $productList[$n], 10)
    $num = Number($fr)
    $item1 = GUICtrlCreateListViewItem($productList[$n] & "|" & $num, $listview)
Next
GUISetState()

Do
    $msg = GUIGetMsg()
    
Until $msg = $GUI_EVENT_CLOSE

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Thank you so much Martin, I LOVE YOU!!! (Looks around to make sure no-one heard that, and sneaks in a friendly hand-shake to Martin)

I was totally going about it the wrong way... I was about to try and fileread with dynamic variables, and place the numbers into another variable... lol

Edited by BinaryBrother

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0