faustf

run command not run

10 posts in this topic

hi guys   i try  to run a  command  the  script is it

#cs ----------------------------------------------------------------------------

    AutoIt Version: 3.3.14.2
    Author:         faustf

    Script Function: Syncro FTP con Folder
    Template AutoIt script.

    Utility di supporto del gestionale GEST by e-Office per siti web eBay
    per sincronizzare  una cartella  da pc a ftp remoto

#ce ----------------------------------------------------------------------------
#include <Process.au3>

Local $Path_iniConfigFTP = @ScriptDir & "\WEB-SITE\eBay\FTP\config_ftp.ini"
Local $sPath_Folder = @ScriptDir & "\WEB-SITE\eBay\PUBLICAZIONI\FOTO\"
Local $sPath_Remote_Folder = IniRead($Path_iniConfigFTP, "ftp_config", "remote_dir", "default")
Local $sServiceON_OFF = IniRead($Path_iniConfigFTP, "ftp_config", "service", "default")
Local $sPath_Command = IniRead($Path_iniConfigFTP, "ftp_config", "command", "default")

Select

    Case $sServiceON_OFF = "ON"
        ;Run(@ScriptDir & "\TOOLS\FullSync\fullsync.exe " & $sPath_Command, "", @SW_MAXIMIZE)
        Run("cmd /"&@ScriptDir & "\TOOLS\FullSync\"& @ScriptDir & "\TOOLS\FullSync\fullsync.exe " & $sPath_Command ,"", @SW_MAXIMIZE)

        ; sincronizzo le due cartelle ogni tot  secondi
        ; prima di uplodare devo controllare la dimensione se no la devos trecciare come vuole ebay


    Case $sServiceON_OFF = "OFF"
        Local $ba = MsgBox(4, 'Info', 'Servizio di sincronizzazione  disabilitato, vuoi abilitarlo ??')
        ; si 6    no 7
        If $ba = 6 Then
            IniWrite($Path_iniConfigFTP, "ftp_config", "service", "ON")
        EndIf

EndSelect

i have  download  a fullsync is  simply utility for  sync  2  folder , https://sourceforge.net/projects/fullsync/files/FullSync 0.10.4/FullSync-0.10.4-win.zip/download

if  open cmd  and  run manully work  good , but  if  i runit  by  shellexecute  or run or  _rundos  not  work and  not  give me  some error

anyone  can help me???  :)  thankz  at  all

 

 

Share this post


Link to post
Share on other sites



instead of running cmd, you should be using @comspec

Example: run("cmd.exe /k SFC /?") >> run(@comspec & " /k SFC /?")

Also, I would put the command you are trying to run in ConsoleWrite() so you can see exactly what AutoIt is trying to run after variables are replaced with their actual values.

consolewrite("cmd /"&@ScriptDir & "\TOOLS\FullSync\"& @ScriptDir & "\TOOLS\FullSync\fullsync.exe " & $sPath_Command )


My Scripts:

False Positive Reporter - Mass email all anti virus vendors with an attachment of your program for easy whitelisting.

PortableApps.com App Creation Wizard  - A simple GUI-based Wizard for creating PortableApps.

AutoISO  - Automatic ISO Image creation using ImgBurn.

SoundBoard - Play any song or sound you want at the press of a hotkey

Share this post


Link to post
Share on other sites

i tryed in this mode

;Run(@ComSpec&@ScriptDir & "\TOOLS\FullSync\fullsync.exe " & $sPath_Command, "", @SW_MAXIMIZE)
        MsgBox(0,'',@ScriptDir & "\TOOLS\FullSync\ " & @ScriptDir & "\TOOLS\FullSync\fullsync.exe " & $sPath_Command)
        Run(@ComSpec & @ScriptDir & "\TOOLS\FullSync\ " & @ScriptDir & "\TOOLS\FullSync\fullsync.exe " & $sPath_Command, "", @SW_MAXIMIZE)

but not  work

o_O

Share this post


Link to post
Share on other sites

And what happens when you try to run it like this..

Local $sRunCommand = chr(34) & @ScriptDir & "\TOOLS\FullSync\fullsync.exe" & chr(34)
Run ( $sRunCommand & " " & $sPath_Command, "", @SW_MAXIMIZE )

 

Share this post


Link to post
Share on other sites

There's also no space between the @ComSpec and the @ScriptDir.

@ComSpec & " " &@ScriptDir & "\TOOLS\FullSync\

 


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

That's why I was trying to get him to run his first parameter for the run command in a consolewrite function so he can see how autoit is processing his input. He's missing spaces in places and I don't even think the command he's trying to launch is formatted correctly. Try running your first parameter as consolewrite and check the log. Compare it to what you would type into a cmd.exe  windows to run the file you intend to execute so you can learn what you are doing wrong. Also, could someone link op to macros documentation? I'm mobile atm.

Edited by BetaLeaf
Damn autocorrect

My Scripts:

False Positive Reporter - Mass email all anti virus vendors with an attachment of your program for easy whitelisting.

PortableApps.com App Creation Wizard  - A simple GUI-based Wizard for creating PortableApps.

AutoISO  - Automatic ISO Image creation using ImgBurn.

SoundBoard - Play any song or sound you want at the press of a hotkey

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

Macro documentation: https://www.autoitscript.com/autoit3/docs/macros.htm ?

Edited by Xandy
1 person likes this

Spoiler

I have no complaints.  I mean there are lots of things wrong with the world but I am not unhappy.
How could we ever fix it all, but to hope that one day we might?

 

Share this post


Link to post
Share on other sites

BTW, there's no difference between using @ComSpec or using the full path and file name for CMD.exe, @ComSpec is just shorter. You can also use just CMD.exe without the full path and it will usually still run correctly.


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites
On 9/9/2016 at 0:37 PM, BrewManNH said:

BTW, there's no difference between using @ComSpec or using the full path and file name for CMD.exe, @ComSpec is just shorter. You can also use just CMD.exe without the full path and it will usually still run correctly.

True but in some very, and I do mean very, rare instances, I've seen some paranoid admins move the CMD.exe somewhere else to prevent guests from using it.


My Scripts:

False Positive Reporter - Mass email all anti virus vendors with an attachment of your program for easy whitelisting.

PortableApps.com App Creation Wizard  - A simple GUI-based Wizard for creating PortableApps.

AutoISO  - Automatic ISO Image creation using ImgBurn.

SoundBoard - Play any song or sound you want at the press of a hotkey

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

If they do that, without updating the %comspec% environment variable, it won't work with @ComSpec either.

Edited by BrewManNH

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

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