Jump to content
Sign in to follow this  
Lesler

Program will not run on 1 out of 4 PC

Recommended Posts

Lesler

Program will not run on 1 outwards 4 PC

Hello

I have a strange problem.

I have created a program that searches for a text in a file.

Return the it to a file.

When I run the program it works fine on 3 outwards 4 PCs.

On the 4 pc (and it is on the PC program to run)

On my return the variables as empty.

Are there any of you have an idea for hvordn it be solved?

Thanks in advance

Global $temp, $file, $line, $temp2

;Her slettes indholdet af liste til_pro

$temp=(" ")

FileOpen("X:\TSA\Special\programmer\status_80\liste_til_tegning\liste_til_pro.txt", 2)

FileWriteLine("X:\TSA\Special\programmer\status_80\liste_til_tegning\liste_til_pro.txt","" & $temp)

FileClose("X:\TSA\Special\programmer\status_80\liste_til_tegning\liste_til_pro.txt")

run ("cmd.Exe")

$file = FileOpen("X:\TSA\Special\programmer\status_80\liste_til_tegning\liste.txt", 0)

; Check if file opened for reading OK

If $file = -1 Then

MsgBox(0, "Error", "Filen kan ikke åbnes.")

Exit

EndIf

; Her læses linerne til EOF er nået

While 1

$line = FileReadLine($file)

If @error = -1 Then ExitLoop

WinActivate ("cmd.exe")

Sleep(500)

Send("cd X:\TSA\Special\programmer\status_80\liste_til_tegning")

Sleep(500)

send("{ENTER}")

send("type asm_liste.txt | find /i ")

Send("{ASC 034}")

send($line)

send(".")

Send("{ASC 034}")

send(" > temp_liste.txt")

send("{ENTER}")

Sleep(500)

FileOpen("X:\TSA\Special\programmer\status_80\liste_til_tegning\temp_liste.txt", 0)

$temp2 = FileReadLine("X:\TSA\Special\programmer\status_80\liste_til_tegning\temp_liste.txt", 1)

FileClose("X:\TSA\Special\programmer\status_80\liste_til_tegning\temp_liste.txt")

Sleep(100)

MsgBox ("","",$temp2)

FileOpen("X:\TSA\Special\programmer\status_80\liste_til_tegning\liste_til_pro.txt", 1)

FileWriteLine("X:\TSA\Special\programmer\status_80\liste_til_tegning\liste_til_pro.txt","" & $temp2)

FileClose("X:\TSA\Special\programmer\status_80\liste_til_tegning\liste_til_pro.txt")

Wend

send("exit")

send("{ENTER}")

FileClose($file)

$File=FileRead("X:\TSA\Special\programmer\status_80\liste_til_tegning\liste_til_pro.txt")

$NewString = StringRegExpReplace($File,'.asm.\d{1,3}','.drw')

FileWrite("X:\TSA\Special\programmer\status_80\liste_til_tegning\liste_til_pro_DRW.txt",$NewString)

Exit

Share this post


Link to post
Share on other sites
James

Couple of pointers that may help:

  • Instead of sending directly to command prompt, with Send() why not use StdinWrite()
  • When posting code, using the [ autoit ] tags to highlight.
  • Run Tidy.exe (Ctrl+T) if you have SciTE4AutoIt3
  • You declared a variable like this:
$temp=(" ")
but really, you don't need the parenthesis.

  • Your While loop looks like it will never finish, so you should look at StdoutRead() which shows how to get command prompt data

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.