AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

the data area passed to a system call is too small

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
Rapte_Of_Suzaku



Joined: 29 Feb 2008
Posts: 5

PostPosted: Fri Feb 29, 2008 8:56 pm    Post subject: the data area passed to a system call is too small Reply with quote

This error message pops up whenever I try to pass a bunch of parameters (or a few huge ones) to a script. I'm relatively sure it isn't specific to AHK, but I only ever encounter it when making AHK scripts.

I have a few ideas of how to get around this for the things I'm currently doing, but I'd like to know if there is a setting I can change or some elegant piece of code that can address this issue directly.

Oh, and the parameters are (at least in the most recent case) pretty much necessary. I'm using FileMenuTools to add an AHK script to the context menu, where I then wish to select any number of items in an explorer window to send to the script. Specifically, the current script fixes that annoying issue that comes from some people compressing a single folder and some people compressing a bunch of files (fixes by removing redundantly nested folders -- rename "H:\A\B" to "H:\A" if H:\A has only 1 folder and no files).

Any good ideas?

(Thanks in advance)
Edit:fixed subject line twice
Back to top
View user's profile Send private message
wOxxOm



Joined: 09 Feb 2006
Posts: 319

PostPosted: Tue Mar 04, 2008 12:53 pm    Post subject: Reply with quote

it depends on how the script is invoked, some file processing utilities can pass all files in command line up to 64kB Smile or may pass a name of temporary text file with all the file names to be processed - this is preferred in your case. For example TotalCommander's analog is %S and %L
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Rapte_Of_Suzaku



Joined: 29 Feb 2008
Posts: 5

PostPosted: Tue Mar 04, 2008 2:53 pm    Post subject: Reply with quote

Ah.

For less frequently used tools, I put them in the context menu rather than assigning a hotkey. I'll recommend that the context menu editing tool I use (FileMenu Tools) add the temporary file method as an option. Until then, I'll modify an older script to make that temporary file myself using ControlGet for the selected items of a listbox.


Thanks for your help!
Back to top
View user's profile Send private message
instantrunoff



Joined: 13 Jan 2008
Posts: 77

PostPosted: Tue Jun 03, 2008 4:03 pm    Post subject: Reply with quote

I'm having this issue using a compiled AHK script within the SendTo menu: too many files send to it gives this error. Any suggestions?

Code:
#NoEnv
#SingleInstance Off
#Persistent
TrayTip, MultiRun, Opening %0% files...
SetTimer, RemoveTrayTip, 5000
If (0 > 10)
{
MsgBox, 1, MultiRun, Open %0% files?
IfMsgBox, Cancel
ExitApp
}
loop, %0%
{   
    param := %A_Index%  ; Fetch the contents of the variable whose name is contained in A_Index
    loop, %param%
    {
    Run, %A_LoopFileLongPath%, , UseErrorLevel
    If ErrorLevel
   {       
       MsgBox, 518, MultiRun, Unable to open %A_LoopFileName%
       IfMsgBox Continue
       break
       IfMsgBox TryAgain
       continue
       IfMsgBox Cancel
       ExitApp
       }
}
}
okexit = 1
return

RemoveTrayTip:
TrayTip
If okexit
ExitApp
return
Back to top
View user's profile Send private message Visit poster's website
Rapte_Of_Suzaku



Joined: 29 Feb 2008
Posts: 5

PostPosted: Tue Jun 03, 2008 4:22 pm    Post subject: Reply with quote

Check out my post "The Separation of GUI and command line has always bugged me" in the "Scripts & Functions" forum. Specifically, use the first posted script and its function "get_explorer_selection". This way, your script can grab the full file paths directly from the explorer window itself rather than trying to pass them all as arguments.

You could also use the clipboard and copy the files... the true file paths are in there somewhere (I didn't have much luck though).




If your interested in how I'm doing similar things outside of AHK, read on. Otherwise, ignore the rest of this post.


It seems that AHK just isn't setup to do these sorts of tasks in a simple way. Programming languages like C++ or C# are able to obtain the full file paths of dragged and dropped objects with no trouble at all. I'm currently working on a program that will run any command you want using the user supplied files. You can drop the files in, or paste them in. To get an idea of how it works:



type: "foobar.exe <music files>"

press enter

drag or paste your chosen music files onto the box that appears on the form near the text <music files>

and run the command.



If anyone is interested, I'll post back once I get a bit more done. Everything but the running the command at the end (and some cosmetics) is already done.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group