Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 06/08/2015 in all areas

  1. Mithandir1, Really? Because running the code exactly as it is in my previous comment works fine. Did you copy the code from my comment? Or wrap your run function in a ClipPut? Copy the code in my previous comment and insert it. Alternatively, you can use: ClipPut('rundll32 printui.dll,PrintUIEntry /if /b "' & $name & '" /f ' & @ScriptDir & '\PrinterInstaller\' & $bit & '\oemsetup.inf /r "IP_' & $ip & '" /m "PCL6 Driver for Universal Print"')and then paste directly into cmd and run. ConsoleWrite will work as Jewtus suggested, I just prefer using the clipboard for debugging external code, as it means you can run the code to emulate the script, And identify where the external command is failing. Neither way has a significant benefit over the other, It's just down to personal preference really. Cheers Javi
    2 points
  2. $Data = Json_ObjGet($Obj, "Data")That was the call I needed to see. Thanks for your help.
    1 point
  3. javiwhite

    StringLeft help!

    if you need both parts of the text, why don't you just use stringsplit? $text = "some = text" $Split = StringSplit($text,"=") ConsoleWrite($Split[1]) ;Some ConsoleWrite(@CR) ConsoleWrite($Split[2]) ;TextMany Thanks Javi
    1 point
  4. Easier way... ConsoleWrite the line and a @CRLF ConsoleWrite(@ComSpec & " /c " & 'rundll32 printui.dll,PrintUIEntry /if /b "' & $name & '" /f ' & @ScriptDir & '\PrinterInstaller\' & $bit & '\oemsetup.inf /r "IP_' & $ip & '" /m "PCL6 Driver for Universal Print"'&@CRLF)I use this when testing command line. I put a msg box up after the console write to validate the syntax first. I'd also suggest Using ' instead of " to start your comspec... the reason I say that is " is required for most CMDs and ' wont work.
    1 point
  5. A short tutorial? I works, but I am not sure what to do...
    1 point
  6. water

    How to update AutoIt

    Sure this is a typo. Or did you hear of AutoIt Version 4 on the forum?
    1 point
  7. LarsJ

    Data records with Array

    I think the OP asked for something like this: Local $tagMyRecord = "int Integer;double Real;char String[128]" Local $aMyArray[3] = [ DllStructCreate( $tagMyRecord ), _ DllStructCreate( $tagMyRecord ), _ DllStructCreate( $tagMyRecord ) ] $aMyArray[0].Integer = 1234 $aMyArray[0].Real = 1234.12 $aMyArray[0].String = "This is string 0" $aMyArray[1].Integer = 5678 $aMyArray[1].Real = 5678.56 $aMyArray[1].String = "This is string 1" $aMyArray[2].Integer = 9090 $aMyArray[2].Real = 9090.90 $aMyArray[2].String = "This is string 2" ConsoleWrite( $aMyArray[0].Integer & @LF ) ConsoleWrite( $aMyArray[0].Real & @LF ) ConsoleWrite( $aMyArray[0].String & @LF ) ConsoleWrite( $aMyArray[1].Integer & @LF ) ConsoleWrite( $aMyArray[1].Real & @LF ) ConsoleWrite( $aMyArray[1].String & @LF ) ConsoleWrite( $aMyArray[2].Integer & @LF ) ConsoleWrite( $aMyArray[2].Real & @LF ) ConsoleWrite( $aMyArray[2].String & @LF )
    1 point
  8. OK, I have recast WinRun.au3 so that the heart of the script is in a function, Main(). It now has two hotkeys: NumPadAdd to call up the command input box, and Shift-NumPadAdd to exit the script and clear both hotkeys. The hotkey action is indeed zippier now, virtually the same as the AHK version. As for the GoSubs, they are in WinRun-L.ahk, the small library of subroutines. For AutoIt, I recast the subs as functions (probably could and should do this in AHK, too). See WinRun-L.au3, below. I do appreciate your guidance and encouragement. #cs ********************************************************** WinRun.au3 -- AutoIt v3 [CLD rev.6/7/2015] Open|Switch_to program, URL, folder, etc., etc. Create aliases (command abbreviatons) in WinRun.INI Enter "ini" (no quotes) to edit WinRun.INI Sample INI entry: MyR=[LibFile] MyRoutine ; runs "MyRoutine:" in WinRun-L.au3 WinRun.txt has additional information Run AutoIt subroutines from WinRun-L.au3 library file ********************************************************** #ce #include <MsgBoxConstants.au3> HotKeySet("{NumPadAdd}", "Main") HotKeySet("+{NumPadAdd}", "DisableHotkeys") While 1 Sleep(20) WEnd ; ----------------------------------------------- ; Function definitions FUNC Main() ; Input Box dimensions and screen position ; Can set on command line with WinRun.au3 [width] [height] [X] [Y] Local $w = 330 Local $h = 150 Local $X = 720 Local $Y = 420 ; ----------------------------------------------- ; If $CmdLine[0] > 0 Then If $CmdLine[1] <> "." Then $w = $CmdLine[1] EndIf If $CmdLine[0] > 1 And $CmdLine[2] <> "." Then $h = $CmdLine[2] EndIf If $CmdLine[0] > 2 And $CmdLine[3] <> "." Then $X = $CmdLine[3] EndIf If $CmdLine[0] > 3 And $CmdLine[4] <> "." Then $Y = $CmdLine[4] EndIf EndIf ; ; ---------------------------------- AutoItSetOption("WinTitleMatchMode", -2) Local $AltBrowser = '"C:\Program Files (x86)\Mozilla Firefox\firefox.exe"' ; Local $AutoExe = @AutoItExe Local $AutoExe = "" ; Local $AutoExe = '"C:\Program Files (x86)\AutoIt3\AutoIt3_x64.exe"' Local $IniFile = @ScriptDir & "\WinRun.ini" Local $LibFile = @ScriptDir & "\WinRun-L.au3" Local $CrntWin = WinGetTitle("[active]") Local $I = InputBox("WinRun (Shift-NumPadAdd quits)", _ "Enter program name, window title, alias or ""ini""", _ "", "", $w, $h, $X, $Y, 60) If $I == "" Then WinActivate($CrntWin) ;Exit 0 EndIf Local $KeyValue = IniRead($IniFile, "WinRun", $I, $I) If $KeyValue Then If StringInStr($KeyValue, "[AutoExe] ", 0) > 0 Then $KeyValue = StringReplace($KeyValue, "[AutoExe] ", $AutoExe, 0, 0) EndIf If StringInStr($KeyValue, "[AltBrowser]", 0) > 0 Then $KeyValue = StringReplace($KeyValue, "[AltBrowser]", _ $AltBrowser, 0, 0) EndIf If StringInStr($KeyValue, "[LibFile]", 0) > 0 Then $KeyValue = StringReplace($KeyValue, "[LibFile]", $LibFile, 0, 0) EndIf If StringInStr($KeyValue, "[IniDir]", 0) > 0 Then $KeyValue = StringReplace($KeyValue, "[IniDir]", @ScriptDir, 0, 0) EndIf $I = $KeyValue EndIf If StringUpper($I) == "INI" Then ShellExecute($IniFile) ;Exit 1 ElseIf StringInStr($I, ":") > 0 Or StringInStr($I, ".") > 0 Then Local $rc = ShellExecuteRaw($I) ;Exit $rc ElseIf WinExists($I) Then WinActivate($I) ;Exit 3 EndIf ENDFUNC ; Main Func ShellExecuteRaw($R, $vWorkingDir="", $vVerb="", $vWait="") #cs Format raw string as "command", "params" for ShellExecute[Wait]() Variables: $R = raw string; $C = command; $D = delimiter; $P = params If input var $vWait is set, func returns ShellExecuteWait($C, $P, $vWorkingDir, $vVerb) otherwise, it returns ShellExecute($C, $P, $vWorkingDir, $vVerb) #ce Local $C = $R, $D = " ", $P = "" If StringInStr($R, '"') == 1 Then $D = '" ' EndIf If StringInStr($R, $D) > 0 Then $C = StringTrimRight( $R, StringLen($R) - StringinStr($R, $D) _ + 2 - StringLen($D)) $P = StringTrimLeft( $R, StringInStr($R, $D) ) EndIf Local $ShellFuncName = "ShellExecute" If $vWait Then $ShellFuncName = "ShellExecuteWait" EndIf Return Call($ShellFuncName, $C, $P, $vWorkingDir, $vVerb) EndFunc ; ShellExecuteRaw Func DisableHotKeys() HotKeySet("{NumpadAdd}", "") HotKeySet("+{NumpadAdd}", "") MsgBox(0, "WinRun", "Quitting WinRun...", 2) Exit EndFunc ; *********************************************************** ; end WinRun.au3 Here's WinRun-L.au3: ; AutoIt Library for WinRun.au3 [CLD rev.6/5/2015] #include <Clipboard.au3> AutoItSetOption("WinTitleMatchMode", -2) Global $cur = WinGetTitle("[active]") ; ---------------------------------- ; Main If $CmdLine[0] > 0 Then Call($CmdLine[1]) EndIf Exit 0 ; End Main ; ------------------------------- Func Copy() _ClipBoard_Empty() Send("^c") Return EndFunc ; Close current window Func Kill() WinKill("[active]") Return EndFunc Func Paste() Local $key = "^v" Local $win = WinGetTitle("[active]") If StringinStr($win, "vDos") > 0 Then $key = "#^v" EndIf Send($key) Return EndFunc ; Maximize current window Func MaxCur() WinSetState($cur, "", @SW_MAXIMIZE) Return EndFunc ; Minimize current window Func MinCur() Local $cur = WinGetTitle("[active]") WinSetState($cur, "", @SW_MINIMIZE) Return EndFunc ; Minimize other windows Func MinOther() Local $cur = WinGetTitle("[active]") WinSetState("vdos", "", @SW_MINIMIZE) WinMinimizeAll() WinActivate($cur) ; WinSetState($cur, "", @SW_MAXIMIZE) Return EndFunc ; Restore active window Func Restore() WinSetState($cur, "", @SW_RESTORE) Return EndFunc
    1 point
  9. Bowmore

    How to update AutoIt

    The ability to run and test the same code using the latest beta or the latest production release of Auto from the same instance of Scite4AutoIt is one of the great features of AutoIt / Scite
    1 point
  10. water

    How to update AutoIt

    3.3.13.20 is a beta version. You can install production version (3.3.12.0) and a beta version (3.3.13.20) side by side.
    1 point
  11. Jos

    How to update AutoIt

    v3.3.13.20 is a Beta version which will install in a subdirectory of the latest production version 3.3.12.0. These run fine side by side and from SciTE you can use Prod or Beta by using F5 (Prod) or Alt+F5 (Beta) Jos
    1 point
  12. Jos

    How to hook the kernel?

    ​Stick to what you understand when dealing with a virus. It is really simple: Don't panicGet the machine offline asap.ensure you either boot in safemode or with a thumbdrive to make sure the virus can't be active.Get a REAL tool to get rid of it and stop mikeymousing around. Jos
    1 point
×
×
  • Create New...