Jump to content
Sign in to follow this  
Lesler

DOS command to (@ ComSpec or ??

Recommended Posts

Lesler

$temp=" "
$slet_liste=FileOpen("X:\TSA\Special\programmer\find_glemte_ver_i_pdf\a\a_0.txt", 2)
FileWriteLine($slet_liste,"" & $temp)
FileClose($slet_liste)
Sleep(100)
Global $i_l
$file = FileOpen("X:\TSA\Special\programmer\find_glemte_ver_i_pdf\a_liste_UDEN_REV.txt", 0)

run ("cmd.Exe")

 While 1
    $line = FileReadLine($file)
    If @error = -1 Then ExitLoop

WinActivate ("cmd.exe")
Sleep(500)
send("type X:\TSA\Special\programmer\find_glemte_ver_i_pdf\pdf_liste_kun_vare_nr.txt | find /i ")
Send("{ASC 034}")
send($line)
send(".")
Send("{ASC 034}")
send(" > X:\TSA\Special\programmer\find_glemte_ver_i_pdf\a\temp_liste.txt")
send("{ENTER}")
Sleep(100)

$temp_liste=FileOpen("X:\TSA\Special\programmer\find_glemte_ver_i_pdf\a\temp_liste.txt", 0)
$temp2 = FileReadLine($temp_liste, 1)
FileClose($temp_liste)

$i_h=FileOpen("X:\TSA\Special\programmer\find_glemte_ver_i_pdf\a\a_0.txt", 1)
If $i_h = -1 Then
    MsgBox(0, "Error", "Unable to open file.")
    Exit
EndIf

FileWriteLine($i_h,"" & $temp2)
FileClose($i_h)
Sleep(100)

$h_l=FileOpen("X:\TSA\Special\programmer\find_glemte_ver_i_pdf\samlet_liste.txt", 1)
If $h_l = -1 Then
    MsgBox(0, "Error", "Unable to open file.")
    Exit
EndIf

FileWriteLine($h_l,"" & $temp2)
FileClose($h_l)
Sleep(100)

WEnd

FileDelete("X:\TSA\Special\programmer\find_glemte_ver_i_pdf\a\temp_liste.txt")

send("exit")
send("{ENTER}")
FileClose($file)
I hope that I have written this post twice. :mellow:

Excuse my English it is translated using the Goggels

Hello

I must have done a cmd commando

I have tried that programs me outwards with the following

WinActivate ( "cmd.exe")

Sleep (500)

send ( "type X: \ TSA \ Special \ Programs \ find_glemte_ver_i_pdf \ pdf_liste_kun_vare_nr.txt | find / i")

Send ( "(ASC 034)")

send ($ line)

Send (".")

Send ( "(ASC 034)")

send ( "> X: \ TSA \ Special \ Programs \ find_glemte_ver_i_pdf \ a \ temp_liste.txt")

send ( "(ENTER)")

Sleep (100)

It also works, but I want it written in an internal command in Autoit

I have tried myself with RunWait (@ ComSpec

But unfortunately I can not get it to work.

Is there one of you will help me?

Thanks in advance

Share this post


Link to post
Share on other sites
Lesler

Run(@Comspec & " commands here")

Hello

Thank you for your prompt response.

My problem is that I need it to insert the variable $ line and to my dos commando demands that are placed "around and Autoit will not accept that there are more" than those who

surrounding the line

Share this post


Link to post
Share on other sites
Lesler

Thank that yuo try to help me

my CMD command looks like lise

type X:\TSA\Special\ Programs\find_glemte_ver_i_pdf\pdf_liste_kun_vare_nr.txt | find /i "12345" > X:\TSA\Special\Programs\find_glemte_ver_i_pdf\a\temp_liste.txt

where "12345" most be $line

But the ComSpec will not accept the "" around $line

Share this post


Link to post
Share on other sites
whim

$line = '12345'
$cmd = 'X:\TSA\Special\ Programs\find_glemte_ver_i_pdf\pdf_liste_kun_vare_nr.txt | find /i "' & $line & '" > X:\TSA\Special\Programs\find_glemte_ver_i_pdf'

Run(@ComSpec & ' /c ' & $cmd)

or, maybe more useful:

$findstr = '12345'
$cmd = 'X:\TSA\Special\ Programs\find_glemte_ver_i_pdf\pdf_liste_kun_vare_nr.txt | find /i "' & $findstr & '" > '
$outfile = 'X:\TSA\Special\Programs\find_glemte_ver_i_pdf'

Run(@ComSpec & ' /c ' & $cmd & $outfile)
Edited by whim

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.