Jump to content

Recommended Posts

Posted

How do you go about adding a @SW_HIDE Flag into the program so it doesn't constantly open - so you can run the script and then let it go about its business for 20mins without getting windows popping up after each .dwg its processed?

Posted

Ok i figured it out :) i was putting the @SW_HIDE flag in the workingdir not the flag section of the script.

Is there a way to add hotkeys to terminate the script?? I found this section in the help part though I don't really understand how it works within the script.

; Press Esc to terminate script, Pause/Break to "pause"

Global $Paused
HotKeySet("{PAUSE}", "TogglePause")
HotKeySet("{ESC}", "Terminate")
HotKeySet("+!d", "ShowMessage") ;Shift-Alt-d

;;;; Body of program would go here ;;;;
While 1
Sleep(100)
WEnd
;;;;;;;;

Func TogglePause()
$Paused = Not $Paused
While $Paused
Sleep(100)
ToolTip('Script is "Paused"', 0, 0)
WEnd
ToolTip("")
EndFunc ;==>TogglePause

Func Terminate()
Exit 0
EndFunc ;==>Terminate

Func ShowMessage()
MsgBox(4096, "", "This is a message.")
EndFunc ;==>ShowMessage
Posted

Try this:

HotKeySet("{ESC}", "Terminate")

$message = "Hold down Ctrl or Shift to choose multiple files."
$var = FileOpenDialog($message, @MyDocumentsDir, "All Files (*.dwg*)", 1 + 4)
If @error Then
    MsgBox(4096, "", "No File(s) chosen")
    Exit
EndIf
;ConsoleWrite($var & @CRLF) ;For Debug Only

If StringInStr($var, "|") Then ;Multiple file
    $split = StringSplit($var, "|")
    ;_ArrayDisplay($split)
    For $i = 2 To UBound($split) - 1
        $file_path = @WorkingDir & "\" & $split[$i]
        ;ConsoleWrite('"C:\Program Files\AutoDesk\AutoCad 2013\acad.exe" /b "' & $file_path & '"' & @CRLF)
        Run('"C:\Program Files\AutoDesk\AutoCad 2013\acad.exe" /b "' & $file_path & '"')
    Next
Else
    Run('"C:\Program Files\AutoDesk\AutoCad 2013\acad.exe" /b "' & $var & '"')
EndIf

Func Terminate()
    Exit
EndFunc

When you click on Esc button the script will terminate ;)

Hi!

My UDF: NetInfo UDF Play with your network, check your download/upload speed and much more! YTAPI Easy to use YouTube API, now you can easy retrive all needed info from a video. NavInfo Check if a specific browser is installed and retrive other usefull information. YWeather Easy to use Yahoo Weather API, now you can easily retrive details about the weather in a specific region. No-IP UDF Easily update your no-ip hostname(s).

My Script: Wallpaper Changer Change you wallpaper dinamically, you can also download your wallpaper from your website and share it with all!   My Snippet: _ImageSaveToBMPConvert an image to bmp format. _SciteGOTO Open a file in SciTE at specific fileline. _FileToHex Show the hex code of a specified file

Posted

Ok thanks Nessie :)

Do you know anything about being able to amend lines in notepad using autoit ??

For Instance

Line1 - text1

Line2 - text2

Line3 - text3

Message box to pop up asking user to input a text string for this purpose the date "inpute date:"

Which would then change text2 to input date??

What i have is a script that goes through all autocad drawings and finds text string xx.xx.xx and replaces with what the user inputs to the correct date - what i am trying to do is able to run the autoit script to update the notepad file before batching the script through autocad.

Posted

Its possible to do that. Now it's a little bit late (4.18 AM here :thumbsup: ) i will take a look "tomorrow" ;)

Hi!

My UDF: NetInfo UDF Play with your network, check your download/upload speed and much more! YTAPI Easy to use YouTube API, now you can easy retrive all needed info from a video. NavInfo Check if a specific browser is installed and retrive other usefull information. YWeather Easy to use Yahoo Weather API, now you can easily retrive details about the weather in a specific region. No-IP UDF Easily update your no-ip hostname(s).

My Script: Wallpaper Changer Change you wallpaper dinamically, you can also download your wallpaper from your website and share it with all!   My Snippet: _ImageSaveToBMPConvert an image to bmp format. _SciteGOTO Open a file in SciTE at specific fileline. _FileToHex Show the hex code of a specified file

Posted

I was putting some thought into it to try and make this program full proof for future years to come instead of having to update it each year with a new release of AutoCAD because the path changes based on the year of the program i was thinking of being able to run something like this (dos command)

dir /s /b "%programfiles%AutoDeskacad.exe this returns these values

c:program filesautodeskautocad 2012acad.exe

c:program filesautodeskautocad 2013acad.exe

c:program filesautodesknavisworks simulate 2013lcdbx2013acad.exe

RunWait(@ComSpec & " /c dir *.EXE /s/b|cb.exe","",@SW_HIDE) ;Uses(cb.exe) to route output from a commandline app straight to the clipboard .. which can then be interrogated from within AU3 (thereby avoiding the need to bounce the info through a file)
Though now i think about it there is no way of narrowing down the file enough to specify the version of acad.exe you want to run (any version of AutoCAD will work though not Navisworks)

I have also tried to update the script a bit for instance where the script path is kept changes based on what jobno it is kept in so i tried to created a variable to be based on the @workingdir of the autoit.exe file and then the 04 RESOURCE03 STANDARDSclean.scr and then reference the variable in the script call up section of the RunWait command, though to no luck :( - The reason for this is that the script file we are going to write a new line to will be in different job folder numbers based on where the autoit.exe is executed from. My script looks like this at the moment.

;#include  ;Needed only for _ArrayDisplay
$message = "Hold Down Ctrl Or Shift To Choose Multiple Files."
$var = FileOpenDialog($message, @WorkingDir, "CAD FILES (*.dwg*)", 1 + 4)
If @error Then
MsgBox(4096, "", "No File(s) chosen")
Exit
EndIf
;ConsoleWrite($var & @CRLF) ;For Debug Only

If StringInStr($var, "|") Then ;Multiple file
$split = StringSplit($var, "|")
;_ArrayDisplay($split)
$script_path = @WorkingDir & "\04 RESOURCE\03 STANDARDS\clean.scr"
For $i = 2 To UBound($split) - 1
$file_path = @WorkingDir & "\" & $split[$i]
;ConsoleWrite('"C:\Program Files\AutoDesk\AutoCad 2013\acad.exe" /b "' & $file_path & '"' & @CRLF)
RunWait('"C:\Program Files\AutoDesk\AutoCad 2013\acad.exe" "' & $file_path & '" /b "G:\8333\JOBNO- CAD JOB\04 RESOURCE\03 STANDARDS\clean.scr" /nologo /nossm ' , "", @SW_HIDE)
Next
Else
RunWait('"C:\Program Files\AutoDesk\AutoCad 2013\acad.exe" "' & $var & '" /b "$script_path" /nologo /nossm ' , "", @SW_HIDE)
EndIf
MsgBox(4096, "", "Batch Cleaning Finished")
Exit
Posted

I think i will forget the write line part because its a lot easier to run this script through AutoCAD without having to open and close because all it is doing is a putting a date on the drawing.

Posted

Try this:

HotKeySet("{ESC}", "Terminate")

$message = "Hold down Ctrl or Shift to choose multiple files."
$var = FileOpenDialog($message, @MyDocumentsDir, "All Files (*.dwg*)", 1 + 4)
If @error Then
MsgBox(4096, "", "No File(s) chosen")
Exit
EndIf
;ConsoleWrite($var & @CRLF) ;For Debug Only

If StringInStr($var, "|") Then ;Multiple file
$split = StringSplit($var, "|")
;_ArrayDisplay($split)
For $i = 2 To UBound($split) - 1
$file_path = @WorkingDir & "\" & $split[$i]
;ConsoleWrite('"C:\Program Files\AutoDesk\AutoCad 2013\acad.exe" /b "' & $file_path & '"' & @CRLF)
Run('"C:\Program Files\AutoDesk\AutoCad 2013\acad.exe" /b "' & $file_path & '"')
Next
Else
Run('"C:\Program Files\AutoDesk\AutoCad 2013\acad.exe" /b "' & $var & '"')
EndIf

Func Terminate()
    Exit
EndFunc

When you click on Esc button the script will terminate ;)

Hi!

Sorry what i was after was for it to terminate the actual acad.exe process the script ran (sometimes the lisp routine we run on files can cause errors and the program is stuck in a constant loop) though ending the process acad.exe closes all process with this image name where i am only after closing the one the script started. I tried adding $PID variable at the start of the RunWait function to terminate it though i get a error message saying that the $pid was not called

Else
$PID = RunWait('"C:\Program Files\AutoDesk\AutoCad 2013\acad.exe" "' & $var & '" /b "G:\8333\JOBNO- CAD JOB\04 RESOURCE\03 STANDARDS\clean.scr" /nologo /nossm ' , "", @SW_HIDE)
EndIf
MsgBox(4096, "", "Batch Cleaning Finished")

Func Terminate()
ProcessClose($pid)
Exit 0
MsgBox(4096, "", "Batch Process Canceled")
EndFunc
Posted

If you use RunWait you will not have the PID of the process that was launched as returned value. To do that you have to use Run.

Hi!

My UDF: NetInfo UDF Play with your network, check your download/upload speed and much more! YTAPI Easy to use YouTube API, now you can easy retrive all needed info from a video. NavInfo Check if a specific browser is installed and retrive other usefull information. YWeather Easy to use Yahoo Weather API, now you can easily retrive details about the weather in a specific region. No-IP UDF Easily update your no-ip hostname(s).

My Script: Wallpaper Changer Change you wallpaper dinamically, you can also download your wallpaper from your website and share it with all!   My Snippet: _ImageSaveToBMPConvert an image to bmp format. _SciteGOTO Open a file in SciTE at specific fileline. _FileToHex Show the hex code of a specified file

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...