Jump to content

All Activity

This stream auto-updates     

  1. Past hour
  2. Nine, I only found this link by _WinAPI_RegisterShellHookWindow() : https://www.autoitscript.com/trac/autoit/ticket/2910 What to do next ? Where to add $HSHELL_FLASH ?
  3. Beware that .zzz might already exist. Prefer a "most probably unique" extension, (you aren't limited to 3-char legacy and you can use many dots), like ".zzz.MyOwn.Ext.For.Easy.Printing"
  4. Ah, you mean you want to differenciate whether the user wants to create a folder or a file with the input (s)he supplies you? In short: read his/her mind? That's the same difference between buying raw goods and cooking a meal, or for a doctor to prescribe some rest or brain surgery. Leave the user the clear choice: A/ I want to create a folder (cooking, surgery) B/ I want a new file (goods, rest) That leaves open the creation of files without extension (something perfectly legitimate) and folder having one or more dots (also completely valid).
  5. yes i can just prohibit the point in the last element of the path or filter it as proposed by AdamUL thanks to all 😉
  6. hi, after looking at a list of file extensions on the web, i decided to test the extension *.zzz (it does not seem to be used at the moment by any other program) and did a lot of testing with the registry and have come up with following solution: Case $print Global $tempfile = "zprint.zzz" RegWrite("HKEY_CLASSES_ROOT\.zzz", "", "REG_SZ", "zzzfile") RegWrite("HKEY_CLASSES_ROOT\.zzz", "Content Type", "REG_SZ", "text/plain") RegWrite("HKEY_CLASSES_ROOT\.zzz", "Perceived Type", "REG_SZ", "text") RegWrite("HKEY_CLASSES_ROOT\zzzfile", "", "REG_SZ", "Text Document") RegWrite("HKEY_CLASSES_ROOT\zzzfile\shell", "", "REG_SZ", "") RegWrite("HKEY_CLASSES_ROOT\zzzfile\shell\print", "", "REG_SZ", "") RegWrite("HKEY_CLASSES_ROOT\zzzfile\shell\print\command", "", "REG_EXPAND_SZ", "%SystemRoot%\system32\NOTEPAD.EXE /p %1") Sleep(500) $PrintData = GUICtrlRead($text) FileWrite ($tempfile, $PrintData) _FilePrint($tempfile) Sleep(500) RegDelete("HKEY_CLASSES_ROOT\.zzz") RegDelete("HKEY_CLASSES_ROOT\zzzfile") FileDelete ($tempfile) now this code above works like it should but: i am now missing the possibility of choice which printer should be used. currently it uses the default printer and that is super but using a typical print dialog (dialogue) would be nice and strangely the helpfile(s) for _WinAPI_PrintDlg and _WinAPI_PrintDlgEx are both more like an overkill because it is showing off what it can do, whilst when i print from notepad2.exe i get the _WinAPI_PrintDlgEx version but with the "Everything" Radiobutton activated and 1 Copy only. i know i can edit the example still a bit, but currently it is not quite clear to me how to implement above code into a printing dialog. any ideas?
  7. thanks jchd but that does not answer the initial question of how to distinguish a file path from a folder path before creating it
  8. @ericire Wrong answer! Local $aPath = [@ScriptName, ".", "C:\", "H:\MyFolder.special.version"] For $s In $aPath _WhatIsPath($s) Next Func _WhatIsPath($sPath) Local $ret = FileGetAttrib($sPath) ConsoleWrite('"' & $ret & '"' & @CRLF) Select Case $ret = "" MsgBox(0, "Result", $sPath & " doesn't exist yet." & @LF & "It *may be* OK to create that directory.") Case StringInStr($ret, "D") MsgBox(0, "Result", $sPath & " is already a directory with attributes " & $ret & @LF & "No need to create it.") Case Else MsgBox(0, "Result", $sPath & " is an existing file with attributes " & $ret & @LF & "Can't create a directory with this name.") EndSelect EndFunc I wonder if you ever read the answer you got here.
  9. An Isfile or isdirectory function would not matter as a dot is a valid character in a directory name. If you are just worried about "extensions," then you can do something like this. This will work with a path with an "extension" or not. Global $sDir = "Dir1\Dir2\Dir.csv" $sDir = StringRegExpReplace($sDir, "\.[^.]*$", "") If Not DirCreate($sDir) Then Exit 1 Adam
  10. There are plenty of examples that I pointed you to where you let the software run for X days and then only provide the serial when it is paid for. But based on your other comments you are not going to be happy until someone spoon feeds it all to you. With this show of laziness, I cringe to think at the quality of your application.
  11. Today
  12. so I only have the solution to use stringRight() and verify if there is a dot good evening
  13. Hi BrewManNH yes, damage that there is no function isfile or isdirectory
  14. Try this and adapt: HotKeySet("{ESC}", _Terminate) Local $title = "Adelitas Way - What It Takes" & " here more long text, much larger than LCD 24-char display (example) ... " Local $max = 24 Local $str = $title & $title ; yes, concat two copies of text Local $i While 1 $i += 1 ConsoleWrite(StringMid($str, Mod($i, StringLen($title)), $max) & @CRLF) Sleep(200) WEnd Func _Terminate() Exit EndFunc
  15. Hi AdamUl the problem is that dircreate will inevitably create a folder named Dir.csv
  16. This "WiFi_Configuration Ver 3.6" is a valid directory name, and a real one on my computer. This isn't a file, and there's no way you're going to be able to differentiate between a file name and a directory name using a criteria of "if it has a dot and something after it, it's a file name"
  17. A directory name with a dot in it is a valid path. DirCreate will not create a file, only a directories. See the example below. No file is created. Global $sDir = "Dir1\Dir2\Dir.csv" ;Dir.csv is a directory, not a file. If Not DirCreate($sDir) Then Exit 1 Now if you want to restrict directory names, more so than Windows, that is another thing. Adam
  18. How will you determine that what the user wants to create for a folder name is a file path or a directory name? What is your criteria?
  19. @LarsJ Many thanks for this very usefull sample 😃 I have written a small function to handle accessibility. You just put these 2 lines at the beginning of your script and accessibility is established. #include "_UIA_ChromeAccessibility.au3" $rc=_UIA_ChromeAccessibility(1) Here is the funtion "_UIA_ChromeAccessibility.au3" #include "UIAWrappers.au3" ;============================================================================================================== ; UDF Name: _UIA_ChromeAccessibility.au3 ; Description: iMode=0 Switch Chrome browser to accessiblility OFF. ; iMode=1 Switch Chrome browser to accessiblility ON. ; iMode=2 Return current Chrome browsers accessiblility Status. ; iMode=3 Debug current Chrome browsers accessiblility Status page. ; ; Syntax: _UIA_ChromeAccessibility([iMode=1]) ; Default: iMode=1 ; Parameter(s): iMode: 0/1/2/3 see above ; Requirement(s): #include "UIAWrappers.au3" ; Return Value(s): -1= error @error=1 invalid iMode @extended=$imode ; @error=2 "Chrome.exe" not found ; 0= accessiblility Status is OFF @error=0 @extended=0 ; 1= accessiblility Status is ON @error=0 @extended=0 ; Example: ; #include <_UIA_ChromeAccessibility.au3> ; http://autoitscript.com/forum/index.php?showtopic=1425848&view=findpost&p=1425848 ; _UIA_ChromeAccessibility() ; Set Chrome accessibility to ON ( iMode defaults to 1 ) ; MsgBox(Default, Default, "Set Chrome accessibility to ON ",0) ; ; Author: Exit ( http://www.autoitscript.com/forum/user/45639-exit ) ; SourceCode: http://autoitscript.com/forum/index.php?showtopic=1425848&view=findpost&p=1425848 Version: 2019.04.24 ; COPYLEFT: © 2019 Freeware by "Exit" ; ALL WRONGS RESERVED ;============================================================================================================== Func _UIA_ChromeAccessibility($iMode = 1) Local $return If Not ($iMode = 0 Or $iMode = 1 Or $iMode = 2 Or $iMode = 3) Then Return SetError(1, $iMode, -1) ; invalid iMode If Not ProcessExists("chrome.exe") Then If ShellExecute("chrome.exe") < 1 Then Return SetError(2, 0, -1) ; "Chrome.exe" not found EndIf ;~ chrome://accessibility "--force-renderer-accessibility" ShellExecuteWait("chrome.exe", "about:blank") ; create a new chrome tab Sleep(200) Local $oBlamk = _UIA_getFirstObjectOfElement($UIA_oDesktop, "name:=about:blank - Google Chrome", $treescope_subtree) _UIA_action($oBlamk, "setvalue using keys", "^l{del 20} chrome://accessibility {ENTER}") ; navigate to the accessibility pane Local $oAccInt = _UIA_getFirstObjectOfElement($oBlamk, "name:=Global accessibility mode:", $treescope_subtree) ; try to find accessibility text Select Case $iMode = 3 MsgBox(64+262144, Default, "Verify the checkboxes and press OK to continue.",0) ContinueCase Case $iMode = 2 $return = SetError(0, 0, IsObj($oAccInt)) Case $iMode = IsObj($oAccInt) $return = SetError(0, 0, $iMode) Case Else For $i = 1 To 5 Send("{TAB " & $i & "}{SPACE}") ; toggle all 5 checkboxes Sleep(50) Next $return = SetError(0, 0, $iMode) EndSelect Send("^w") ; close accessibility tab Return $return EndFunc ;==>_UIA_ChromeAccessibility Here a small testcase: #include "_UIA_ChromeAccessibility.au3" ; http://autoitscript.com/forum/index.php?showtopic=1425848&view=findpost&p=1425848 $rc=_UIA_ChromeAccessibility(3) ConsoleWrite(" ***** Just for debugging. ***** Error: " & @error & " Extended: " & @extended & " Line: " & @ScriptLineNumber & " RC: " & $rc & @LF) $rc=_UIA_ChromeAccessibility(1) ConsoleWrite(" ***** Just for debugging. ***** Error: " & @error & " Extended: " & @extended & " Line: " & @ScriptLineNumber & " RC: " & $rc & @LF) $rc=_UIA_ChromeAccessibility(2) ConsoleWrite(" ***** Just for debugging. ***** Error: " & @error & " Extended: " & @extended & " Line: " & @ScriptLineNumber & " RC: " & $rc & @LF) $rc=_UIA_ChromeAccessibility(0) ConsoleWrite(" ***** Just for debugging. ***** Error: " & @error & " Extended: " & @extended & " Line: " & @ScriptLineNumber & " RC: " & $rc & @LF) $rc=_UIA_ChromeAccessibility(1) ConsoleWrite(" ***** Just for debugging. ***** Error: " & @error & " Extended: " & @extended & " Line: " & @ScriptLineNumber & " RC: " & $rc & @LF) $rc=_UIA_ChromeAccessibility(3) ConsoleWrite(" ***** Just for debugging. ***** Error: " & @error & " Extended: " & @extended & " Line: " & @ScriptLineNumber & " RC: " & $rc & @LF) MsgBox(64+262144, Default, "Bye, bye",5) I hope this little function is helpfull for you. Thanks Exit
  20. Look at _WinAPI_RegisterShellHookWindow () example, but use this message instead $HSHELL_FLASH
  21. yes, so how can i use fileExist before creating a folder since it will tell me systematically that this folder does not exist ?
  22. Wrong read help file : Return Value Success: 1. Failure: 0 if path/file does not exist.
  23. Nine, FileExists () is for directories or files that are already exist, here, as i said, i want to verify before creating the directory
  24. Jos because using DirCreate with a file path create a directory with a file name like toto.csv, and so there is no failure.
  1. Load more activity
  • Create New...