Sign in to follow this  
Followers 0
Mag91

Beginner Question - Filepath - change letters - search for specific data

5 posts in this topic

#1 ·  Posted

Hey Community,

cause im too new in the Auto it world i will try it with the your help. hopefully.

I woud like to know how i can handle my Problem.

----

I have a Excel Data with 362 random numbers.
For Example:

1166642335374

1172899897343

.....

this numbers are a part of the filepath ...example

D:\Projekte\1166_64233_5374

as u can see its the first number of the Excel data. After the first 4 numbers it shoud make a "_" than another 5 "_"

This is my first question. How can i handle this to make it Shell execute.

 

--------

Second question:

If i am in the path.

For Example:

D:\Projekte\1166_64233_5374

the code shoud search for specific PDF Files.

They are named like: 0050569E364B1ED79B900F73E62660EC.pdf

the first 15 letters are always the same

0050569E364B1ED

when he found this data he has to copy it on a Folder on the Desktop.

(There can also be 2 or 3 pdfs in one Folder with this letters)

----

Please give me some help :-)

 

 

 

 

 

 

Share this post


Link to post
Share on other sites



#2 ·  Posted

Hi @Mag91, and welcome to the AutoIt forum :)

What you're trying to do is:

1) Read from an Excel worksheet;

2) You have a string, which it's lenght is 13 characters, and, after 4 characters, you have to put an underscore ( "_" ), then, after other 5 characters, you have to put another "_" ( after the 9th character, so );

3) You have to shell these combined paths ( for me, it's not needed the Shell(), and search for PDF files in them, and those PDF files have the first 15 characters which are always the same, copy them to the Desktop folder.

Not so difficult to do :)

Did you test some code? Show us what you got :)

1 person likes this

Click here to see my signature:

Spoiler

I will always thank you for the time you spent for me.
I'm here to ask, and from your response, I'd like to learn.
By my knowledge, I can help someone else, and "that someone" could help in turn another, and so on.

Share this post


Link to post
Share on other sites

#3 ·  Posted

Exactly!!!

i know my code is like shit for known Auto it programmers... but here

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <Array.au3>
#include <File.au3>
#include <MsgBoxConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("BigBag", 188, 48, 553, 270)
$Button1 = GUICtrlCreateButton("Start", 8, 8, 169, 33)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

HotKeySet("{F10}", "stop")

Func STOP()
While 1
Sleep(120)
WEnd
EndFunc

While 2
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

        Case $Button1 ;Start

;=============Find Project===============
sleep (2000)

If ProcessExists ("EXCEL.EXE") Then
    WinActivate ("BigBag_ab_31.01.17.xlsx - Excel")
    EndIf
sleep (500)
Send("{CTRLDOWN}c{CTRLUP}")                                     ;COPY PROJECT NUMBER FROM EXCEL
sleep (500)

ShellExecute ("Z:\Projektdetails\")
WinWaitActive ("Projektdetails", "Projektdetails", 10)
WinMove ("Projektdetails", "", 0, 0, 1000, 750)
sleep (100)
$HWND = WinWaitActive("Projektdetails", "")
ControlClick($HWND, "", "[CLASSNN:ToolbarWindow322; INSTANCE:2; ID:1287]", "LEFT", 1)
Send("{CTRLDOWN}v{CTRLUP}")


EndSwitch
WEnd

The code is just form with a start button
It Begins with ctrl c to copy the number from the Excel worksheet.
Then it execute a part of the path and put the copied data behind the path.
 

i can tell him now to go 4 letters left and set a underscore "_" and another 6 left to set another underscore.

But i know its to simple. i dont want to make him mouseclick or send ("{left}"). i want a better way.

its to superficial (I hope that's the right word) - its not deep enough

for the 3rd Point i have no idea :S

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

@Mag91

First of all, don't say these things

43 minutes ago, Mag91 said:

i know my code is like shit for known Auto it programmers

Everyone starts from the basic, and, within time, improve himself with the right path...

Then, let's talk about the approach you'd like to implement with your script.

I saw that you're opening the Excel worksheet to copy the row of the file to "format" ( xxxx_xxxxx_xxxx ), but, why don't using an _Excel* function?

You already know the name of the Excel file, so you could open it ( without see anything ), load the content of the file in an array ( with _Excel_RangeRead() ), and work on the content of the array, instead of having windows which activate and copy-paste data from program to program.

I can point you to the right direction ( which could be a lot, so my "solution" could not be the best/the only one you have to do... ), but you have to decide how to proceed with your script.

 

Edited by FrancescoDiMuro
1 person likes this

Click here to see my signature:

Spoiler

I will always thank you for the time you spent for me.
I'm here to ask, and from your response, I'd like to learn.
By my knowledge, I can help someone else, and "that someone" could help in turn another, and so on.

Share this post


Link to post
Share on other sites

#5 ·  Posted

1 hour ago, FrancescoDiMuro said:

@Mag91

First of all, don't say these things

Everyone starts from the basic, and, within time, improve himself with the right path...

Then, let's talk about the approach you'd like to implement with your script.

I saw that you're opening the Excel worksheet to copy the row of the file to "format" ( xxxx_xxxxx_xxxx ), but, why don't using an _Excel* function?

You already know the name of the Excel file, so you could open it ( without see anything ), load the content of the file in an array ( with _Excel_RangeRead() ), and work on the content of the array, instead of having windows which activate and copy-paste data from program to program.

I can point you to the right direction ( which could be a lot, so my "solution" could not be the best/the only one you have to do... ), but you have to decide how to proceed with your script.

 

Thanks a lot!

will try to handle the first step when im home <3

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

  • Similar Content

    • breakbadsp
      By breakbadsp
      I want to run a python script from autoit. 
      I know we can do this with shellexecute or run , but this python script takes 3 cmd line arguments.
      How to pass them from autoit script?
      I tried many ways.
      Following solution also not working 
      e.g. 
      RunWait( 'fullpath\Python.exe Scriptpath\ReadLog.py  -f "file.log" -k "key" -e "errMsg" ') Found solution:
      RunWait( 'fullpath\Python.exe ReadLog.py -f "file.log" -k "key" -e "errMsg" ', 'Working_directory_path')  
      PFB description:
      https://stackoverflow.com/questions/45757834/how-to-pass-command-line-arguments-to-a-python-script-anyscript-while-executin
       
    • LoneWolf_2106
      By LoneWolf_2106
      Hi everybody,
      i have to store an entire row of a Excel workbook into an array.  The row index is stored in a variable.
      How can i do it?
      Thanks in advance for your support.
    • LoneWolf_2106
      By LoneWolf_2106
      Hi everybody,
      i have to write a value into an excel column.
      I know where it starts from, but i don't know what the end is, last non-empty cell.
      How can i get the number of last non-empty cell?
      Thanks in advance.
      Regards 
    • Nareshm
      By Nareshm
      Hi All,
      I have excel file like this
      and i want to cut cell/text from excel to other software.

       
      I have to cut the cell of B column one by one and past into other software
      If Winexists("No Data Found")
      then restore cuted cell and goto next/down side cell
      How to do it ?