inspector Posted April 9, 2007 Posted April 9, 2007 Hello, I am new to Autoit and am not a programmer. I am trying to create a dir in a script but it does not work. If I try the DirCreate in a simple 2 line script it works! CODE$name = ClipGet() DirCreate ("C:\Documents and Settings\Owner.CSI\Desktop\Inspections\Reports\" & $name ) Any suggestions? The ^r runs a macro in openoffice The message box gives me the correct name CODERun("C:\Program Files\OpenOffice.org 2.2\program\scalc.exe AppointmentSheet.ods","C:\Documents and Settings\Owner.CSI\Desktop\Inspections\") WinWaitActive("AppointmentSheet - OpenOffice.org Calc") Send("^r") MsgBox(0, "Wait for response", "Continue") WinActivate("AppointmentSheet - OpenOffice.org Calc") Send("{Down 20}") Send("^c") Sleep(500) $name = ClipGet() MsgBox(0, "The value is:", $name) DirCreate ("C:\Documents and Settings\Owner.CSI\Desktop\Inspections\Reports\" & $name )
BrettF Posted April 9, 2007 Posted April 9, 2007 Um... What does $name actually contain? Because they are characters not allowed in folders... Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version!
inspector Posted April 9, 2007 Author Posted April 9, 2007 Um... What does $name actually contain? Because they are characters not allowed in folders...Its an address "123 Nice Street" and it works fine if I run those two lines alone in its own script, but if its in the complete script it doesn't work.
BrettF Posted April 9, 2007 Posted April 9, 2007 Its an address "123 Nice Street" and it works fine if I run those two lines alone in its own script, but if its in the complete script it doesn't work.Look at ControlGetText () and ControlClick (). Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version!
inspector Posted April 9, 2007 Author Posted April 9, 2007 Look at ControlGetText () and ControlClick ().I don't see how this would help, but maybe its just me being a newbie. The thing that I find strange is that the dirCreate works fine if I run it alone as is, it will create the dir with the last copied item in the clipboard. Is there some coding mistake I'm making in combination with the rest of the script?
inspector Posted April 11, 2007 Author Posted April 11, 2007 Anyone have any idea why this doesn't work?
someone Posted April 11, 2007 Posted April 11, 2007 Its a little hard to say without knowing exactly what $name contains but the trick is to 'debug' your script replacing/modifying what could be affecting it until you know whats going wrong. For example, if you remove $name from the DirCreate and replace it with the exact path you want to create does it work then? If so you know there is a problem with $name. What does it look like if you do MsgBox(0, "", "C:\Documents and Settings\Owner.CSI\Desktop\Inspections\Reports\" & $name )? Its possible an extra space or \ is messing you up. Take Bert's adivce though and read up on ControlClick and ControlGetText. Even if it has nothing to do with why this isn't working coding with a lot of Send commands has a lot of potential for failure. While ProcessExists('Andrews bad day.exe') BlockInput(1) SoundPlay('Music.wav') SoundSetWaveVolume('Louder') WEnd
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now